odoo/odoo#97186
Created by Bugfix, Séna Serge Nshimiyimana (sesn)
Merged
at 6605cc6673b8d46e1978c788fb48fc3828841112
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team for help in case of failure.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:15.0-opw-2896797-invoicing_switch_threshold_wrong_qty_invoiced-sesn
- head
- 863d4d4cf65c071a42a72c81d4dd3fa059d07b0b
- merged
- 3 years ago by Accounting, William André (wan)
odoo/odoo | |
---|---|
15.0 | #97186 |
saas-15.2 | #98496 |
saas-15.3 | #98879 |
16.0 | |
17.0 | |
18.0 | |
saas-18.1 | |
saas-18.2 | |
saas-18.3 | |
master | #98909 |
[FIX] sale, purchase: fix invoicing interaction with “Invoicing Switch Threshold”
Steps to reproduce
- Create a sale order with a product that's invoiced on delivered quantities.
- Set delivered quantity (partial delivery) and create an invoice based on the delivered quantity. Set the "Invoice Date" to sometime in the past.
- Go to the settings and set "Invoicing Switch Threshold" to any date in the future (so that the invoice you created has a date BEFORE the new threshold)
- The invoice will get the label "invoicing app legacy".
- Go back to the sales order and change the delivered quantity.
You should see that the invoiced quantity is automatically set to 0.
A similar behavior can be observed with purchase orders.
Why this is happening
When a new “Invoicing Switch Threshold” is set, all posted invoices before the threshold are marked as canceled
. In v15, changing the delivered quantities triggers the invoiced quantities to be recalculated as well. However, computing invoiced quantities doesn't take into account invoices that are marked as canceled
. This mean that the newly computed invoiced quantities won't include invoices posted before threshold.