[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>
This commit is contained in:
mgh-odoo
2019-06-20 09:24:37 +00:00
committed by Gert Pellin
parent 684f14d8f4
commit 1f62977d5d
2 changed files with 12 additions and 1 deletions
@@ -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,
};
+6 -1
View File
@@ -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>