diff --git a/changelogs/unreleased/88244.json b/changelogs/unreleased/88244.json new file mode 100644 index 0000000000..1b13ac5f87 --- /dev/null +++ b/changelogs/unreleased/88244.json @@ -0,0 +1,5 @@ +{ + "title": "Opportunity form: make contact and partner fields mutually dependent", + "type": "fix", + "packages": "crm" +} diff --git a/packages/apps/crm/src/models/forms.ts b/packages/apps/crm/src/models/forms.ts index 07ff0afe4c..adb841dba0 100644 --- a/packages/apps/crm/src/models/forms.ts +++ b/packages/apps/crm/src/models/forms.ts @@ -302,6 +302,11 @@ export const crm_formsRegister: FormConfigs = { widget: 'custom', customComponent: ClientProspectSearchBar, required: true, + dependsOn: { + contact: ({newValue}) => { + return newValue?.mainPartner; + }, + }, }, contact: { titleKey: 'Crm_Contact', @@ -311,7 +316,7 @@ export const crm_formsRegister: FormConfigs = { options: { showTitle: true, }, - required: true, + requiredIf: ({objectState}) => objectState.partner == null, }, expectedCloseDate: { titleKey: 'Crm_Opportunity_ExpectedCloseDate',