[IMP] point_of_sale: pos order report performance

This inner join permit to have filters on orders to be executed earlier in the query plan
In a multi-company environment with millions of pos lines, the difference is about 10% faster
As you cannot have a line without order, this doesn't introduce reggression.

closes odoo/odoo#34849

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Nicolas Seinlet
2019-07-15 08:01:12 +00:00
committed by Pierre Masereel
parent afa4c09129
commit 99b22078de
@@ -69,7 +69,7 @@ class PosOrderReport(models.Model):
def _from(self):
return """
FROM pos_order_line AS l
LEFT JOIN pos_order s ON (s.id=l.order_id)
INNER JOIN pos_order s ON (s.id=l.order_id)
LEFT JOIN product_product p ON (l.product_id=p.id)
LEFT JOIN product_template pt ON (p.product_tmpl_id=pt.id)
LEFT JOIN uom_uom u ON (u.id=pt.uom_id)