Skip to content

Commit 632341c

Browse files
committed
Merge PR OCA#3559 into 19.0
Signed-off-by etobella
2 parents b51a408 + 5ff1dbf commit 632341c

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

web_m2x_options/static/src/components/form.esm.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,25 @@ patch(many2OneField.Many2OneField.prototype, {
146146
});
147147

148148
patch(Many2One.prototype, {
149+
// Enforce the create/create_edit/open system parameters here, on the shared
150+
// Many2One component, rather than only in the many2one field's extractProps.
151+
// Specialized widgets (e.g. sol_product_many2one on sale/purchase order lines)
152+
// define their own extractProps and never call m2o_options_props, so a
153+
// field-level override does not reach them. They all render this component,
154+
// so gating it here covers every many2one.
155+
get activeActions() {
156+
const actions = super.activeActions;
157+
if (!evaluateSystemParameterDefaultTrue("create_edit")) {
158+
actions.createEdit = false;
159+
}
160+
return actions;
161+
},
162+
get hasLinkButton() {
163+
if (!evaluateSystemParameterDefaultTrue("open")) {
164+
return false;
165+
}
166+
return super.hasLinkButton;
167+
},
149168
get many2XAutocompleteProps() {
150169
let search_limit = 0;
151170
if (this.props.searchLimit) {
@@ -164,6 +183,9 @@ patch(Many2One.prototype, {
164183
ret_props.fieldColor = field_color;
165184
ret_props.fieldColorOptions = field_color_options;
166185
}
186+
if (!evaluateSystemParameterDefaultTrue("create")) {
187+
ret_props.quickCreate = null;
188+
}
167189
return ret_props;
168190
},
169191
});

0 commit comments

Comments
 (0)