After some investigations, the problem seems to come from One2ManyListView Widget and can affect any modules I think.
Bug description:
In short words, after that a one2manylist row has been saved and the next one is initialized, one2many list will listen to blurred event and call cancel_editor() too early.
Event sequences:
1. One2ManyListView listenTo "edit:before"
2. ListView:start_edition > ensure_saved() > deferrer resolved > call with_event(edit) > fire "edit:before"
// at this time, the editor.record is not yet set, it will be done in with_event callback...
3. One2ManyListView catch "edit:before" event, then bind _on_form_blur to "blurred" event from editor.form
4. FormView:widgetBlurred fire the "blurred" event
5. One2ManyListView catch "blurred" and _on_form_blur is called
6. One2ManyListView call cancel_edition()
7. ListView:cancel_edition: call editor.cancel()
8. Editor:cancel resolve a deferrer with this.record value (but this.record == null)
9. ListView:cancel_edition: at deferrer resolving, try to get attr.id from the resolve parameter... but attr == editor.record == null
Solution:
One2ManyListView listen to "blurred" only when "editor:after" has been fired, instead of "editor:before".
It works when I test it manually, but I'm not a core expert, please check my solution and see if there's no side effects.
Hi,
After some investigations, the problem seems to come from One2ManyListView Widget and can affect any modules I think.
Bug description:
In short words, after that a one2manylist row has been saved and the next one is initialized, one2many list will listen to blurred event and call cancel_editor() too early.
Event sequences:
1. One2ManyListView listenTo "edit:before"
2. ListView: start_edition > ensure_saved() > deferrer resolved > call with_event(edit) > fire "edit:before"
// at this time, the editor.record is not yet set, it will be done in with_event callback...
3. One2ManyListView catch "edit:before" event, then bind _on_form_blur to "blurred" event from editor.form
4. FormView: widgetBlurred fire the "blurred" event
5. One2ManyListView catch "blurred" and _on_form_blur is called
6. One2ManyListView call cancel_edition()
7. ListView: cancel_ edition: call editor.cancel()
8. Editor:cancel resolve a deferrer with this.record value (but this.record == null)
9. ListView: cancel_ edition: at deferrer resolving, try to get attr.id from the resolve parameter... but attr == editor.record == null
Solution:
One2ManyListView listen to "blurred" only when "editor:after" has been fired, instead of "editor:before".
It works when I test it manually, but I'm not a core expert, please check my solution and see if there's no side effects.
The patch is attached to this post.