From 1460ed08c9c177364d50d27a4f774a96d2a194fd Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 21 Feb 2018 09:51:36 +0100 Subject: [PATCH] [FIX] mail: tracking of custom field - Create a custom field Field Type: monetary Tracking: Always - Install any module A crash occurs in `_instanciate_attrs` since `attrs` is `None`. In some special cases, the instanciation of the attrs of a field is delayed at the very end of the setup. For example, in case of a Many2one for which the comodel is not yet loaded. Therefore the override of the method should take this case into account. Closes #22922 opw-815185 --- addons/mail/models/ir_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/ir_model.py b/addons/mail/models/ir_model.py index 3a312cfe843..04529610f0e 100644 --- a/addons/mail/models/ir_model.py +++ b/addons/mail/models/ir_model.py @@ -74,6 +74,6 @@ class IrModelField(models.Model): def _instanciate_attrs(self, field_data): attrs = super(IrModelField, self)._instanciate_attrs(field_data) - if field_data.get('track_visibility'): + if attrs and field_data.get('track_visibility'): attrs['track_visibility'] = field_data['track_visibility'] return attrs