[FIX] sale_stock: refactor badly written method causing performances issues (#20193)
This commit is contained in:
committed by
Raphael Collet
parent
03180ecb0c
commit
59b010ac36
@@ -109,11 +109,13 @@ class SaleOrderLine(models.Model):
|
||||
@api.multi
|
||||
@api.depends('product_id')
|
||||
def _compute_qty_delivered_updateable(self):
|
||||
for line in self:
|
||||
if line.product_id.type not in ('consu', 'product'):
|
||||
super(SaleOrderLine, line)._compute_qty_delivered_updateable()
|
||||
else:
|
||||
line.qty_delivered_updateable = False
|
||||
# prefetch field before filtering
|
||||
self.mapped('product_id')
|
||||
# on consumable or stockable products, qty_delivered_updateable defaults
|
||||
# to False; on other lines use the original computation
|
||||
lines = self.filtered(lambda line: line.product_id.type not in ('consu', 'product'))
|
||||
lines = lines.with_prefetch(self._prefetch)
|
||||
super(SaleOrderLine, lines)._compute_qty_delivered_updateable()
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id_set_customer_lead(self):
|
||||
|
||||
Reference in New Issue
Block a user