diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 83b3faa19d8..e3bceea033a 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -393,7 +393,7 @@ class AccountInvoice(models.Model): default_model='account.invoice', default_res_id=self.id, default_use_template=bool(template), - default_template_id=template.id, + default_template_id=template and template.id or False, default_composition_mode='comment', mark_invoice_as_sent=True, ) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index aa10557d583..d155ef11065 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -857,7 +857,7 @@ class Message(models.Model): def _invalidate_documents(self): """ Invalidate the cache of the documents followed by ``self``. """ for record in self: - if record.res_id: + if record.model and record.res_id: self.env[record.model].invalidate_cache(ids=[record.res_id]) @api.model diff --git a/doc/cla/individual/sergiocorato.md b/doc/cla/individual/sergiocorato.md new file mode 100644 index 00000000000..5ac26c3f7ea --- /dev/null +++ b/doc/cla/individual/sergiocorato.md @@ -0,0 +1,9 @@ +Italy, 2017-01-24 + +I hereby agree to the terms of the Odoo Individual Contributor License Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this declaration. + +Signed, + +Sergio Corato sergiocorato@gmail.com https://github.com/sergiocorato