[FIX] web: x2m not editable inline with save & new

Before this commit, in a form view with an x2many in non-editable list mode,
creating a record by clicking on "Save&New" allows it to be edited inline
despite the list view not being editable. The purpose of this commit is
to prevent this from happening.

How to reproduce:
- Go to a form view with an x2many field in non-editable list mode
- Add a record
- Edit the new record
- Click on Save&New
- Edit the new record

Before this commit:
    The new record is in edition in the list view

After this commit
    The new record is not in edition in the list view

Part-of: odoo/odoo#141269
This commit is contained in:
FrancoisGe
2023-11-13 14:38:34 +00:00
parent ad7be43149
commit f833e7e052
2 changed files with 2 additions and 1 deletions
@@ -587,6 +587,7 @@ export class X2ManyFieldDialog extends Component {
if (await this.record.checkValidity({ displayNotification: true })) {
await this.props.save(this.record);
if (saveAndNew) {
await this.record.switchMode("readonly");
this.record = await this.props.addNew();
}
} else {
@@ -9846,7 +9846,7 @@ QUnit.module("Fields", (hooks) => {
<form>
<field name="p">
<tree>
<field name="display_name"/>
<field name="display_name" widget="char" class="do_not_remove_widget_char"/>
</tree>
<form>
<field name="display_name"/>