diff --git a/addons/pos_restaurant/static/src/js/floors.js b/addons/pos_restaurant/static/src/js/floors.js index 75a4438193c..b2bc167a258 100644 --- a/addons/pos_restaurant/static/src/js/floors.js +++ b/addons/pos_restaurant/static/src/js/floors.js @@ -769,11 +769,29 @@ models.PosModel = models.PosModel.extend({ return _super_posmodel.initialize.call(this,session,attributes); }, - // changes the current table. + transfer_order_to_different_table: function () { + this.order_to_transfer_to_different_table = this.get_order(); + + // go to 'floors' screen, this will set the order to null and + // eventually this will cause the gui to go to its + // default_screen, which is 'floors' + this.set_table(null); + }, + + // changes the current table. set_table: function(table) { if (!table) { // no table ? go back to the floor plan, see ScreenSelector - this.set_order(null); - } else { // table ? load the associated orders ... + this.set_order(null); + } else if (this.order_to_transfer_to_different_table) { + this.order_to_transfer_to_different_table.table = table; + this.order_to_transfer_to_different_table = null; + + // set this table + this.set_table(table); + + // trigger a change so the table change gets stored in localStorage + this.get_order().trigger('change', this.get_order()); + } else { this.table = table; var orders = this.get_order_list(); if (orders.length) { @@ -909,4 +927,19 @@ screens.define_action_button({ }, }); +var TransferOrderButton = screens.ActionButtonWidget.extend({ + template: 'TransferOrderButton', + button_click: function() { + this.pos.transfer_order_to_different_table(); + }, +}); + +screens.define_action_button({ + 'name': 'transfer', + 'widget': TransferOrderButton, + 'condition': function(){ + return this.pos.config.iface_floorplan; + }, +}); + }); diff --git a/addons/pos_restaurant/static/src/xml/floors.xml b/addons/pos_restaurant/static/src/xml/floors.xml index e96173d42dd..58c82f355b2 100644 --- a/addons/pos_restaurant/static/src/xml/floors.xml +++ b/addons/pos_restaurant/static/src/xml/floors.xml @@ -26,6 +26,12 @@ + +
+ Transfer +
+
+