From 7cb80dd246a92d9452868d16f49c71a8c791669b Mon Sep 17 00:00:00 2001 From: Leonel Matos Date: Fri, 22 Nov 2019 19:02:28 -0400 Subject: [PATCH] Bugfix references filtering (#175) * add feature for go to print format setup window from report viewer * change translation * add feature for field condition in table records * add evaluate logic for display field definition * bugfix references filter * some changes --- .../ADempiere/ContextMenu/contextMenuMixin.js | 11 +++++++- .../ADempiere/ContextMenu/items.vue | 2 -- src/components/ADempiere/Panel/index.vue | 7 +++-- src/store/modules/ADempiere/windowControl.js | 27 +++++++++++++++++-- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/components/ADempiere/ContextMenu/contextMenuMixin.js b/src/components/ADempiere/ContextMenu/contextMenuMixin.js index 17456bd1..23439e70 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuMixin.js +++ b/src/components/ADempiere/ContextMenu/contextMenuMixin.js @@ -373,7 +373,16 @@ export const contextMixin = { this.$store.dispatch('getWindowByUuid', { routes: this.permissionRoutes, windowUuid: action.windowUuid }) if (action.windowUuid && action.recordUuid) { var windowRoute = this.$store.getters.getWindowRoute(action.windowUuid) - this.$router.push({ name: windowRoute.name, query: { action: action.type, referenceUuid: action.uuid, tabParent: 0 }}) + this.$router.push({ + name: windowRoute.name, + query: { + action: action.type, + referenceUuid: action.uuid, + recordUuid: action.recordUuid, + windowUuid: this.parentUuid, + tabParent: 0 + } + }) } } }, diff --git a/src/components/ADempiere/ContextMenu/items.vue b/src/components/ADempiere/ContextMenu/items.vue index 0d7be85d..5845180d 100644 --- a/src/components/ADempiere/ContextMenu/items.vue +++ b/src/components/ADempiere/ContextMenu/items.vue @@ -11,11 +11,9 @@ - {{ child.meta.title }} - diff --git a/src/components/ADempiere/Panel/index.vue b/src/components/ADempiere/Panel/index.vue index 71514fd8..75c0a964 100644 --- a/src/components/ADempiere/Panel/index.vue +++ b/src/components/ADempiere/Panel/index.vue @@ -392,10 +392,11 @@ export default { }) if (route.query.action && route.query.action === 'reference') { + const referenceInfo = this.$store.getters.getReferencesInfo(route.query.windowUuid, route.query.recordUuid, route.query.referenceUuid) parameters.isLoadAllRecords = false parameters.isReference = true - parameters.referenceUuid = route.query.referenceUuid - parameters.referenceWhereClause = route.query.whereClause + parameters.referenceUuid = referenceInfo.uuid + parameters.referenceWhereClause = referenceInfo.whereClause } else if (route.query.action && route.query.action === 'create-new') { parameters.isNewRecord = true } else if (route.query.action && route.query.action !== 'create-new' && route.query.action !== 'reference' && route.query.action !== 'advancedQuery') { @@ -458,6 +459,8 @@ export default { parentUuid: this.parentUuid, containerUuid: this.containerUuid, isLoadAllRecords: parameters.isLoadAllRecords, + isReference: parameters.isReference, + referenceWhereClause: parameters.referenceWhereClause, columnName: parameters.columnName, value: parameters.value }) diff --git a/src/store/modules/ADempiere/windowControl.js b/src/store/modules/ADempiere/windowControl.js index 694fc312..abb06185 100644 --- a/src/store/modules/ADempiere/windowControl.js +++ b/src/store/modules/ADempiere/windowControl.js @@ -516,7 +516,17 @@ const windowControl = { * @param {boolean} isLoadAllRecords, if main panel is updated with new response data */ getDataListTab({ dispatch, rootGetters }, parameters) { - const { parentUuid, containerUuid, recordUuid, isRefreshPanel = false, isLoadAllRecords = false, columnName, value } = parameters + const { + parentUuid, + containerUuid, + recordUuid, + isRefreshPanel = false, + isLoadAllRecords = false, + isReference = false, + referenceWhereClause = '', + columnName, + value + } = parameters const tab = rootGetters.getTab(parentUuid, containerUuid) var parsedQuery = tab.query @@ -536,6 +546,15 @@ const windowControl = { value: tab.whereClause }, true) } + + if (isReference) { + if (!isEmptyValue(parsedWhereClause)) { + parsedWhereClause += ' AND ' + referenceWhereClause + } else { + parsedWhereClause += referenceWhereClause + } + } + var conditions = [] if (tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) { conditions.push({ @@ -640,7 +659,11 @@ const windowControl = { return state.inCreate.find(item => item.containerUuid === containerUuid) }, getReferencesList: (state) => (windowUuid, recordUuid) => { - return (state.references.find(item => item.windowUuid === windowUuid && item.recordUuid === recordUuid)) + return state.references.find(item => item.windowUuid === windowUuid && item.recordUuid === recordUuid) + }, + getReferencesInfo: (state, getters) => (windowUuid, recordUuid, referenceUuid) => { + const references = getters.getReferencesList(windowUuid, recordUuid) + return references.referencesList.find(item => item.uuid === referenceUuid) }, getWindowRoute: (state) => (windowUuid) => { if (state.windowRoute && state.windowRoute.meta && state.windowRoute.meta.uuid === windowUuid) {