From 84f0e84d14ee273d199690a4ebefa7a6cd95e949 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Wed, 30 Aug 2017 22:33:56 +0200 Subject: [PATCH] [FIX] stock_account: standard price update move done When you change the quantity done of a done move of a product valuated by standard price in perpetual valuation, the price used to update create the corrective journal entry is the price unit of the move instead of the standard price. This behaviour leads to iconsistancy like having a empty stock and still have a valuation on the stock valuation account. To fix this issue, we check if we are working in standard price and use the standard price of the product instead of the move unit price. --- addons/stock_account/models/stock.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index d4564d97959..cadeaea8bb8 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -72,7 +72,10 @@ class StockMoveLine(models.Model): } move_id.write(move_vals) if move_id.product_id.valuation == 'real_time': - move_id.with_context(force_valuation_amount=qty_difference*move_id.price_unit)._account_entry_move() + if move_id.product_id.cost_method == 'standard': + move_id.with_context(force_valuation_amount=qty_difference * move_id.product_id.standard_price)._account_entry_move() + else: + move_id.with_context(force_valuation_amount=qty_difference*move_id.price_unit)._account_entry_move() return super(StockMoveLine, self).write(vals)