From d85c34e4534a3e4e9a558e4071232b1a0a690130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vanhaudenard?= Date: Fri, 29 Oct 2021 13:29:25 +0000 Subject: [PATCH] [FIX] l10n_fr_pos_cert: Ensure country set on company before opening POS Before this fix, if the country is not set on the company the loading of the session may stall at some point. A check is added and will prevent to start a session if the country is not set. opw-2557989 closes odoo/odoo#79276 X-original-commit: 8c325324c0f476d77fec79cba0570b025114fc88 Signed-off-by: Joseph Caburnay (jcb) --- addons/l10n_fr_pos_cert/models/pos.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/l10n_fr_pos_cert/models/pos.py b/addons/l10n_fr_pos_cert/models/pos.py index 1a59cf756a4..e860f57a2aa 100644 --- a/addons/l10n_fr_pos_cert/models/pos.py +++ b/addons/l10n_fr_pos_cert/models/pos.py @@ -14,9 +14,12 @@ class pos_config(models.Model): _inherit = 'pos.config' def open_ui(self): - for config in self.filtered(lambda c: c.company_id._is_accounting_unalterable()): - if config.current_session_id: - config.current_session_id._check_session_timing() + for config in self: + if not config.company_id.country_id: + raise UserError(_("You have to set a country in your company setting.")) + if config.company_id._is_accounting_unalterable(): + if config.current_session_id: + config.current_session_id._check_session_timing() return super(pos_config, self).open_ui()