[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
This commit is contained in:
Joren Van Onder
2016-02-18 15:48:16 +01:00
parent a7c1f37197
commit d9891a5bbe
2 changed files with 26 additions and 1 deletions
@@ -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({
+1 -1
View File
@@ -102,7 +102,7 @@
<t t-name="SetFiscalPositionButton">
<div class='control-button'>
<i class='fa fa-book' /> Tax
<i class='fa fa-book' /> <t t-esc='widget.get_current_fiscal_position_name()'/>
</div>
</t>