account_edi_format.py 868 B

123456789101112131415161718
  1. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  2. from odoo import _, fields, models
  3. class AccountEdiFormat(models.Model):
  4. _inherit = 'account.edi.format'
  5. def _l10n_it_edi_check_ordinary_invoice_configuration(self, invoice):
  6. errors = super()._l10n_it_edi_check_ordinary_invoice_configuration(invoice)
  7. if invoice._is_commercial_partner_pa():
  8. if not invoice.l10n_it_origin_document_type:
  9. errors.append(_("This invoice targets the Public Administration, please fill out"
  10. " Origin Document Type field in the Electronic Invoicing tab."))
  11. if invoice.l10n_it_origin_document_date and invoice.l10n_it_origin_document_date > fields.Date.today():
  12. errors.append(_("The Origin Document Date cannot be in the future."))
  13. return errors