[FIX] pos_restaurant: allow refund with no table selected

Before, when trying to do a refund from the floor plan, it was triggering an error.
Now we check if a table was set on the order. If the order was set on the order, then we make the refund on the same table.
If no table was set, then we take the first table available in the list.

X-original-commit: 53e2f382a18a7eda6e15934d36dfbe350b6a2e32
Part-of: odoo/odoo#97157
This commit is contained in:
rhe-odoo
2022-07-30 14:51:51 +02:00
committed by Pierre Masereel
parent 57512721b3
commit 97517e8f01
@@ -148,6 +148,12 @@ odoo.define('pos_restaurant.TicketScreen', function (require) {
}
return result;
}
async _onDoRefund() {
if(this.env.pos.config.iface_floorplan) {
this.env.pos.set_table(this.getSelectedSyncedOrder().table ? this.getSelectedSyncedOrder().table : Object.values(this.env.pos.tables_by_id)[0]);
}
super._onDoRefund();
}
};
Registries.Component.extend(TicketScreen, PosResTicketScreen);