From 34db511c8d7bd19e70a4e67c7b34761a88d903da Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 5 Sep 2019 07:23:22 +0000 Subject: [PATCH] [FIX] base: compute name for all ir_attachments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, and since the new orm, we cannot open a record that have no res_model and res_id. With new orm, we should return a value for all records. Now, we can open attachement form view without the error: ir.attachement().res_name traceback closes odoo/odoo#36446 Signed-off-by: Jérémy Kersten (jke) --- odoo/addons/base/models/ir_attachment.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ir_attachment.py index 7583a01d631..7aae9cc5910 100644 --- a/odoo/addons/base/models/ir_attachment.py +++ b/odoo/addons/base/models/ir_attachment.py @@ -41,6 +41,8 @@ class IrAttachment(models.Model): if attachment.res_model and attachment.res_id: record = self.env[attachment.res_model].browse(attachment.res_id) attachment.res_name = record.display_name + else: + attachment.res_name = False @api.model def _storage(self):