From dc1885e1975ff31d1c32774242a6128cc958491a Mon Sep 17 00:00:00 2001 From: lme-axelor <102581501+lme-axelor@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:58:08 +0100 Subject: [PATCH] fix: manage null case on company criterias --- .../apiProviders/Standard/requests.helper.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/core/src/apiProviders/Standard/requests.helper.ts b/packages/core/src/apiProviders/Standard/requests.helper.ts index 97eea0bf2..d70bc198c 100644 --- a/packages/core/src/apiProviders/Standard/requests.helper.ts +++ b/packages/core/src/apiProviders/Standard/requests.helper.ts @@ -182,9 +182,18 @@ export const getCompanyCriteria = ( companyFieldName: string = 'company', ): Criteria => { return { - fieldName: `${companyFieldName}.id`, - operator: '=', - value: companyId, + operator: 'or', + criteria: [ + { + fieldName: `${companyFieldName}`, + operator: 'isNull', + }, + { + fieldName: `${companyFieldName}.id`, + operator: '=', + value: companyId, + }, + ], }; }; @@ -193,7 +202,7 @@ export const getCompanyDomain = ( companySetFieldName: string = 'companySet', ): Domain => { return { - domain: `:company MEMBER OF self.${companySetFieldName}`, + domain: `self.${companySetFieldName} IS EMPTY OR :company MEMBER OF self.${companySetFieldName}`, domainContext: { company: { id: companyId,