From 056246665f02c331ba0589618cf030482709f1da Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Mon, 27 Jul 2020 09:48:33 +0000 Subject: [PATCH] [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 --- addons/pos_sale/report/sale_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/pos_sale/report/sale_report.py b/addons/pos_sale/report/sale_report.py index 374013aad4f..8238f5938ee 100644 --- a/addons/pos_sale/report/sale_report.py +++ b/addons/pos_sale/report/sale_report.py @@ -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,