[FIX] point_of_sale: correct compute fixed tax negative quantity
Have a product with a fixed amount tax.
Make a "return" of that product in the pos (i.e. negative quantity)
Before this commit:
- The amount of the return was `tax_amount + product_amount` instead of `-1 * positive_total_amount`
- The amount differed from what can be observed in sales
This was because the sign of the quantity was applied twice
After this commit,:
- the amounts of positive and negative amounts are symmetrical
- they match the behavior in sale
The logic is very similar to bb72dea98d
OPW 2026278
closes odoo/odoo#34548
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
@@ -1706,8 +1706,11 @@ exports.Orderline = Backbone.Model.extend({
|
||||
},
|
||||
_compute_all: function(tax, base_amount, quantity) {
|
||||
if (tax.amount_type === 'fixed') {
|
||||
var sign_base_amount = base_amount >= 0 ? 1 : -1;
|
||||
return (Math.abs(tax.amount) * sign_base_amount) * quantity;
|
||||
var sign_base_amount = Math.sign(base_amount) || 1;
|
||||
// Since base amount has been computed with quantity
|
||||
// we take the abs of quantity
|
||||
// Same logic as bb72dea98de4dae8f59e397f232a0636411d37ce
|
||||
return tax.amount * sign_base_amount * Math.abs(quantity);
|
||||
}
|
||||
if ((tax.amount_type === 'percent' && !tax.price_include) || (tax.amount_type === 'division' && tax.price_include)){
|
||||
return base_amount * tax.amount / 100;
|
||||
|
||||
Reference in New Issue
Block a user