Crash on deeply nested One2Many on_change
In a custom module, I created a wizard with some deeply nested
One2Many. The wizard behave properly using the gtk client, but
I cannot use proteus because there are still some edge cases
which are causing crashes. Namely, the default on the view
triggers nested on_changes, which work perfectly in the gtk
client.
Here is the on_change response that causes the crash :
[
{
'current_options':{
'add':[
(0, {
'parent_name':'Mr. DOE John',
'friends':[
{
'action':'nothing',
'friend':[
{
'foo': 'bar',
}
]
}
]
})
]
}
}
]
And here is the stack :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 1097, in execute
self.form._default_set(view['defaults'])
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 881, in _default_set
self._on_change(sorted(fieldnames))
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 1005, in _on_change
self._set_on_change(change)
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 984, in _set_on_change
self._on_change_set(field, value)
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 950, in _on_change_set
record._set_on_change(vals)
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 984, in _set_on_change
self._on_change_set(field, value)
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 968, in _on_change_set
record = relation(_default=False, **vals)
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 653, in __init__
getattr(self, field_name).extend(value)
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 560, in extend
self.__check(iterable)
File "/home/giovanni/Projets/python_envs/env_a/tryton-workspace/proteus/proteus/__init__.py", line 528, in __check
assert isinstance(record, Model)
AssertionError
Some quick debugging shows that :
record == {'foo': 'bar'}
So it looks like [1] is a little optimistic since some of the keys of
"vals" may be One2Many fields.