[IMP] pos_restaurant: implement order transferring to different table
Provides a 'Transfer' button in the Point of Sale that allows a user to select a table to which the current order will be transferred.
This commit is contained in:
@@ -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;
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="TransferOrderButton">
|
||||
<div class='control-button'>
|
||||
<i class='fa fa-arrow-right' /> Transfer
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="TableWidget">
|
||||
<t t-if='!widget.selected'>
|
||||
<div class='table' t-att-style='widget.table_style_str()'>
|
||||
|
||||
Reference in New Issue
Block a user