diff options
| author | Damien Bouvy <dbo@odoo.com> | 2020-01-09 16:10:19 +0000 |
|---|---|---|
| committer | Damien Bouvy <dbo@odoo.com> | 2020-01-13 09:37:28 +0000 |
| commit | a0f02bd5f6b2afa382f58ffa5f0d43c32db65bee (patch) | |
| tree | 6f493a3d11f7a107015b08807efab6b563553693 /addons/web/static/src/js/fields/basic_fields.js | |
| parent | 1d58b760326712bd9d778b196829149896a0882e (diff) | |
[FIX] sale: take taxes into account during invoices -> refund switch
Before this commit, the invoice creation flow of a sales order checked
if the amount of the generated invoice was positive or negative - if it
was negative, then the invoice would be converted to a refund instead.
Unfortunately, this check was done before the move was actually created
\- meaning that the only way to compute the total of the move was to
multiply the quantities and unit prices of what was about to be included
in the move - ignoring taxes altogether. Since taxes would then be
applied during the move's creation, you could in fact have a refund that
ended up being negative because some products would end up with
different taxes.
A simple (although weird) example would happen if you registered a
down payment that was actually greater than the subtotal of your
quote (but lower than the total with taxes included).
Example:
Create a quote for a 100$ product with 15% tax
Register a downpayment of 105$ and validate that invoice
Invoice the rest:
=> you end up with a refund of -10$, while you should have a 10$
invoice instead.
Since the downpayment did not have taxes, the second invoice was
computed as being negative (100$ for the product - 105$ to deduce the
down payment), even though after the 15% tax gets applied on the product
(but not on the downpayment), the invoice is actually positive.
This commits moves the switch from invoice to refund to *after* the move
actually gets created, ensuring taxes are taken into account.
X-original-commit: eefe27b112e2ffd35a834f03a188625a5d6ea5f2
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
0 files changed, 0 insertions, 0 deletions
