From d5dfeb9dac233229913002ad1291b8fe41786871 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Thu, 18 Feb 2016 10:35:02 +0100 Subject: [PATCH] [IMP] point_of_sale: allow clearing a set fiscal position This was not really possible before. This prepends a dummy undefined fiscal position to the selection list that'll clear the current fiscal position when selected. Also considered was using the "Cancel" button of the selection widget to clear the fiscal position, but that doesn't make a lot of sense from a UI point of view. Pressing a "Cancel" button shouldn't change anything in the underlying model, it should just get rid of the dialog window. opw-668155 --- addons/point_of_sale/static/src/js/screens.js | 8 +++++++- 1 file changed, 7 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 fc7838b2943..aad479fa146 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1937,12 +1937,18 @@ var set_fiscal_position_button = ActionButtonWidget.extend({ }, button_click: function () { var self = this; - var selection_list = _.map(self.pos.fiscal_positions, function (fiscal_position) { + + var no_fiscal_position = [{ + label: _t("None"), + }]; + var fiscal_positions = _.map(self.pos.fiscal_positions, function (fiscal_position) { return { label: fiscal_position.name, item: fiscal_position }; }); + + var selection_list = no_fiscal_position.concat(fiscal_positions); self.gui.show_popup('selection',{ title: _t('Select tax'), list: selection_list,