From 25b5be0e53574965960c1959c31fa3f6527e89d8 Mon Sep 17 00:00:00 2001 From: Augusto Weiss Date: Wed, 26 Jan 2022 13:16:38 -0300 Subject: [PATCH] [FIX] account_journal: remove restriction to archived users --- account_journal_security/models/res_users.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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)