From a1ee8f4d94808a5770cfaaff8361deb0e774db83 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Mon, 22 Apr 2024 15:57:14 +0200 Subject: [PATCH] [IMP] pos_restaurant: make the internal note available for shop Allow pos users to have the "internal note" button available even in non-restaurant shops. The changes also make sure that the button is disabled when there is no selected orderline. closes odoo/odoo#162863 Task-id: 3878947 Signed-off-by: Vlad Stroia (vlst) --- addons/pos_restaurant/models/pos_config.py | 1 - addons/pos_restaurant/models/res_config_settings.py | 4 +--- .../orderline_note_button/orderline_note_button.xml | 2 +- addons/pos_restaurant/views/res_config_settings_views.xml | 8 +++++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/pos_restaurant/models/pos_config.py b/addons/pos_restaurant/models/pos_config.py index dfbeea42df5..c2c58a57ab1 100644 --- a/addons/pos_restaurant/models/pos_config.py +++ b/addons/pos_restaurant/models/pos_config.py @@ -69,7 +69,6 @@ class PosConfig(models.Model): vals['iface_splitbill'] = True if not is_restaurant or not vals.get('iface_tipproduct', False): vals['set_tip_after_payment'] = False - vals["iface_orderline_notes"] = is_restaurant pos_configs = super().create(vals_list) for config in pos_configs: if config.module_pos_restaurant: diff --git a/addons/pos_restaurant/models/res_config_settings.py b/addons/pos_restaurant/models/res_config_settings.py index 13948d0e0b6..ee105269d76 100644 --- a/addons/pos_restaurant/models/res_config_settings.py +++ b/addons/pos_restaurant/models/res_config_settings.py @@ -7,7 +7,7 @@ class ResConfigSettings(models.TransientModel): _inherit = 'res.config.settings' pos_floor_ids = fields.Many2many(related='pos_config_id.floor_ids', readonly=False) - pos_iface_orderline_notes = fields.Boolean(compute='_compute_pos_module_pos_restaurant', store=True, readonly=False) + pos_iface_orderline_notes = fields.Boolean(related='pos_config_id.iface_orderline_notes', readonly=False) pos_iface_printbill = fields.Boolean(compute='_compute_pos_module_pos_restaurant', store=True, readonly=False) pos_iface_splitbill = fields.Boolean(compute='_compute_pos_module_pos_restaurant', store=True, readonly=False) pos_set_tip_after_payment = fields.Boolean(compute='_compute_pos_set_tip_after_payment', store=True, readonly=False) @@ -18,13 +18,11 @@ class ResConfigSettings(models.TransientModel): for res_config in self: if not res_config.pos_module_pos_restaurant: res_config.update({ - 'pos_iface_orderline_notes': False, 'pos_iface_printbill': False, 'pos_iface_splitbill': False, }) else: res_config.update({ - 'pos_iface_orderline_notes': res_config.pos_config_id.iface_orderline_notes, 'pos_iface_printbill': res_config.pos_config_id.iface_printbill, 'pos_iface_splitbill': res_config.pos_config_id.iface_splitbill, }) diff --git a/addons/pos_restaurant/static/src/app/control_buttons/orderline_note_button/orderline_note_button.xml b/addons/pos_restaurant/static/src/app/control_buttons/orderline_note_button/orderline_note_button.xml index 86470bc5d08..72a834d7c36 100644 --- a/addons/pos_restaurant/static/src/app/control_buttons/orderline_note_button/orderline_note_button.xml +++ b/addons/pos_restaurant/static/src/app/control_buttons/orderline_note_button/orderline_note_button.xml @@ -2,7 +2,7 @@ -