[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.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user