diff options
| author | Jorge Pinna Puissant <jpp@odoo.com> | 2020-06-29 11:30:40 +0000 |
|---|---|---|
| committer | Jorge Pinna Puissant <jpp@odoo.com> | 2020-07-01 17:24:19 +0000 |
| commit | efe51fa56a1849c1be268e357b059a8f6d15c12c (patch) | |
| tree | d0b8717710a7b60352a8baf22325915d5b187884 | |
| parent | 058698e10491d73009824cbb83dd9bcc6aff3633 (diff) | |
[FIX] account: negative credit note product qty in invoice report
- Create an invoice with a Product X and Post it;
- Generate a Credit Note from the invoice;
- Reporting > Invoices;
- use Pivot Table View;
- Enable 'Product Quantity' in Measures;
- Filter by 'Invoice #';
- Expand Pivot Table by 'Product'.
Before this commit, the products in the credit note had a positive sign,
contrary to the untax total that has a negative sign. The issue with
this, is when the quantities of the credit notes is added with the
quantities of the invoices the total is not coherent with the actual
sell products.
Now, the product quantity that comes from a credit note has a negative
sign. This was already the behaviour in version 11 and 12.
opw-2283833
closes odoo/odoo#53931
X-original-commit: 917b2076b77ba3f682b342989c41b7f7d0670ca2
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
| -rw-r--r-- | addons/account/report/account_invoice_report.py | 2 | ||||
| -rw-r--r-- | addons/account/tests/test_account_invoice_report.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 7559fe68361..eb2a8633c78 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -92,7 +92,7 @@ class AccountInvoiceReport(models.Model): move.invoice_date_due, uom_template.id AS product_uom_id, template.categ_id AS product_categ_id, - line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0) + line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0) * (CASE WHEN move.move_type IN ('in_invoice','out_refund','in_receipt') THEN -1 ELSE 1 END) AS quantity, -line.balance AS price_subtotal, -line.balance / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0) diff --git a/addons/account/tests/test_account_invoice_report.py b/addons/account/tests/test_account_invoice_report.py index fe4327d5b30..92009dd8522 100644 --- a/addons/account/tests/test_account_invoice_report.py +++ b/addons/account/tests/test_account_invoice_report.py @@ -112,7 +112,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon): [1000, 1000, 1], [1000, 1000, 3], [6, 6, 1], - [-20, -20, 1], - [-20, -20, 1], - [-600, -600, 1], + [-20, -20, -1], + [-20, -20, -1], + [-600, -600, -1], ]) |
