From 95f8693a3d6feabf773e06cd812142c6749154dd Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Mon, 21 Mar 2016 13:46:25 +0100 Subject: [PATCH] [FIX] point_of_sale: correct sign of fixed tax Oversight of e8b965f93c3eeb541aba7b6a435193a9008516ac. 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. --- addons/point_of_sale/static/src/js/models.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index fa8079def79..f787f495d1f 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -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;