[FIX] point_of_sale: correctly copy the base_amount sign of fixed tax
All the POS has to do is copy what accounting does. In the case of a fixed tax we should do (from account.tax._compute_amount): return math.copysign(self.amount, base_amount) * quantity where copysign(x, y) returns x with the sign of y. When base_amount is 0 it's positive, not negative. This also correctly handles a base_amount of -0, although it's something that we shouldn't encounter in the POS. opw-672118
This commit is contained in:
@@ -1322,7 +1322,7 @@ 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;
|
||||
return base_amount > 0 ? ret : ret * -1;
|
||||
}
|
||||
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