[FIX] web: click several times on a readonly field in multi_edit
Before this commit, in a multi_edit list view, if you click twice on
a readonly field, the focus is placed on the readonly field.
How to reproduce ?
- Go to a list view in multi_edit="true" mode with a readonly field
- Select a record
- Click on the readonly field of the selected record
- The record goes into edit mode and the focus is placed on the editable
field following the readonly field
- Click a second time on the readonly field of the selected record
Before this commit:
The focus is placed on the readonly field.
After this commit:
The focus is placed on the next editable field.
X-original-commit: aac7e6e4de371dcd01028a3a9ab66eed022c1ef0
Part-of: odoo/odoo#104070
This commit is contained in:
@@ -882,12 +882,8 @@ export class ListRenderer extends Component {
|
||||
record = this.props.list.records[recordIndex] || record;
|
||||
};
|
||||
|
||||
if (this.props.list.model.multiEdit && record.selected) {
|
||||
await recordAfterResequence();
|
||||
await record.switchMode("edit");
|
||||
this.cellToFocus = { column, record };
|
||||
} else if (this.isInlineEditable(record)) {
|
||||
if (record.isInEdition) {
|
||||
if ((this.props.list.model.multiEdit && record.selected) || this.isInlineEditable(record)) {
|
||||
if (record.isInEdition && this.props.list.editedRecord === record) {
|
||||
this.focusCell(column);
|
||||
this.cellToFocus = null;
|
||||
} else {
|
||||
|
||||
@@ -1071,6 +1071,41 @@ QUnit.module("Views", (hooks) => {
|
||||
assert.verifySteps([]);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"multi_edit: clicking on a readonly field switches the focus to the next editable field",
|
||||
async function (assert) {
|
||||
await makeView({
|
||||
type: "list",
|
||||
resModel: "foo",
|
||||
serverData,
|
||||
arch: `
|
||||
<tree multi_edit="1">
|
||||
<field name="int_field" readonly="1"/>
|
||||
<field name="foo" />
|
||||
</tree>`,
|
||||
});
|
||||
|
||||
const firstRow = target.querySelector(".o_data_row");
|
||||
await click(firstRow, ".o_list_record_selector input");
|
||||
|
||||
let intField = firstRow.querySelector("[name='int_field']");
|
||||
intField.focus();
|
||||
await click(intField);
|
||||
assert.strictEqual(
|
||||
document.activeElement.closest(".o_field_widget").getAttribute("name"),
|
||||
"foo"
|
||||
);
|
||||
|
||||
intField = firstRow.querySelector("[name='int_field']");
|
||||
intField.focus();
|
||||
await click(intField);
|
||||
assert.strictEqual(
|
||||
document.activeElement.closest(".o_field_widget").getAttribute("name"),
|
||||
"foo"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("save a record with an required field computed by another", async function (assert) {
|
||||
serverData.models.foo.onchanges = {
|
||||
foo(record) {
|
||||
|
||||
Reference in New Issue
Block a user