From e8b965f93c3eeb541aba7b6a435193a9008516ac Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Wed, 16 Mar 2016 15:36:36 +0100 Subject: [PATCH] [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 --- addons/point_of_sale/static/src/js/models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index dd713175f13..b0513e53f8e 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -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;