From 30113e11974419f786b5628c3d1ca4db2d582638 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 6 Apr 2020 08:45:36 +0000 Subject: [PATCH] [FIX] pos_sale: fix delivered/sold quantity reported Create a product with UoM Dozens Sold 5x via POS Go to the product page The smart button does not reflect the correct quantity (0.42 instead of 5). Fixing by editing the SQL query, the POS already provide the correct quantity of sold goods as it is not possible to change the UoM. This aim to match the behavior of sale (where is necessary to account for possible differences between the uom reported on the sale order line and the one specified in the product page) opw-2227482 closes odoo/odoo#49313 X-original-commit: 7af831fe47005c6a7724d8d28bf3d045a75f0f09 Signed-off-by: Nicolas Martinelli (nim) --- 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 b0584edaa70..4618651ec2c 100644 --- a/addons/pos_sale/report/sale_report.py +++ b/addons/pos_sale/report/sale_report.py @@ -26,8 +26,8 @@ class SaleReport(models.Model): MIN(l.id) AS id, l.product_id AS product_id, t.uom_id AS product_uom, - sum(l.qty * u.factor) AS product_uom_qty, - sum(l.qty * u.factor) AS qty_delivered, + 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, 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,