← Back to team overview

openerp-community team mailing list archive

Problem on partial picking (wrong unit price)

 

[ Problem on partial picking ]


When you're doing a partial picking and you want to change the cost of each product, the invoice that get's generated at the end of the whole process does not maintain the values you inserted.
This happens because, each time a partial picking is done, a record is created but the price you chose is not written in the mentioned record. Rather, it is updated in the previous one. In the end, two prices will be wrongly indicated.

The way to solve this is to change the ('stock.move').do_partial method so that each new record get's updated with the right cost.

Find ...
    new_move = self.copy(cr, uid, move.id, defaults)

and change it to...
    new_move = self.copy(cr, uid, move.id, defaults)
    self.write(cr, uid, [new_move], {'price_unit': product_price, 'price_currency_id': product_currency,})





How to test this:

1) Create a purchase order (with one article and quantity=3) and confirm/approve it.
2) Go to Purchases / Incoming Products / Incoming Products
3) Open the line related to the purchase order you've done
4) Hit the "Process Partially" button
5) In the new window, change the "Quantity" to 1 and the "Cost" to 10.
6) Validate

(repeat the process, keeping "Quantity" to 1 and changing the Cost to 20 and 30)

7) Go to Purchases / Invoice Control / On Incoming Shipments"
8) Choose the appropriate line
9) Hit the "Create nvoice/Refund" button
10) In the new window, choose "Group by partner" and press "Create"
11) Open the invoice

You should have three lines:
    line 1, qty=1, unit price=10
    line 2, qty=1, unit price=20
    line 3, qty=1, unit price=30

Instead, what you have is
    line 1, qty=1, unit price=30
    line 2, qty=1, unit price=(original price)
    line 3, qty=1, unit price=10