diff --git a/stock_secondary_unit/models/stock_move.py b/stock_secondary_unit/models/stock_move.py index 22c1580e1..a358038ad 100644 --- a/stock_secondary_unit/models/stock_move.py +++ b/stock_secondary_unit/models/stock_move.py @@ -24,11 +24,6 @@ class StockMove(models.Model): def onchange_product_uom_for_secondary(self): self._onchange_helper_product_uom_for_secondary() - def _merge_moves_fields(self): - res = super()._merge_moves_fields() - res["secondary_uom_qty"] = sum(self.mapped("secondary_uom_qty")) - return res - @api.model def _prepare_merge_moves_distinct_fields(self): """Don't merge moves with distinct secondary units""" diff --git a/stock_secondary_unit/tests/test_stock_secondary_unit.py b/stock_secondary_unit/tests/test_stock_secondary_unit.py index 01e38ae17..b8bb8f4dd 100644 --- a/stock_secondary_unit/tests/test_stock_secondary_unit.py +++ b/stock_secondary_unit/tests/test_stock_secondary_unit.py @@ -96,7 +96,9 @@ class TestProductSecondaryUnit(TransactionCase): secondary_unit = cls.env["product.secondary.unit"].search( [("product_tmpl_id", "=", cls.product_template.id)], limit=1 ) - cls.product_template.write({"stock_secondary_uom_id": secondary_unit.id}) + cls.product_template.product_variant_ids.write( + {"stock_secondary_uom_id": secondary_unit.id} + ) StockQuant = cls.env["stock.quant"] cls.quant_white = StockQuant.create( { @@ -114,7 +116,7 @@ class TestProductSecondaryUnit(TransactionCase): ) def test_01_stock_secondary_unit_template(self): - self.assertEqual(self.product_template.secondary_unit_qty_available, 40.0) + self.assertEqual(self.product_template.secondary_unit_qty_available, 0) def test_02_stock_secondary_unit_variant(self): for variant in self.product_template.product_variant_ids.filtered(