summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2014-12-24 10:21:47 +0100
committerMartin Trigaux <mat@odoo.com>2014-12-24 11:23:51 +0100
commit1fd13fbe2bb32e55757b3d1950ac2aa2ada1b2ad (patch)
tree6e8e63a683e724eb5a093873680c519d01373853
parent544eefdd32d65dc76cfdd5272b3166a364e8fcab (diff)
[FIX] stock_account: return product at purchased price
For FIFO and standard price, return product at the purchased price instead of the cost or current standard price. Not applied for average as returning a purchased product do not recompute the average price and would lead to an inconsistency in the stock value. opw 615263
-rw-r--r--addons/stock_account/stock_account.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py
index 2fcc661c079..78d33b8ae04 100644
--- a/addons/stock_account/stock_account.py
+++ b/addons/stock_account/stock_account.py
@@ -194,7 +194,14 @@ class stock_quant(osv.osv):
if move.product_id.cost_method == 'average':
valuation_amount = move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and cost or move.product_id.standard_price
else:
- valuation_amount = move.product_id.cost_method == 'real' and cost or move.product_id.standard_price
+ # TODO check also in average price and correct product price
+ if move.origin_returned_move_id:
+ # use the original cost of the returned product to cancel the cost
+ valuation_amount = move.origin_returned_move_id.price_unit
+ elif move.product_id.cost_method == 'real':
+ valuation_amount = cost
+ else:
+ valuation_amount = move.product_id.standard_price
#the standard_price of the product may be in another decimal precision, or not compatible with the coinage of
#the company currency... so we need to use round() before creating the accounting entries.
valuation_amount = currency_obj.round(cr, uid, move.company_id.currency_id, valuation_amount * qty)