diff --git a/packages/apps/project/src/api/project-api.js b/packages/apps/project/src/api/project-api.js index 8129bc4343..0d8eaa90af 100644 --- a/packages/apps/project/src/api/project-api.js +++ b/packages/apps/project/src/api/project-api.js @@ -96,6 +96,7 @@ export async function searchProject({ differentiateBusinessProjects = true, statusList, userId, + companyId, }) { return createStandardSearch({ model: 'com.axelor.apps.project.db.Project', @@ -110,6 +111,7 @@ export async function searchProject({ sortKey: 'project_project', page, provider: 'model', + companyId, }); } @@ -132,7 +134,7 @@ export async function fetchProjectById({projectId}) { }); } -export async function searchSubProject({page = 0, projectId}) { +export async function searchSubProject({page = 0, projectId, companyId}) { return createStandardSearch({ model: 'com.axelor.apps.project.db.Project', criteria: createSubProjectCriteria({projectId}), @@ -140,6 +142,7 @@ export async function searchSubProject({page = 0, projectId}) { sortKey: 'project_project', page, provider: 'model', + companyId, }); } diff --git a/packages/apps/project/src/api/project-task-api.js b/packages/apps/project/src/api/project-task-api.js index 92aeca25e4..7d3db5a958 100644 --- a/packages/apps/project/src/api/project-task-api.js +++ b/packages/apps/project/src/api/project-task-api.js @@ -241,8 +241,10 @@ export async function getTag({activeCompany}) { sortKey: 'project_Tag', page: 0, numberElementsByPage: null, + companyId: activeCompany?.id, + isCompanyM2M: true, domain: - '(self.concernedModelSet IS EMPTY OR :metaModel member of self.concernedModelSet) AND (self.companySet IS EMPTY OR :activeCompany member of self.companySet)', + '(self.concernedModelSet IS EMPTY OR :metaModel member of self.concernedModelSet)', domainContext: { metaModel: {id: res?.data?.data?.[0]?.id}, activeCompany: {id: activeCompany?.id}, diff --git a/packages/apps/project/src/components/pages/SubProjectView/SubProjectView.tsx b/packages/apps/project/src/components/pages/SubProjectView/SubProjectView.tsx index e3c7e4397f..10f11fabb2 100644 --- a/packages/apps/project/src/components/pages/SubProjectView/SubProjectView.tsx +++ b/packages/apps/project/src/components/pages/SubProjectView/SubProjectView.tsx @@ -46,12 +46,14 @@ const SubProjectView = () => { isListEndSubProject, subProjectList, } = useSelector((state: any) => state.project_project); + const {user} = useSelector(state => state.user); const sliceFunctionData = useMemo( () => ({ projectId: project.id, + companyId: user.activeCompany?.id, }), - [project.id], + [project.id, user.activeCompany?.id], ); useEffect(() => { diff --git a/packages/apps/project/src/components/templates/ProjectListView/ProjectListView.tsx b/packages/apps/project/src/components/templates/ProjectListView/ProjectListView.tsx index c7adf0a3e7..4f383d1ed6 100644 --- a/packages/apps/project/src/components/templates/ProjectListView/ProjectListView.tsx +++ b/packages/apps/project/src/components/templates/ProjectListView/ProjectListView.tsx @@ -45,6 +45,7 @@ const ProjectListView = ({ const navigation = useNavigation(); const {getCustomSelectionItems} = useTypeHelpers(); + const {user} = useSelector(state => state.user); const {userId} = useSelector((state: any) => state.auth); const {loading, moreLoading, isListEnd, projectList, projectStatusList} = useSelector((state: any) => state.project_project); @@ -62,8 +63,15 @@ const ProjectListView = ({ isBusinessProject: businessProject, statusList: selectedStatus, userId: isAssignedToMe ? userId : null, + companyId: user.activeCompany?.id, }), - [businessProject, isAssignedToMe, selectedStatus, userId], + [ + businessProject, + isAssignedToMe, + selectedStatus, + user.activeCompany?.id, + userId, + ], ); useEffect(() => { diff --git a/packages/apps/project/src/components/templates/ProjectSearchBar/ProjectSearchBar.tsx b/packages/apps/project/src/components/templates/ProjectSearchBar/ProjectSearchBar.tsx index 32efd02f24..389fcd18da 100644 --- a/packages/apps/project/src/components/templates/ProjectSearchBar/ProjectSearchBar.tsx +++ b/packages/apps/project/src/components/templates/ProjectSearchBar/ProjectSearchBar.tsx @@ -50,6 +50,7 @@ const ProjectSearchBarAux = ({ const I18n = useTranslator(); const dispatch = useDispatch(); + const {user} = useSelector(state => state.user); const {projectList, loading, moreLoading, isListEnd} = useSelector( (state: any) => state.project_project, ); @@ -61,10 +62,11 @@ const ProjectSearchBarAux = ({ page, searchValue, differentiateBusinessProjects, + companyId: user.activeCompany?.id, }), ); }, - [differentiateBusinessProjects, dispatch], + [differentiateBusinessProjects, dispatch, user.activeCompany?.id], ); return (