[FIX] sale: performance hit in sale.order.line creation (#20417)
The access to the state of sale.order.line (related field) seems very slow for big sale order. Bypassing the related field and using the real field instead, improves performance.
This commit is contained in:
committed by
Raphael Collet
parent
088f1e3fdc
commit
f51d24d613
@@ -696,7 +696,7 @@ class SaleOrderLine(models.Model):
|
||||
def create(self, values):
|
||||
values.update(self._prepare_add_missing_fields(values))
|
||||
line = super(SaleOrderLine, self).create(values)
|
||||
if line.state == 'sale':
|
||||
if line.order_id.state == 'sale':
|
||||
line._action_procurement_create()
|
||||
msg = _("Extra line with %s ") % (line.product_id.display_name,)
|
||||
line.order_id.message_post(body=msg)
|
||||
|
||||
Reference in New Issue
Block a user