[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
This commit is contained in:
Nicolas Martinelli
2018-02-21 13:27:02 +01:00
committed by Nicolas Martinelli
parent dd184b26ac
commit 1460ed08c9
+1 -1
View File
@@ -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