CRM, Sales & Marketing mailing list archives

crm-sales-marketing@odoo-community.org

Avatar

Re: Big performance issue with sale orders with more than 500 lines

by "Quentin THEURET" <contact@kerpeo.com> - 22/03/2022 12:24:26

HI,

You can test to create the lines at the same time as the sale order by using this (my example contains only 2 line, but you do it with multiple lines) :

order_data = YOUR_ORDER_DATA_DICT

line1_data = LINE1_DATA_DICT

line2_date = LINE2_DATA_DICT

order_data.update({'order_line': [(0, 0, line1_data), (0, 0, line2_data)]})

sale = self.env['sale.order'].create(order_data)


I hope my explanation will help you.

Have a good day


Le 22/03/2022 à 12:07, Josean Soroa - Landoo a écrit :
Hi all.
In Odoo version 14, we are facing big performance issues with sale orders that have more than 500 lines.
We are creating lines fron XML-RPC so it has nothing to see with web interface.
The problem is _amount_all method. Each time a line is created, this method reads all lines and computes total amounts of sale order. (line 40 of sale.py)
@api.depends('order_line.price_total')
def _amount_all(self):
...
for line in order.order_line:
...
This is very inefficient.
I can't find nothing developed to avoid this Odoo behaviour.
Has anyone solved this issue?
Many thanks.
-----------------------------------------------------------
Josean Soroa
LANDOO SL - www.landoo.es
-----------------------------------------------------------





-- 
Quentin THEURET

Reference