Skip to content

Commit

Permalink
fix: Set correct operator comparison. (PanJiaChen#2625)
Browse files Browse the repository at this point in the history
* fix: Set correct operator comparison.

* fix notification without report associated.
  • Loading branch information
EdwinBetanc0urt authored Sep 12, 2024
1 parent 07426f5 commit 68b6b9f
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default defineComponent({
const currentOperatorValue = computed(() => {
return props.metadataField.operator
})

const operatorList = computed(() => {
const isComparisonField = !['FieldBinary', 'FieldButton', 'FieldImage'].includes(props.metadataField.componentPath)
if (isComparisonField) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ADempiere/FieldDefinition/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import store from '@/store'

// Components and Mixins
import FieldOptions from '@/components/ADempiere/FieldDefinition/FieldOptions/index.vue'
import ComparisonOperator from '@/components/ADempiere/FieldDefinition/FieldOptions/ComparisonOperator'
import ComparisonOperator from '@/components/ADempiere/FieldDefinition/FieldOptions/ComparisonOperator.vue'

// Constants
import { UUID } from '@/utils/ADempiere/constants/systemColumns'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
>
<el-dropdown-item
:key="index"
:command="process.id + '|' + process.values.UUID"
:command="process.internal_id + '|' + process.values.UUID"
>
{{ process.values.DisplayColumn }}
</el-dropdown-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@

<script>
import { defineComponent, computed } from '@vue/composition-api'

import language from '@/lang'
import store from '@/store'
// Utils

// Utils and Helper Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { showNotification } from '@/utils/ADempiere/notification.js'

Expand Down Expand Up @@ -106,29 +108,37 @@ export default defineComponent({
})

const getReportDefinition = computed(() => {
if (
isEmptyValue(process) ||
isEmptyValue(process.uuid)
) return []
if (isEmptyValue(process) || isEmptyValue(process.uuid)) {
return []
}
return store.getters.getStoredReport(process.uuid)
})

const printFormats = computed(() => {
if (
isEmptyValue(process)
) return []
return store.getters.getPrintFormatsList(process.id)
if (isEmptyValue(process)) {
return []
}
return store.getters.getPrintFormatsList(process.internal_id)
})

/**
* Methods
*/
function printProcess() {
if (isEmptyValue(process)) return
if (isEmptyValue(process)) {
showNotification({
title: language.t('notifications.whithoutAssociatedReport'),
message: process.name,
summary: process.description,
type: 'info'
})
return
}

store.dispatch('runReport', {
containerUuid: process.uuid,
recordId: recordId.value,
reportId: process.id,
reportId: process.internal_id,
tableName: table_name
})
}
Expand All @@ -143,17 +153,21 @@ export default defineComponent({
store.dispatch('generateReportViwer', {
containerUuid: process.uuid,
reportUuid: process.uuid,
reportId: process.internal_id,
printFormatId: command.id,
reportId: process.id,
tableName: command.table_name,
filters: `[{\"name\":\"${command.table_name}_ID\",\"operator\":\"equal\",\"values\":${recordId.value}}]`,
isView: false
})
}

function loadProcessData() {
if (isEmptyValue(process) || isEmptyValue(is_document)) return
if (!isEmptyValue(getReportDefinition.value)) return
if (isEmptyValue(process) || isEmptyValue(is_document)) {
return
}
if (!isEmptyValue(getReportDefinition.value)) {
return
}
const { id } = process
store.dispatch('getReportDefinitionFromServer', {
id,
Expand Down
3 changes: 2 additions & 1 deletion src/lang/ADempiere/en/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
const process = {
clearParameters: {
title: 'Clear Parameters',
description: 'Clears the values by setting the default values'
description: 'Clears the values by setting the default values',
whithoutAssociatedReport: 'Without Associated Report'
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/lang/ADempiere/es/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
const report = {
clearParameters: {
title: 'Limpiar Parámetros',
description: 'Limpia los valores estableciendo los valores por defecto'
description: 'Limpia los valores estableciendo los valores por defecto',
whithoutAssociatedReport: 'Sin Reporte Asociado'
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/utils/ADempiere/dictionary/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ export function getReferenceByMenu(menu) {

switch (menu.action) {
case 'F':
reference_id = menu.workflow.id
reference_id = menu.workflow.internal_id
reference_uuid = menu.workflow.uuid
break
case 'P':
case 'R':
reference_id = menu.process.id
reference_id = menu.process.internal_id
reference_uuid = menu.process.uuid
break
case 'S':
reference_id = menu.browser.id
reference_id = menu.browser.internal_id
reference_uuid = menu.browser.uuid
break
case 'W':
reference_id = menu.window.id
reference_id = menu.window.internal_id
reference_uuid = menu.window.uuid
break
case 'X':
reference_id = menu.form.id
reference_id = menu.form.internal_id
reference_uuid = menu.form.uuid
break
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ADempiere/dictionaryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ export function generateField({
let parsedDefaultValue = fieldToGenerate.default_value
let parsedDefaultValueTo = fieldToGenerate.default_value_to
let operator
let isNumericField = componentReference.componentPath === 'FieldNumber'
const isNumericField = componentReference.componentPath === 'FieldNumber'
let isTranslatedField = fieldToGenerate.is_translated
let isComparisonField = false // to list operators comparison
let operatorsList = []
if (moreAttributes.isAdvancedQuery) {
isNumericField = false
// isNumericField = false // disable calculator popover
isTranslatedField = false
parsedDefaultValue = undefined
parsedDefaultValueTo = undefined
Expand Down

0 comments on commit 68b6b9f

Please sign in to comment.