diff options
Diffstat (limited to 'addons/pos_restaurant/static/src/js/ChromeWidgets/BackToFloorButton.js')
| -rw-r--r-- | addons/pos_restaurant/static/src/js/ChromeWidgets/BackToFloorButton.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/addons/pos_restaurant/static/src/js/ChromeWidgets/BackToFloorButton.js b/addons/pos_restaurant/static/src/js/ChromeWidgets/BackToFloorButton.js index dbd21c5fd32..c2b623500c8 100644 --- a/addons/pos_restaurant/static/src/js/ChromeWidgets/BackToFloorButton.js +++ b/addons/pos_restaurant/static/src/js/ChromeWidgets/BackToFloorButton.js @@ -1,22 +1,28 @@ -odoo.define('pos_restaurant.BackToFloorButton', function(require) { +odoo.define('pos_restaurant.BackToFloorButton', function (require) { 'use strict'; const PosComponent = require('point_of_sale.PosComponent'); - const { useListener } = require('web.custom_hooks'); const Registries = require('point_of_sale.Registries'); + const { posbus } = require('point_of_sale.utils'); class BackToFloorButton extends PosComponent { - constructor() { - super(...arguments); - useListener('click', this._backToFloorScreen); + mounted() { + posbus.on('table-set', this, this.render); + } + willUnmount() { + posbus.on('table-set', this); } get table() { - return this.props.table; + return (this.env.pos && this.env.pos.table) || null; } get floor() { - return this.props.table.floor; + const table = this.table; + return table ? table.floor : null; + } + get hasTable() { + return this.table !== null; } - async _backToFloorScreen() { + backToFloorScreen() { this.showScreen('FloorScreen', { floor: this.floor }); } } |
