When a one2many field uses an integer field as inverse, the onchange method on
the second model may receive a dictionary for the value of the integer field.
This is because the client expects that field to be a many2one.
type = 'integer'
def convert_to_cache(self, value, record, validate=True):
+ if isinstance(value, dict):
+ # special case, when an integer field is used as inverse for a one2many
+ return value.get('id', False)
return int(value or 0)
def convert_to_read(self, value, use_name_get=True):