[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) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-04-09 11:23:49 +00:00
parent 8b22387d80
commit 30113e1197
+2 -2
View File
@@ -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,