mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-22 04:22:08 +02:00
19.0 vanilla
This commit is contained in:
parent
ba20ce7443
commit
768b70e05e
2357 changed files with 1057103 additions and 712486 deletions
|
|
@ -0,0 +1,16 @@
|
|||
from odoo import _, api, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class MailTemplate(models.Model):
|
||||
_inherit = 'mail.template'
|
||||
|
||||
@api.ondelete(at_uninstall=False)
|
||||
def _unlink_except_master_mail_template(self):
|
||||
master_xmlids = {
|
||||
"account.email_template_edi_invoice",
|
||||
"account.email_template_edi_credit_note",
|
||||
}
|
||||
removed_xml_ids = set(self.get_external_id().values())
|
||||
if removed_xml_ids.intersection(master_xmlids):
|
||||
raise UserError(_("You cannot delete this mail template, it is used in the invoice sending flow."))
|
||||
Loading…
Add table
Add a link
Reference in a new issue