Comment 3 for bug 610738

Revision history for this message
invitu (invitu) wrote : Re: [5.0] return products to supplier does not update price average

Nhomar,

You got what I meant but there was some errors in your formulae (btw, the results were ok). It should be :
1- We have 10 products with average price = 100
2- We receive 5 products with price = 80 --> average price is calculated as (10*100+5*80)/(10+5) = 93,33
2.5- We receive 5 products with price = 82 --> average price is calculated as (15*93,33+5*82)/(15+5) = 90,5
CASE A.
3- We return 3 products from the last packing list (the one where products cost 82)
The new average price should be
(90,5*20 - 3*82)/(20-3)=92
CASE B
3- We return 3 products from the last packing list (the one where products cost 80)
The new average price should be
(90,5*20 - 3*80)/(20-3)=92,35

Jay, could you keep in mind that the returns from customers should follow the same rule EXCEPT that you should take the cost price instead of the sale price to update the average price. I opened a bug for customer returns case : https://bugs.launchpad.net/openobject-addons/+bug/613286
and there also is a linked bug in case packing are cancelled or deleted : https://bugs.launchpad.net/openobject-addons/+bug/495363

==> 2 consequences :
- returns to suppliers and returns from customers should not take the same price to update average price
- both cost price and sale price should be stored in the picking. In the purchase pickings, the cost price field should remain empty

Moreover, please take into account that products could be re-returned (and re-re-returned...etc) in both supplier and customer cases.

Thanks for your attention

Regards