[FIX] stock_account: AVCO with MRP

- Create a product P with:
  Costing Method       Average Price
  Inventory Valuation  Perpetual (automated)
- Create a component C with, costing 10.
- Create a BOM for P:
  1 Unit of C
- Create a MO for P, validate
  => a journal entry of 10 is created
- Modify the BOM for P:
  2 Units of C
- Create a MO for P, validate
  => a journal entry of 15 is created

The journal entry should be 20.

opw-1928342

closes odoo/odoo#30766
This commit is contained in:
Nicolas Martinelli
2019-02-01 13:22:32 +00:00
parent 266f99f545
commit 8cb2965e23
+1 -1
View File
@@ -285,7 +285,7 @@ class StockMove(models.Model):
valuation_amount = self._context.get('force_valuation_amount')
else:
if self.product_id.cost_method == 'average':
valuation_amount = cost if self.location_id.usage == 'supplier' and self.location_dest_id.usage == 'internal' else self.product_id.standard_price
valuation_amount = cost if self.location_id.usage in ['supplier', 'production'] and self.location_dest_id.usage == 'internal' else self.product_id.standard_price
else:
valuation_amount = cost if self.product_id.cost_method == 'real' else self.product_id.standard_price
# the standard_price of the product may be in another decimal precision, or not compatible with the coinage of