[IMP] mail: support custom x_active field
An override of toggle_active was present to ensure that activities would be removed before archiving records; this commit adapts this mechanism to take custom active fields into account, since they are now supported at ORM-level by getting the active field through the `_active_name` model attribute instead of blindly using the `active` hard-coded field that was used until now.. closes odoo/odoo#40109 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This commit is contained in:
@@ -701,7 +701,7 @@ class MailActivityMixin(models.AbstractModel):
|
||||
""" Before archiving the record we should also remove its ongoing
|
||||
activities. Otherwise they stay in the systray and concerning archived
|
||||
records it makes no sense. """
|
||||
record_to_deactivate = self.filtered(lambda rec: rec.active)
|
||||
record_to_deactivate = self.filtered(lambda rec: rec[rec._active_name])
|
||||
if record_to_deactivate:
|
||||
# use a sudo to bypass every access rights; all activities should be removed
|
||||
self.env['mail.activity'].sudo().search([
|
||||
|
||||
Reference in New Issue
Block a user