diff --git a/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot b/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot index 72c37e67ead..d8be396b160 100644 --- a/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot +++ b/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot @@ -823,6 +823,16 @@ msgid "" "The field 'Sanitized Account Number' is required on the Recipient Bank." msgstr "" +#. module: account_edi_ubl_cii +#. odoo-python +#: code:addons/account_edi_ubl_cii/models/account_move_send.py:0 +#, python-format +msgid "" +"The following partners are missing Peppol EAS or Peppol Endpoint field: %s. " +"Please check those in their Accounting tab. Otherwise, the generated files " +"will be incomplete." +msgstr "" + #. module: account_edi_ubl_cii #. odoo-python #: code:addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py:0 @@ -842,6 +852,15 @@ msgid "" "been reverted." msgstr "" +#. module: account_edi_ubl_cii +#. odoo-python +#: code:addons/account_edi_ubl_cii/models/account_move_send.py:0 +#, python-format +msgid "" +"This partner is missing Peppol EAS or Peppol Endpoint field. Please check " +"those in its Accounting tab or the generated file will be incomplete." +msgstr "" + #. module: account_edi_ubl_cii #. odoo-python #: code:addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py:0 diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py index e23124fce5e..ff8de671ef8 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py @@ -270,13 +270,6 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): # EXTENDS account.edi.xml.ubl_21 constraints = super()._export_invoice_constraints(invoice, vals) - constraints.update({ - 'peppol_eas_is_set_supplier': self._check_required_fields(vals['supplier'], 'peppol_eas'), - 'peppol_eas_is_set_customer': self._check_required_fields(vals['customer'], 'peppol_eas'), - 'peppol_endpoint_is_set_supplier': self._check_required_fields(vals['supplier'], 'peppol_endpoint'), - 'peppol_endpoint_is_set_customer': self._check_required_fields(vals['customer'], 'peppol_endpoint'), - }) - constraints.update( self._invoice_constraints_peppol_en16931_ubl(invoice, vals) ) diff --git a/addons/account_edi_ubl_cii/wizard/account_move_send.py b/addons/account_edi_ubl_cii/wizard/account_move_send.py index c04f559b547..3da2f61ea6d 100644 --- a/addons/account_edi_ubl_cii/wizard/account_move_send.py +++ b/addons/account_edi_ubl_cii/wizard/account_move_send.py @@ -19,6 +19,14 @@ class AccountMoveSend(models.TransientModel): enable_ubl_cii_xml = fields.Boolean(compute='_compute_enable_ubl_cii_xml') checkbox_ubl_cii_label = fields.Char(compute='_compute_checkbox_ubl_cii_label') checkbox_ubl_cii_xml = fields.Boolean(compute='_compute_checkbox_ubl_cii_xml', store=True, readonly=False) + ubl_partner_warning = fields.Char( + string="Partner warning", + compute="_compute_ubl_warnings", + ) + show_ubl_company_warning = fields.Boolean( + string="Company warning", + compute="_compute_ubl_warnings", + ) def _get_wizard_values(self): # EXTENDS 'account' @@ -64,6 +72,27 @@ class AccountMoveSend(models.TransientModel): for wizard in self: wizard.checkbox_ubl_cii_xml = wizard.enable_ubl_cii_xml and (wizard.checkbox_ubl_cii_xml or wizard.company_id.invoice_is_ubl_cii) + @api.depends('move_ids') + def _compute_ubl_warnings(self): + for wizard in self: + wizard.show_ubl_company_warning = False + wizard.ubl_partner_warning = False + if not set(wizard.move_ids.partner_id.mapped('ubl_cii_format')) - {False, 'facturx', 'oioubl_201'}: + return + + wizard.show_ubl_company_warning = not (wizard.company_id.partner_id.peppol_eas and wizard.company_id.partner_id.peppol_endpoint) + not_configured_partners = wizard.move_ids.partner_id.commercial_partner_id.filtered( + lambda partner: not (partner.peppol_eas and partner.peppol_endpoint) + ) + if len(not_configured_partners) == 1: + wizard.ubl_partner_warning = _("This partner is missing Peppol EAS or Peppol Endpoint field. " + "Please check those in its Accounting tab or the generated file will be incomplete.") + if len(not_configured_partners) > 1: + names = ', '.join(not_configured_partners[:5].mapped('display_name')) + wizard.ubl_partner_warning = _("The following partners are missing Peppol EAS or Peppol Endpoint field: %s. " + "Please check those in their Accounting tab. " + "Otherwise, the generated files will be incomplete.", names) + # ------------------------------------------------------------------------- # ATTACHMENTS # ------------------------------------------------------------------------- diff --git a/addons/account_edi_ubl_cii/wizard/account_move_send_views.xml b/addons/account_edi_ubl_cii/wizard/account_move_send_views.xml index a5966654249..e28f9759a0a 100644 --- a/addons/account_edi_ubl_cii/wizard/account_move_send_views.xml +++ b/addons/account_edi_ubl_cii/wizard/account_move_send_views.xml @@ -6,6 +6,19 @@ account.move.send + + + + + + + Please fill in Peppol EAS and Peppol Endpoint in your company form to generate a complete file. + + - + +