Skip to content

Commit d6c8b1d

Browse files
committed
[FIX] simplify conditions
1 parent 644eaeb commit d6c8b1d

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

spp_custom_fields_ui/static/src/js/custom_fields_ui_reload.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,10 @@ patch(FormController.prototype, {
99
* custom fields (ir.model.fields records with target_type).
1010
*/
1111
async saveButtonClicked(params = {}) {
12-
// Check if we're editing through the custom fields UI specifically:
13-
// 1. Model is ir.model.fields
14-
// 2. Has target_type (grp or indv)
15-
// 3. Model is res.partner (the target of custom fields)
16-
// 4. State is manual (not base fields)
17-
// 5. Context has default_model = 'res.partner' (from the custom fields UI actions)
18-
const isCustomFieldUI =
19-
this.props.resModel === "ir.model.fields" &&
20-
this.model.root.data.target_type &&
21-
this.model.root.data.model === "res.partner" &&
22-
this.model.root.data.state === "manual" &&
23-
this.props.context?.default_model === "res.partner";
12+
// Check if we're editing ir.model.fields with target_type (custom fields UI)
13+
const isCustomField = this.props.resModel === "ir.model.fields" && this.model.root.data.target_type;
2414

25-
if (!isCustomFieldUI) {
15+
if (!isCustomField) {
2616
return super.saveButtonClicked(params);
2717
}
2818

0 commit comments

Comments
 (0)