Skip to content

Commit

Permalink
fix: Zoom lookup. (PanJiaChen#2087)
Browse files Browse the repository at this point in the history
* fix: Zoom lookup.

* fix key column.
  • Loading branch information
EdwinBetanc0urt authored Apr 8, 2024
1 parent ae6424c commit e784ba4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,19 @@
</el-form>
</el-scrollbar>

<span v-for="(zoomItem, index) in fieldAttributes.reference.zoomWindows" :key="index">
<el-button
:key="index"
type="text"
@click="redirect({ window: zoomItem })"
>
<i class="el-icon-zoom-in" />
{{ $t('page.processActivity.zoomIn') }}
{{ zoomItem.name }}
</el-button>
</span>
<template v-if="!isEmptyValue(fieldAttributes.reference) && !isEmptyValue(fieldAttributes.reference.zoom_windows)">
<span v-for="(zoomItem, index) in fieldAttributes.reference.zoom_windows" :key="index">
<el-button
:key="index"
type="text"
@click="redirect({ window: zoomItem })"
>
<i class="el-icon-zoom-in" />
{{ $t('page.processActivity.zoomIn') }}
{{ zoomItem.name }}
</el-button>
</span>
</template>
</el-card>
</template>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
* Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Contributor(s): Edwin Betancourt [email protected] https://github.com/EdwinBetanc0urt
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -55,26 +55,26 @@ export const zoomInOptionItem = {
componentRender: () => import('@/components/ADempiere/FieldDefinition/FieldOptions/EmptyOption'),
executeMethod: ({ containerManager, window, fieldAttributes, value }) => {
const { parentUuid, containerUuid, reference } = fieldAttributes
const { zoomWindows } = reference
const { zoom_windows } = reference

let windowToZoom = window
if (isEmptyValue(windowToZoom)) {
const isSOTrx = isSalesTransaction({
parentUuid,
containerUuid
})
windowToZoom = zoomWindows.find(zoomWindow => {
windowToZoom = zoom_windows.find(zoomWindow => {
// Is Sales Transaction Window or Is Purchase Transaction Window
return zoomWindow.isSalesTransaction === isSOTrx
})
if (isEmptyValue(windowToZoom)) {
windowToZoom = zoomWindows.at(0)
windowToZoom = zoom_windows.at(0)
}
}

let currentValue = value

let columnName = reference.keyColumnName
let columnName = reference.key_column_name
.match(/(\.)(\b\w*)/ig)
.toString()
.replace('.', '')
Expand All @@ -87,7 +87,7 @@ export const zoomInOptionItem = {
}
}

// TODO: Evaluate reference.keyColumnName: AD_Ref_List.Value
// TODO: Evaluate reference.key_column_name: AD_Ref_List.Value
if (fieldAttributes.displayType === LIST.id) {
columnName = 'AD_Reference_ID'
// TODO: Direct query is deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export default defineComponent({

if (isSupportLookup(field.displayType)) {
menuOptions.push(refreshLookup)
if (field.reference && !isEmptyValue(field.reference.zoomWindows)) {
if (field.reference && !isEmptyValue(field.reference.zoom_windows)) {
menuOptions.push(zoomInOptionItem)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/ADempiere/dictionary/window/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export default {
const storedLookupList = rootGetters.getStoredLookupList({
parentUuid,
containerUuid,
contextColumnNames: fieldItem.reference.contextColumnNames,
contextColumnNames: fieldItem.reference.context_column_names,
uuid,
id
})
Expand Down
10 changes: 5 additions & 5 deletions src/utils/ADempiere/dictionary/browser/templateBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export function templateFields(field) {
default_value_to: default_value_to,
isQueryCriteria: is_query_criteria,
elementColumnName: element_column_name,
contextColumnNames: context_column_names,
reference: {
tableName: '',
contextColumnNames: context_column_names
}
contextColumnNames: context_column_names
// reference: {
// tableName: '',
// contextColumnNames: context_column_names
// }
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/utils/ADempiere/dictionary/window/templatesWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export function templateFields(field) {
default_value_to: default_value_to,
isQueryCriteria: is_query_criteria,
elementColumnName: element_column_name,
contextColumnNames: context_column_names,
reference: {
tableName: '',
contextColumnNames: context_column_names
}
contextColumnNames: context_column_names
// reference: {
// tableName: '',
// contextColumnNames: context_column_names
// }
}
}

Expand Down

0 comments on commit e784ba4

Please sign in to comment.