diff --git a/addons/mrp_account/models/stock_move.py b/addons/mrp_account/models/stock_move.py index 86c19e23894d2e9e3ebe61a00b53ab0eca13b104..e65f0a407d91be02afb0e2cff1aebd15920fd1c9 100644 --- a/addons/mrp_account/models/stock_move.py +++ b/addons/mrp_account/models/stock_move.py @@ -27,3 +27,7 @@ class StockMove(models.Model): res = super(StockMove, self)._filter_anglo_saxon_moves(product) res += self.filtered(lambda m: m.bom_line_id.bom_id.product_tmpl_id.id == product.product_tmpl_id.id) return res + + def _should_force_price_unit(self): + self.ensure_one() + return self.picking_type_id.code == 'mrp_operation' or super()._should_force_price_unit() diff --git a/addons/mrp_account/tests/test_valuation_layers.py b/addons/mrp_account/tests/test_valuation_layers.py index b0827494ed105f3d8b220c94d7af7b09e5342565..d0b859fe91eb4fcc7c87b1fd8302f31b4b0cf418 100644 --- a/addons/mrp_account/tests/test_valuation_layers.py +++ b/addons/mrp_account/tests/test_valuation_layers.py @@ -198,9 +198,22 @@ class TestMrpValuationStandard(TestMrpValuationCommon): self.assertEqual(self.product1.value_svl, 8.8 * 2) self.assertEqual(self.component.quantity_svl, 0) self.assertEqual(self.product1.quantity_svl, 2) + self.assertEqual(self.product1.standard_price, 8.8) + self._make_out_move(self.product1, 1) self.assertEqual(self.product1.value_svl, 8.8) + # Update component price + self.component.standard_price = 0 + + self._make_in_move(self.component, 3) + mo = self._make_mo(self.bom, 3) + self._produce(mo) + mo.button_mark_done() + self.assertEqual(self.product1.value_svl, 8.8) + self.assertEqual(self.product1.quantity_svl, 4) + self.assertEqual(self.product1.standard_price, 2.2) + def test_std_std_1(self): self.component.product_tmpl_id.categ_id.property_cost_method = 'standard' self.product1.product_tmpl_id.categ_id.property_cost_method = 'standard'