[FIX] stock: remove dummy field from depends_context
This commit removes 'location' and 'warehouse' from the api.depends_context of _compute_quantities() as: 1. They are not needed. They are never changed in a single transaction in the current code 2. The ORM doens't support the fact that they are sometimes passed as list instead of integer closes odoo/odoo#36788 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
committed by
Simon Lejeune
parent
02599afd49
commit
de2725c173
@@ -1047,11 +1047,12 @@ class TestSaleMrpFlow(common.SavepointCase):
|
||||
# Check that not enough enough quantities are available in the warehouse set in the SO
|
||||
# but there are enough quantities in Warehouse 1 for 1 kit_parent
|
||||
kit_parent_wh_order = self.kit_parent.with_context(warehouse=so.warehouse_id.id)
|
||||
kit_parent_wh1 = self.kit_parent.with_context(warehouse=warehouse_1.id)
|
||||
|
||||
# Check that not enough enough quantities are available in the warehouse set in the SO
|
||||
# but there are enough quantities in Warehouse 1 for 1 kit_parent
|
||||
self.assertEquals(kit_parent_wh_order.virtual_available, 0)
|
||||
kit_parent_wh_order.invalidate_cache()
|
||||
kit_parent_wh1 = self.kit_parent.with_context(warehouse=warehouse_1.id)
|
||||
self.assertEquals(kit_parent_wh1.virtual_available, 1)
|
||||
|
||||
# Check there arn't enough quantities available for the sale order
|
||||
@@ -1072,8 +1073,9 @@ class TestSaleMrpFlow(common.SavepointCase):
|
||||
# As 'Warehouse 2' is the warehouse linked to the SO, 3 kits should be available
|
||||
# But the quantity available in Warehouse 1 should stay 1
|
||||
kit_parent_wh_order = self.kit_parent.with_context(warehouse=so.warehouse_id.id)
|
||||
kit_parent_wh1 = self.kit_parent.with_context(warehouse=warehouse_1.id)
|
||||
self.assertEquals(kit_parent_wh_order.virtual_available, 3)
|
||||
kit_parent_wh_order.invalidate_cache()
|
||||
kit_parent_wh1 = self.kit_parent.with_context(warehouse=warehouse_1.id)
|
||||
self.assertEquals(kit_parent_wh1.virtual_available, 1)
|
||||
|
||||
# Check there arn't enough quantities available for the sale order
|
||||
|
||||
@@ -94,7 +94,7 @@ class Product(models.Model):
|
||||
@api.depends('stock_move_ids.product_qty', 'stock_move_ids.state')
|
||||
@api.depends_context(
|
||||
'lot_id', 'owner_id', 'package_id', 'from_date', 'to_date',
|
||||
'company_owned', 'location', 'warehouse', 'force_company',
|
||||
'company_owned', 'force_company',
|
||||
)
|
||||
def _compute_quantities(self):
|
||||
products = self.filtered(lambda p: p.type != 'service')
|
||||
@@ -616,7 +616,7 @@ class ProductTemplate(models.Model):
|
||||
'product_variant_ids.stock_move_ids.product_qty',
|
||||
'product_variant_ids.stock_move_ids.state',
|
||||
)
|
||||
@api.depends_context('company_owned', 'location', 'warehouse', 'force_company')
|
||||
@api.depends_context('company_owned', 'force_company')
|
||||
def _compute_quantities(self):
|
||||
res = self._compute_quantities_dict()
|
||||
for template in self:
|
||||
|
||||
Reference in New Issue
Block a user