diff --git a/account_journal_security/models/res_users.py b/account_journal_security/models/res_users.py index 4c88e759c..6fd3439f8 100644 --- a/account_journal_security/models/res_users.py +++ b/account_journal_security/models/res_users.py @@ -26,3 +26,15 @@ class Users(models.Model): 'Modification Journals', context={'active_test': False}, ) + + # Cuando un usuario es archivado limpiamos los campos modification_journal_ids + # y journal_ids para evitar problemas, ya que en el metodo unset_modification_user_ids(self) + # no se limpiaban los usuarios archivados. + # TODO ver mejora para v15 (posible compute/inverse) + def write(self, vals): + if 'active' in vals and not vals.get('active'): + vals.update({ + 'modification_journal_ids': [(5, 0, 0)], + 'journal_ids': [(5, 0, 0)], + }) + return super().write(vals)