From 22c8db7fcb5bd85e1e78d52466bfcb126e499c2f Mon Sep 17 00:00:00 2001 From: Frederic van der Essen Date: Wed, 5 Nov 2014 17:08:53 +0100 Subject: [PATCH] [IMP] point_of_sale: allow to force the display of prices tax included, even if the taxes are not included.\nThis is useful when you want to work without taxes for sales.orders and still sell with TVA Included. There is one limitation tough: the prices in the product list show the price without taxes. Conflicts: addons/point_of_sale/static/src/js/models.js addons/point_of_sale/static/src/xml/pos.xml --- addons/point_of_sale/point_of_sale.py | 1 + addons/point_of_sale/point_of_sale_view.xml | 1 + addons/point_of_sale/static/src/js/models.js | 18 +++++++++++++++++- addons/point_of_sale/static/src/xml/pos.xml | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index dc773f1b3f6..d9faeb8d85b 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -77,6 +77,7 @@ class pos_config(osv.osv): 'iface_fullscreen': fields.boolean('Fullscreen', help='Display the Point of Sale in full screen mode'), 'iface_print_auto': fields.boolean('Automatic Receipt Printing', help='The receipt will automatically be printed at the end of each order'), 'iface_precompute_cash': fields.boolean('Prefill Cash Payment', help='The payment input will behave similarily to bank payment input, and will be prefilled with the exact due amount'), + 'iface_tax_included': fields.boolean('Include Taxes in Prices', help='The displayed prices will always include all taxes, even if the taxes have been setup differently'), 'receipt_header': fields.text('Receipt Header',help="A short text that will be inserted as a header in the printed receipt"), 'receipt_footer': fields.text('Receipt Footer',help="A short text that will be inserted as a footer in the printed receipt"), 'proxy_ip': fields.char('IP Address', help='The hostname or ip address of the hardware proxy, Will be autodetected if left empty', size=45), diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 3d77c9aa725..b46255fd8f4 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -691,6 +691,7 @@ + diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 3b3505b1d17..adb82371701 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -878,7 +878,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal return { quantity: this.get_quantity(), unit_name: this.get_unit().name, - price: this.get_unit_price(), + price: this.get_unit_display_price(), discount: this.get_discount(), product_name: this.get_product().display_name, price_display : this.get_display_price(), @@ -897,12 +897,28 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal get_unit_price: function(){ return this.price; }, + get_unit_display_price: function(){ + if (this.pos.config.iface_tax_included) { + var quantity = this.quantity; + this.quantity = 1.0; + var price = this.get_all_prices().priceWithTax; + this.quantity = quantity; + return price; + } else { + return this.get_unit_price(); + } + }, get_base_price: function(){ var rounding = this.pos.currency.rounding; return round_pr(round_pr(this.get_unit_price() * this.get_quantity(),rounding) * (1- this.get_discount()/100.0),rounding); }, get_display_price: function(){ return this.get_base_price(); + if (this.pos.config.iface_tax_included) { + return this.get_all_prices().priceWithTax; + } else { + return this.get_base_price(); + } }, get_price_without_tax: function(){ return this.get_all_prices().priceWithoutTax; diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 99e37f33151..65d1a303176 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -1066,7 +1066,7 @@ at - + /