Lack of data in _init_values result in an inconsistent behaviour in the client
This one is a bit tricky to explain (the patch might be an easier way to grasp the issue than this description).
We have three models: A contains a o2m to B which contains a m2m to C.
A field of A has an on_change setting in the m2m of B some new value.
The result of the call to the on_change is something like {'b': {'update': {'c': {'add': values}}}.
In the case B has never been opened in A's form this is the correct value. But if B has already been opened then its C m2m will have been fetch and the on_change call will result in only addition of records (while there might be substraction of some).
The way I found to fix this is that we should fill _init_values as soon as we have the chance to do so. That way when computing the changed_values it will send the right modifications to the client.
Unfortunately in order to apply those modifications the C value must be loaded on the client side before applying the on_change value received (hence the impact on tryton and sao).
(Moreover it's a bit tricky to find the right place where to define the test for this behaviour as it's both a mix of ModelStorage and ModelView).
Files
Download | Creator | Timestamp | Type |
---|---|---|---|
m2m_changed.tgz | @nicoe | 2020-10-15 21:59:49.400000 UTC | application/x-gtar-compressed |