diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 458ceee1978..ad146334b33 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -398,7 +398,7 @@ class account_invoice(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/mail_message.py b/addons/mail/mail_message.py index 01a50579dd3..c4618d49833 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -806,7 +806,7 @@ class mail_message(osv.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]) def create(self, cr, uid, values, context=None): 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