Browse Source

[FIX] autovacuum_message_attachment: The field name cannot be used as it is already present in other models

12.0-mig-module_prototyper_last
Enric Tobella 4 years ago
parent
commit
2c79dbc756
  1. 4
      autovacuum_message_attachment/models/base.py
  2. 2
      autovacuum_message_attachment/models/ir_attachment.py

4
autovacuum_message_attachment/models/base.py

@ -7,7 +7,7 @@ from odoo import fields, models
class Base(models.AbstractModel): class Base(models.AbstractModel):
_inherit = "base" _inherit = "base"
attachment_ids = fields.One2many(
'ir.attachment', 'res_id', string='Attachments',
assigned_attachment_ids = fields.One2many(
'ir.attachment', 'res_id', string='Assigned Attachments',
domain=lambda self: [('res_model', '=', self._name)], auto_join=True domain=lambda self: [('res_model', '=', self._name)], auto_join=True
) )

2
autovacuum_message_attachment/models/ir_attachment.py

@ -8,7 +8,7 @@ from datetime import timedelta
class IrAttachment(models.Model): class IrAttachment(models.Model):
_name = "ir.attachment" _name = "ir.attachment"
_inherit = ["ir.attachment", "autovacuum.mixin"] _inherit = ["ir.attachment", "autovacuum.mixin"]
_autovacuum_relation = 'attachment_ids'
_autovacuum_relation = 'assigned_attachment_ids'
def _get_autovacuum_domain(self, rule): def _get_autovacuum_domain(self, rule):
domain = super()._get_autovacuum_domain(rule) domain = super()._get_autovacuum_domain(rule)

Loading…
Cancel
Save