Skip to content

Commit

Permalink
fix: Logics on Reports and Process.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Oct 23, 2024
1 parent d339f03 commit 8337d7c
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 21 deletions.
11 changes: 5 additions & 6 deletions src/components/ADempiere/FieldDefinition/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,11 @@ export default {
return 'border: 1px solid #fff;border-radius: 5px;'
},
isOperatior() {
if (this.$route.meta.type === 'report') {
const { is_jasper_report: isJasper } = store.getters.getStoredReport(this.containerUuid)
if (isJasper) {
return false
}
}
const isBrowser = this.$route.meta.type === 'browser'
const isReport = this.$route.meta.type === 'report'
const {
isAdvancedQuery,
isLegacyReport,
is_query_criteria
} = this.field
if (
Expand All @@ -432,6 +428,9 @@ export default {
(
isBrowser &&
is_query_criteria
) || (
isReport &&
!isLegacyReport
)
) return true
return false
Expand Down
8 changes: 4 additions & 4 deletions src/lang/ADempiere/en/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const operators = {
less_equal: 'Less than or equal to "<="',
between: 'Within ">-<"',
not_between: 'Outside "<->"',
null: 'Has no value',
not_null: 'Has a value',
null: 'Has no value "null"',
not_null: 'Has a value "!null"',
in: 'Includes "()"',
not_in: 'Does not include "!()"',
onlyOperators: {
Expand All @@ -46,8 +46,8 @@ const operators = {
less_equal: '<=',
between: '>-<',
not_between: '<->',
null: 'Has no value',
not_null: 'Has a value',
null: 'null',
not_null: '!null',
in: '()',
not_in: '!()'
}
Expand Down
8 changes: 4 additions & 4 deletions src/lang/ADempiere/es/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const operators = {
less_equal: 'Menor o igual que "<="',
between: 'Dentro de ">-<"',
not_between: 'Fuera de "<->"',
null: 'No tiene valor',
not_null: 'Tiene un valor',
null: 'No tiene valor "null"',
not_null: 'Tiene un valor "!null"',
in: 'Incluye "()"',
not_in: 'No incluye "!()"',
onlyOperators: {
Expand All @@ -46,8 +46,8 @@ const operators = {
less_equal: '<=',
between: '>-<',
not_between: '<->',
null: 'No tiene valor',
not_null: 'Tiene un valor',
null: 'null',
not_null: '!null',
in: '()',
not_in: '!()'
}
Expand Down
2 changes: 2 additions & 0 deletions src/store/modules/ADempiere/dictionary/report/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default {
*/
getReportDefinitionFromServer({ dispatch, getters, rootGetters }, {
id,
isLegacyReport = false,
tableName
}) {
return new Promise((resolve, reject) => {
Expand All @@ -82,6 +83,7 @@ export default {
.then(async reportResponse => {
const { uuid } = reportResponse
const { processDefinition: reportDefinition } = generateReport({
isLegacyReport,
processToGenerate: reportResponse
})

Expand Down
1 change: 1 addition & 0 deletions src/store/modules/ADempiere/dictionary/window/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export default {
return Promise.resolve(reportDefinition)
}
return dispatch('getReportDefinitionFromServer', {
isLegacyReport: true,
id: process.id,
tableName: table_name
}).then(reportDefinitionResponse => {
Expand Down
6 changes: 4 additions & 2 deletions src/store/modules/ADempiere/panel/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,15 @@ const actions = {
// TODO: Improve peformance get field with key-value
const storedFieldDependentsList = currentFieldsList.filter(fieldItem => {
if (!isEmptyValue(fieldId)) {
return fieldId === fieldItem.id
return fieldId === fieldItem.internal_id
}
return columnName === fieldItem.column_name ||
columnName === fieldItem.element_name
})

if (isEmptyValue(storedFieldDependentsList)) {
console.warn('field not found in vuex store', {
fieldId,
parentUuid,
parent_column_name: field.column_name,
parentContainerName: field.panelName,
Expand All @@ -535,7 +536,8 @@ const actions = {
field.columnName,
storedFieldDependentsList.map(i => {
return {
id: i.id,
id: i.internal_id,
uuid: i.uuid,
columnName: i.column_name,
name: i.name
}
Expand Down
4 changes: 3 additions & 1 deletion src/utils/ADempiere/dictionary/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function isReadOnlyField({ read_only_logic, isReadOnlyFromLogic }) {
* @returns {object}
*/
export function generateProcess({
isLegacyReport = false,
processToGenerate,
containerUuidAssociated = undefined
}) {
Expand All @@ -121,7 +122,8 @@ export function generateProcess({
}

const additionalAttributes = {
isAdvancedQuery: processToGenerate.is_report,
// isAdvancedQuery: processToGenerate.is_report,
isLegacyReport: isLegacyReport || processToGenerate.is_jasper_report,
containerUuid: processToGenerate.uuid,
parentUuid: containerUuidAssociated,
panelName: processToGenerate.name,
Expand Down
9 changes: 5 additions & 4 deletions src/utils/ADempiere/dictionaryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,9 @@ export function generateField({
let parentFieldsList = []
let parsedDefaultValue = fieldToGenerate.default_value
let parsedDefaultValueTo = fieldToGenerate.default_value_to
let operator
const isNumericField = componentReference.componentPath === 'FieldNumber'
let isTranslatedField = fieldToGenerate.is_translated
let isComparisonField = false // to list operators comparison
let operatorsList = []
if (moreAttributes.isAdvancedQuery) {
// isNumericField = false // disable calculator popover
isTranslatedField = false
Expand Down Expand Up @@ -220,9 +218,11 @@ export function generateField({
elementColumnName: fieldToGenerate.element_name
})
}

// set field operators list
if (moreAttributes.isAdvancedQuery || fieldToGenerate.is_query_criteria) {
operator = OPERATOR_EQUAL.operator
let operator = OPERATOR_EQUAL.operator // by default equal
let operatorsList = []
if (moreAttributes.isAdvancedQuery || fieldToGenerate.is_query_criteria || moreAttributes.isLegacyReport === false) {
isComparisonField = !['FieldBinary', 'FieldButton', 'FieldImage'].includes(componentReference.componentPath)
if (isComparisonField) {
const operatorsField = FIELD_OPERATORS_LIST.find(item => {
Expand Down Expand Up @@ -268,6 +268,7 @@ export function generateField({
isSOTrxDictionary,
referenceTableName,
// displayed attributes
displayTypeName: componentReference.name,
componentPath: componentReference.componentPath,
isSupported: componentReference.isSupported,
size: componentReference.size || DEFAULT_SIZE,
Expand Down

0 comments on commit 8337d7c

Please sign in to comment.