mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] stock_secondary_unit: Remove _merge_moves_fields method. Now Odoo compute the change
This commit is contained in:
committed by
Rocío Vega
parent
5e14b2af25
commit
1a2c709770
@@ -24,11 +24,6 @@ class StockMove(models.Model):
|
|||||||
def onchange_product_uom_for_secondary(self):
|
def onchange_product_uom_for_secondary(self):
|
||||||
self._onchange_helper_product_uom_for_secondary()
|
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
|
@api.model
|
||||||
def _prepare_merge_moves_distinct_fields(self):
|
def _prepare_merge_moves_distinct_fields(self):
|
||||||
"""Don't merge moves with distinct secondary units"""
|
"""Don't merge moves with distinct secondary units"""
|
||||||
|
|||||||
@@ -96,7 +96,9 @@ class TestProductSecondaryUnit(TransactionCase):
|
|||||||
secondary_unit = cls.env["product.secondary.unit"].search(
|
secondary_unit = cls.env["product.secondary.unit"].search(
|
||||||
[("product_tmpl_id", "=", cls.product_template.id)], limit=1
|
[("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"]
|
StockQuant = cls.env["stock.quant"]
|
||||||
cls.quant_white = StockQuant.create(
|
cls.quant_white = StockQuant.create(
|
||||||
{
|
{
|
||||||
@@ -114,7 +116,7 @@ class TestProductSecondaryUnit(TransactionCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_01_stock_secondary_unit_template(self):
|
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):
|
def test_02_stock_secondary_unit_variant(self):
|
||||||
for variant in self.product_template.product_variant_ids.filtered(
|
for variant in self.product_template.product_variant_ids.filtered(
|
||||||
|
|||||||
Reference in New Issue
Block a user