ODOO : Can't quit a line creation/modification mode just after modifying fields.selection
Let's say I'm in a form in which I have an editable tree view for a one2many fields:
<record> [...] <field name='one_to_many_ids'> <tree string="View" editable='bottom'> <field name="name" readonly="True"/> <field name="field_selection"/> <field name="comment_box"/> </tree> </field> [...] </record>
When I create a new record from the UI, or modify one, if the last field I modify is a field.Selection(), when I click in the form view, out of the tree view, the modify mode of the record doesn't close.
However, if I click on another record, it switch, and if I click in a fields.Char()'s
<textarea>, then click outside of the tree_view, still in the form, the modify mode close.
It is usually not a problem, since it save when you click on the "save" button. But here, I make next buttons / fields to fill when all the fields in the preceding one2many are filled.
I also tried to simulate a tab key_press (to switch cursor focus to next field) when in an @api.onchange('field_selection'), but it doesn't work.
I could just ask the users to click in the comment box or press tab before clicking out, but most of them are allergic to informatic (users are mostly retired person), and after testing this approach, it's already way to complicated, my mail is full of "your solution doesn't work" or question repeated over and over. So I'd like to find a solution, to by_pass that problem.
(The comment box is optional and most of the time filled with default text when fields.selection is changed, that's why, even if last columns of the tree_view, users click in field_selection before trying to save).
Did anyone faced that problem and solved it? What solution could I use?