[FIX] point_of_sale: correct sign of fixed tax
Oversight of e8b965f93c. Although the
previous commit gave the correct behaviour for a negative fixed tax with
a base_amount of 0, it was still incorrect for positive fixed taxes with
a base_amount of 0.
This rewrites the code to more closely resemble the relevant code of
account.tax._compute_amount() solving the above mentioned issue.
This commit is contained in:
@@ -1321,8 +1321,8 @@ exports.Orderline = Backbone.Model.extend({
|
||||
},
|
||||
_compute_all: function(tax, base_amount, quantity) {
|
||||
if (tax.amount_type === 'fixed') {
|
||||
var ret = tax.amount * quantity;
|
||||
return base_amount > 0 ? ret : ret * -1;
|
||||
var sign_base_amount = base_amount >= 0 ? 1 : -1;
|
||||
return (Math.abs(tax.amount) * sign_base_amount) * 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