[FIX] point_of_sale: take quantity into account when calculating taxes

Fixes a bug introduced in 5a8a0d252c.
Before this, creating an order with two of the same products would
result in a total price to pay which would only include the tax of one
product. This would cause point of sale orders in the backend which
weren't fully paid.
This commit is contained in:
Joren Van Onder
2015-08-27 17:11:07 +02:00
committed by Cedric Snauwaert
parent 65dbf8f117
commit dbb77c5f50
+3 -3
View File
@@ -1275,13 +1275,13 @@ exports.Orderline = Backbone.Model.extend({
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;
return (base_amount * tax.amount / 100) * quantity;
}
if (tax.amount_type === 'percent' && tax.price_include){
return base_amount - (base_amount / (1 + tax.amount / 100));
return (base_amount - (base_amount / (1 + tax.amount / 100))) * quantity;
}
if (tax.amount_type === 'division' && !tax.price_include) {
return base_amount / (1 - tax.amount / 100) - base_amount;
return (base_amount / (1 - tax.amount / 100) - base_amount) * quantity;
}
return false;
},