Skip to content
Snippets Groups Projects
Commit f51d24d6 authored by François Honoré (Acsone)'s avatar François Honoré (Acsone) Committed by Raphael Collet
Browse files

[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.
parent 088f1e3f
Branches
Tags
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment