Skip to content
Snippets Groups Projects
Commit 8a812612 authored by Thanh Dodeur's avatar Thanh Dodeur
Browse files

[IMP] base: removes storing of res_name from ir.attachment


This commit removes the store property of `res_name` from `ir.attachment`
as it doesn't need to be stored and could contain outdated information
if the record name was changed after the computation.

Task: #1943295

closes odoo/odoo#34930

Signed-off-by: default avatarMartin Geubelle (mge) <mge@openerp.com>
parent 5dac8f8f
No related branches found
No related tags found
No related merge requests found
...@@ -143,7 +143,6 @@ ...@@ -143,7 +143,6 @@
<field name="type"/> <field name="type"/>
<field name="create_date"/> <field name="create_date"/>
<field name="name"/> <field name="name"/>
<field name="res_name"/>
<templates> <templates>
<t t-name="kanban-box"> <t t-name="kanban-box">
<div class="oe_kanban_global_area o_kanban_attachment"> <div class="oe_kanban_global_area o_kanban_attachment">
......
...@@ -36,7 +36,6 @@ class IrAttachment(models.Model): ...@@ -36,7 +36,6 @@ class IrAttachment(models.Model):
_description = 'Attachment' _description = 'Attachment'
_order = 'id desc' _order = 'id desc'
@api.depends('res_model', 'res_id')
def _compute_res_name(self): def _compute_res_name(self):
for attachment in self: for attachment in self:
if attachment.res_model and attachment.res_id: if attachment.res_model and attachment.res_id:
...@@ -276,7 +275,7 @@ class IrAttachment(models.Model): ...@@ -276,7 +275,7 @@ class IrAttachment(models.Model):
name = fields.Char('Name', required=True) name = fields.Char('Name', required=True)
description = fields.Text('Description') description = fields.Text('Description')
res_name = fields.Char('Resource Name', compute='_compute_res_name', store=True) res_name = fields.Char('Resource Name', compute='_compute_res_name')
res_model = fields.Char('Resource Model', readonly=True, help="The database object this attachment will be attached to.") res_model = fields.Char('Resource Model', readonly=True, help="The database object this attachment will be attached to.")
res_field = fields.Char('Resource Field', readonly=True) res_field = fields.Char('Resource Field', readonly=True)
res_id = fields.Integer('Resource ID', readonly=True, help="The record id this is attached to.") res_id = fields.Integer('Resource ID', readonly=True, help="The record id this is attached to.")
...@@ -372,7 +371,7 @@ class IrAttachment(models.Model): ...@@ -372,7 +371,7 @@ class IrAttachment(models.Model):
raise AccessError(_("Sorry, you are not allowed to access this document.")) raise AccessError(_("Sorry, you are not allowed to access this document."))
def _read_group_allowed_fields(self): def _read_group_allowed_fields(self):
return ['type', 'company_id', 'res_id', 'create_date', 'create_uid', 'res_name', 'name', 'mimetype', 'id', 'url', 'res_field', 'res_model'] return ['type', 'company_id', 'res_id', 'create_date', 'create_uid', 'name', 'mimetype', 'id', 'url', 'res_field', 'res_model']
@api.model @api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True): def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment