[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 <pim@odoo.com>
This commit is contained in:
niyasraphy
2022-10-28 10:17:54 +02:00
committed by Pierre
parent 03a855d30e
commit 28ff040602
@@ -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())