Debian Codegraph @

addons/l10n_sa_edi_pos/models/pos_config.py

raw symbols SCIP
1 from odoo import models, _
2 from odoo.exceptions import RedirectWarning
3
4
5 class PosConfig(models.Model):
6 _inherit = 'pos.config'
7
8 def open_ui(self):
9 for config in self:
10 if (
11 config.company_id.country_id.code == 'SA'
12 and config.invoice_journal_id
13 and (config.invoice_journal_id.edi_format_ids.filtered(lambda f: f.code == "sa_zatca")
14 and not config.invoice_journal_id._l10n_sa_ready_to_submit_einvoices())
15 ):
16 msg = _("The invoice journal of the point of sale %s must be properly onboarded "
17 "according to ZATCA specifications.\n", config.name)
18 action = {
19 "view_mode": "form",
20 "res_model": "account.journal",
21 "type": "ir.actions.act_window",
22 "res_id": config.invoice_journal_id.id,
23 "views": [[False, "form"]],
24 }
25 raise RedirectWarning(msg, action, _('Go to Journal configuration'))
26 return super().open_ui()