[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) <jcb@odoo.com>
This commit is contained in:
Jérôme Vanhaudenard
2021-11-02 14:17:47 +00:00
parent 706d2f01ae
commit d85c34e453
+6 -3
View File
@@ -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()