You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating invoice through sale order the resulting invoice may have tax rounding errors.
Sales order
Invoice
To Reproduce
Affected versions:
16.0
Steps to reproduce the behavior:
Create a sale order with fixed discount, test case 870€ with fixed discount of 70€, resulting in total 800€.
Create invoice from the sale order, you will see that the resulting invoice total and tax amount is different.
Expected behavior
Fixed discount should be applied on invoice without causing rounding issues
Additional context
The tax will be corrected if editing the line through UI form. I've attempted to patch this in account.move create() by recalculating taxes and totals (after creation), but that did not work. Neither did patching _create_invoices in sale.order.
In desperation I also tried tests.Form to edit the lines in hopes of triggering re-computation, which also did not work.
The behavior of the module has been changed drastically between 14.0 and 16.0 versions, it used to affect the price unit in computations, whereas now it's a helper field to compute discount percent.
There are few complications to this:
The changes were done without accounting for it in migration scripts, when migrating from previous versions the discount percent will be zero on sales order, if creating invoice from this the resulting invoice will be garbage.
There's a constraint for the discounts but is not being enforced unless you edit the discounts. There should be additional validation in the sale side of the module to inform the user of the error if creating invoice. Either that or proper migration script should be created.
Needless to say this approach is asking for trouble, I don't understand why it was changed, and hopefully the approach will be reconsidered.
The text was updated successfully, but these errors were encountered:
PNurm
changed the title
account_invoice_fixed_discount: Tax rounding error when creating invoice through sale order
[16.0] account_invoice_fixed_discount: Tax rounding error when creating invoice through sale order
Jun 19, 2024
Module
account_invoice_fixed_discount
Describe the bug
When creating invoice through sale order the resulting invoice may have tax rounding errors.
Sales order
Invoice
To Reproduce
Affected versions:
16.0
Steps to reproduce the behavior:
Expected behavior
Fixed discount should be applied on invoice without causing rounding issues
Additional context
The tax will be corrected if editing the line through UI form. I've attempted to patch this in account.move create() by recalculating taxes and totals (after creation), but that did not work. Neither did patching _create_invoices in sale.order.
In desperation I also tried tests.Form to edit the lines in hopes of triggering re-computation, which also did not work.
The behavior of the module has been changed drastically between 14.0 and 16.0 versions, it used to affect the price unit in computations, whereas now it's a helper field to compute discount percent.
There are few complications to this:
The changes were done without accounting for it in migration scripts, when migrating from previous versions the discount percent will be zero on sales order, if creating invoice from this the resulting invoice will be garbage.
There's a constraint for the discounts but is not being enforced unless you edit the discounts. There should be additional validation in the sale side of the module to inform the user of the error if creating invoice. Either that or proper migration script should be created.
Needless to say this approach is asking for trouble, I don't understand why it was changed, and hopefully the approach will be reconsidered.
The text was updated successfully, but these errors were encountered: