8000 [18.0][FIX]: web_widget_x2many_2d_matrix: limit options values to x2m… by jcadhoc · Pull Request #3200 · OCA/web · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[18.0][FIX]: web_widget_x2many_2d_matrix: limit options values to x2m… #3200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component, onWillUpdateProps} from "@odoo/owl";
import {registry} from "@web/core/registry";
import {Domain} from "@web/core/domain";
import {evaluateExpr} from "@web/core/py_js/py";
import {registry} from "@web/core/registry";
const fieldRegistry = registry.category("fields");

export class X2Many2DMatrixRenderer extends Component {
Expand Down Expand Up @@ -142,6 +142,11 @@ export class X2Many2DMatrixRenderer extends Component {
);
}

// More options can be included in the future, here are only added the ones tested initially.
_canOptions() {
return ["many2one"].includes(this.list.fields[this.matrixFields.value].type);
}

getValueFieldProps(column, row) {
const x = this.columns.findIndex((c) => c.value === column);
const y = this.rows.findIndex((r) => r.value === row);
Expand All @@ -166,6 +171,13 @@ export class X2Many2DMatrixRenderer extends Component {
canWrite: this.props.canWrite,
canQuickCreate: this.props.canQuickCreate,
canCreateEdit: this.props.canCreateEdit,
...(this._canOptions() && {
canCreate: this.props.canCreate,
canOpen: this.props.canOpen,
canWrite: this.props.canWrite,
canQuickCreate: this.props.canQuickCreate,
canCreateEdit: this.props.canCreateEdit,
}),
};
const domain = record.fields[this.matrixFields.value].domain;
if ((Array.isArray(value) || typeof value === "string") && domain.length) {
Expand Down
0