From d9891a5bbe8243eb4ed4fcbd4bf758d0e64a0b6e Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Thu, 18 Feb 2016 10:23:15 +0100 Subject: [PATCH] [IMP] point_of_sale: display the current fiscal position name on button Before this, seeing the current set fiscal position on an order was not really possible. opw-668155 --- addons/point_of_sale/static/src/js/screens.js | 25 +++++++++++++++++++ addons/point_of_sale/static/src/xml/pos.xml | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 1c918388c2a..fc7838b2943 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1924,6 +1924,17 @@ gui.define_screen({name:'payment', widget: PaymentScreenWidget}); var set_fiscal_position_button = ActionButtonWidget.extend({ template: 'SetFiscalPositionButton', + init: function (parent, options) { + this._super(parent, options); + + this.pos.get('orders').bind('add remove change', function () { + this.renderElement(); + }, this); + + this.pos.bind('change:selectedOrder', function () { + this.renderElement(); + }, this); + }, button_click: function () { var self = this; var selection_list = _.map(self.pos.fiscal_positions, function (fiscal_position) { @@ -1942,6 +1953,20 @@ var set_fiscal_position_button = ActionButtonWidget.extend({ } }); }, + get_current_fiscal_position_name: function () { + var name = _t('Tax'); + var order = this.pos.get_order(); + + if (order) { + var fiscal_position = order.fiscal_position; + + if (fiscal_position) { + name = fiscal_position.display_name; + } + } + + return name; + } }); define_action_button({ diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 7d2aa8dd192..0a052f241ee 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -102,7 +102,7 @@
- Tax +