From 03a20ff6ccaa6d6c376a7b002b1c2d437a7f3899 Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Tue, 25 Sep 2018 11:23:05 +0200 Subject: [PATCH] [IMP] point_of_sale: pricelist discount on ticket cleanup of prices printed on tickets -> x --- addons/point_of_sale/static/src/js/models.js | 25 ++++++++++++++ addons/point_of_sale/static/src/xml/pos.xml | 36 ++++++++++++++++---- 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index ee891ff1b66..e66a752b310 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1557,6 +1557,9 @@ exports.Orderline = Backbone.Model.extend({ discount: this.get_discount(), product_name: this.get_product().display_name, product_name_wrapped: this.generate_wrapped_product_name(), + price_lst: this.get_lst_price(), + display_discount_policy: this.display_discount_policy(), + price_display_one: this.get_display_price_one(), price_display : this.get_display_price(), price_with_tax : this.get_price_with_tax(), price_without_tax: this.get_price_without_tax(), @@ -1621,6 +1624,28 @@ exports.Orderline = Backbone.Model.extend({ var rounding = this.pos.currency.rounding; return round_pr(this.get_unit_price() * this.get_quantity() * (1 - this.get_discount()/100), rounding); }, + get_display_price_one: function(){ + var rounding = this.pos.currency.rounding; + var price_unit = this.get_unit_price() * (1.0 - (this.get_discount() / 100.0)); + if (this.pos.config.iface_tax_included !== 'total') { + return round_pr(price_unit, rounding); + } else { + var product = this.get_product(); + var taxes_ids = product.taxes_id; + var taxes = this.pos.taxes; + var product_taxes = []; + + _(taxes_ids).each(function(el){ + product_taxes.push(_.detect(taxes, function(t){ + return t.id === el; + })); + }); + + var all_taxes = this.compute_all(product_taxes, price_unit, 1, this.pos.currency.rounding); + + return round_pr(all_taxes.total_included * (1 - this.get_discount()/100), rounding); + } + }, get_display_price: function(){ if (this.pos.config.iface_tax_included === 'total') { return this.get_price_with_tax(); diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index e391d21b78e..dacb937f1e3 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -775,19 +775,44 @@
- + - + + + + + + + -> + + + + + + + + + + + + + + + - Discount: % + + + Discount: % + + @@ -799,7 +824,7 @@ x - + @@ -1486,8 +1511,7 @@
- - -> + ->