From 28ff04060247caf8de70f84f45bbe52071c1160e Mon Sep 17 00:00:00 2001 From: niyasraphy Date: Thu, 20 Oct 2022 18:30:18 +0000 Subject: [PATCH] [FIX] point_of_sale: redirect to correct settings Since the settings in POS have been moved to the general settings, we have two way to access those general settings. First throug the general settings, second when you open the shortlist of settings editable by every pos manager and follow the link to the general ones. In the second case, when we arrive into the general settings, the settings displayed are not always the one of the POS config you come from, because by default it only show the settings of the latest pos config editted. So we are now checking if we are comming from a pos config to display the correct one. closes odoo/odoo#104391 X-original-commit: b0df10c1e497f65b891f7141055e7f339d11b4b1 Signed-off-by: Masereel Pierre --- addons/point_of_sale/models/res_config_settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/point_of_sale/models/res_config_settings.py b/addons/point_of_sale/models/res_config_settings.py index ff162c92b38..c26b1048a30 100644 --- a/addons/point_of_sale/models/res_config_settings.py +++ b/addons/point_of_sale/models/res_config_settings.py @@ -24,6 +24,9 @@ class ResConfigSettings(models.TransientModel): def _default_pos_config(self): # Default to the last modified pos.config. + active_model = self.env.context.get('active_model', '') + if active_model == 'pos.config': + return self.env.context.get('active_id') return self.env['pos.config'].search([('company_id', '=', self.env.company.id)], order='write_date desc', limit=1) pos_config_id = fields.Many2one('pos.config', string="Point of Sale", default=lambda self: self._default_pos_config())