[IMP] pos_sale: speciify table for qty field in request

In the sale_report sql request for pos orders, the field qty of order
lines is used without specifying the table it comes from.

To avoid ambiguity if a field with same name is declared in another
table of the join, we prefix it by its table.

ISSUE-54933

closes odoo/odoo#54960

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Pierre Masereel
2020-07-27 09:48:33 +00:00
parent a4d6b0d286
commit 056246665f
+2 -2
View File
@@ -28,8 +28,8 @@ class SaleReport(models.Model):
t.uom_id AS product_uom,
sum(l.qty) AS product_uom_qty,
sum(l.qty) AS qty_delivered,
CASE WHEN pos.state = 'invoiced' THEN sum(qty) ELSE 0 END AS qty_invoiced,
CASE WHEN pos.state != 'invoiced' THEN sum(qty) ELSE 0 END AS qty_to_invoice,
CASE WHEN pos.state = 'invoiced' THEN sum(l.qty) ELSE 0 END AS qty_invoiced,
CASE WHEN pos.state != 'invoiced' THEN sum(l.qty) ELSE 0 END AS qty_to_invoice,
SUM(l.price_subtotal_incl) / MIN(CASE COALESCE(pos.currency_rate, 0) WHEN 0 THEN 1.0 ELSE pos.currency_rate END) AS price_total,
SUM(l.price_subtotal) / MIN(CASE COALESCE(pos.currency_rate, 0) WHEN 0 THEN 1.0 ELSE pos.currency_rate END) AS price_subtotal,
(CASE WHEN pos.state != 'invoiced' THEN SUM(l.price_subtotal_incl) ELSE 0 END) / MIN(CASE COALESCE(pos.currency_rate, 0) WHEN 0 THEN 1.0 ELSE pos.currency_rate END) AS amount_to_invoice,