[FIX] pos_sale: correct value in untaxed_amount of sale report

Current behavior:
When selling a product that have a taxe set in a PoS, the sale report
was not correct. The collumn untaxed amount to invoice would contains
the amount to invoice that includes the taxes wich is not correct.

Steps to reproduce:
- Install sales & pos
- Set the Acoustic bloc screen tax to 15%
- Open a pos session and Sell an acoustic bloc screen
- Validate the payment and close the session
- Open the sales app
- Sell an acoustic bloc screen to any customer
- Deliver it (update it's quantity if necessary)
- Sales > Reporting > Sales
- Switch to the pivot view
- On the "measures" button, check "Untaxed Amount Invoiced" and "Untaxed Amount To Invoice"
- Show the entries by Order#
- "Untaxed amount to invoice" should be the same as "untaxed total"

opw-2681477

closes odoo/odoo#92217

X-original-commit: 8c20fb4e126822d81fa7e1de6912d5c75a881b7b
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
roen-odoo
2022-05-27 10:46:37 +02:00
parent 537e82d78d
commit c9a58904c5
+2 -2
View File
@@ -40,11 +40,11 @@ class SaleReport(models.Model):
* MIN({self._case_value_or_one('pos.currency_rate')})
* {self._case_value_or_one('currency_table.rate')}
AS price_subtotal,
(CASE WHEN pos.state != 'invoiced' THEN SUM(l.price_subtotal_incl) ELSE 0 END)
(CASE WHEN pos.state != 'invoiced' THEN SUM(l.price_subtotal) ELSE 0 END)
* MIN({self._case_value_or_one('pos.currency_rate')})
* {self._case_value_or_one('currency_table.rate')}
AS amount_to_invoice,
(CASE WHEN pos.state = 'invoiced' THEN SUM(l.price_subtotal_incl) ELSE 0 END)
(CASE WHEN pos.state = 'invoiced' THEN SUM(l.price_subtotal) ELSE 0 END)
* MIN({self._case_value_or_one('pos.currency_rate')})
* {self._case_value_or_one('currency_table.rate')}
AS amount_invoiced,