[FIX] web: x2manylist: fix record opening when edit=false editable="bottom"
Steps to reproduce: - Install appointments - Log in as Marc Demo - Go to Calendar/Online appointments - Click on a record in the availability x2many fields Current behaviour: It opens the record in a form modal. Expected behaviour It should not open the record since #110838 because the x2manyfield is in `editable="bottom"`. closes odoo/odoo#118225 X-original-commit: d4399a87f1ca59389d7e58754b67c3fc816cb25a Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -216,7 +216,8 @@ export class X2ManyField extends Component {
|
||||
return true;
|
||||
});
|
||||
|
||||
const editable = archInfo.editable || this.props.editable;
|
||||
const editable =
|
||||
(this.archInfo.activeActions.edit && archInfo.editable) || this.props.editable;
|
||||
props.activeActions = this.activeActions;
|
||||
props.archInfo = { ...archInfo, columns };
|
||||
props.cycleOnTab = false;
|
||||
|
||||
@@ -213,7 +213,7 @@ export class ListArchParser extends XMLParser {
|
||||
treeAttr.activeActions = activeActions;
|
||||
|
||||
treeAttr.className = xmlDoc.getAttribute("class") || null;
|
||||
treeAttr.editable = activeActions.edit ? xmlDoc.getAttribute("editable") : false;
|
||||
treeAttr.editable = xmlDoc.getAttribute("editable");
|
||||
treeAttr.multiEdit = activeActions.edit
|
||||
? archParseBoolean(node.getAttribute("multi_edit") || "")
|
||||
: false;
|
||||
|
||||
@@ -34,9 +34,10 @@ export class ListController extends Component {
|
||||
this.rootRef = useRef("root");
|
||||
|
||||
this.archInfo = this.props.archInfo;
|
||||
this.editable = this.props.editable ? this.archInfo.editable : false;
|
||||
this.multiEdit = this.archInfo.multiEdit;
|
||||
this.activeActions = this.archInfo.activeActions;
|
||||
this.editable =
|
||||
this.activeActions.edit && this.props.editable ? this.archInfo.editable : false;
|
||||
this.multiEdit = this.archInfo.multiEdit;
|
||||
const fields = { ...this.props.fields };
|
||||
const { rootState } = this.props.state || {};
|
||||
const { defaultGroupBy, rawExpand } = this.archInfo;
|
||||
|
||||
@@ -2956,6 +2956,31 @@ QUnit.module("Fields", (hooks) => {
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"one2many list: cannot open record in editable=bottom and edit=false list",
|
||||
async function (assert) {
|
||||
serverData.models.partner.records[0].p = [2];
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="p">
|
||||
<tree editable="bottom" edit="false">
|
||||
<field name="display_name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</form>`,
|
||||
resId: 1,
|
||||
});
|
||||
|
||||
assert.containsOnce(target, ".o_data_cell[name='display_name']");
|
||||
await click(target, ".o_data_cell[name='display_name']");
|
||||
assert.containsNone(target, ".modal-dialog");
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("one2many list: conditional create/delete actions", async function (assert) {
|
||||
serverData.models.partner.records[0].p = [2, 4];
|
||||
await makeView({
|
||||
|
||||
Reference in New Issue
Block a user