summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormgh-odoo <mgh@odoo.com>2019-05-29 05:30:22 +0000
committerGert Pellin <gpe@odoo.com>2019-06-20 09:24:37 +0000
commit1f62977d5dcfbd172459f13d8e43bbf43c7bcbda (patch)
tree2a1930539f8a6fb8e94e768546ba18f4007728e3
parent684f14d8f4c9bcad1e4be29a99003d78e53ae1f0 (diff)
[FIX] point_of_sale: wrong price on receipt fix
Before this commit, if a user select option 'tax-Included Price' in pricing from pos.config and sale product with a discount, it is first displaying price without tax instead of the price including tax. Task-2002464 Closes #33733 closes odoo/odoo#34259 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
-rw-r--r--addons/point_of_sale/static/src/js/models.js6
-rw-r--r--addons/point_of_sale/static/src/xml/pos.xml7
2 files changed, 12 insertions, 1 deletions
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 1fe17d449a5..054776e658c 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -1573,6 +1573,7 @@ exports.Orderline = Backbone.Model.extend({
price_display : this.get_display_price(),
price_with_tax : this.get_price_with_tax(),
price_without_tax: this.get_price_without_tax(),
+ price_with_tax_before_discount: this.get_price_with_tax_before_discount(),
tax: this.get_tax(),
product_description: this.get_product().description,
product_description_sale: this.get_product().description_sale,
@@ -1669,6 +1670,9 @@ exports.Orderline = Backbone.Model.extend({
get_price_with_tax: function(){
return this.get_all_prices().priceWithTax;
},
+ get_price_with_tax_before_discount: function () {
+ return this.get_all_prices().priceWithTaxBeforeDiscount;
+ },
get_tax: function(){
return this.get_all_prices().tax;
},
@@ -1822,6 +1826,7 @@ exports.Orderline = Backbone.Model.extend({
});
var all_taxes = this.compute_all(product_taxes, price_unit, this.get_quantity(), this.pos.currency.rounding);
+ var all_taxes_before_discount = this.compute_all(product_taxes, this.get_unit_price(), this.get_quantity(), this.pos.currency.rounding);
_(all_taxes.taxes).each(function(tax) {
taxtotal += tax.amount;
taxdetail[tax.id] = tax.amount;
@@ -1831,6 +1836,7 @@ exports.Orderline = Backbone.Model.extend({
"priceWithTax": all_taxes.total_included,
"priceWithoutTax": all_taxes.total_excluded,
"priceSumTaxVoid": all_taxes.total_void,
+ "priceWithTaxBeforeDiscount": all_taxes_before_discount.total_included,
"tax": taxtotal,
"taxDetails": taxdetail,
};
diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index 17c47b154ad..0ac71c21530 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -812,7 +812,12 @@
<line indent='1'>
<left>
<value t-att-value-decimals='pos.dp["Product Price"]'>
- <t t-esc="line.price_lst" />
+ <t t-if="pos.config.iface_tax_included === 'total'">
+ <t t-esc="line.price_with_tax_before_discount" />
+ </t>
+ <t t-else="">
+ <t t-esc="line.price_lst" />
+ </t>
</value>
</left>
</line>