Skip to content

Commit

Permalink
fix: Dunning Run Entry with print button. (PanJiaChen#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Oct 7, 2024
1 parent 090302a commit e5e9fe4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
-->

<template>
<span>
<span v-if="!isEmptyValue(process) && process.is_report">
<el-dropdown
v-if="(!isEmptyValue(process) && is_document && !isEmptyValue(printFormats)) || currentTableName === 'PA_Report'"
v-if="!isEmptyValue(printFormatsList) || currentTableName === FINANCIAL_REPORT_TABLE_NAME"
split-button
size="small"
trigger="click"
Expand All @@ -42,16 +42,17 @@

<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="(process, index) in printFormats"
v-for="(process, index) in printFormatsList"
:key="index"
:command="process"
>
{{ $t(process.name) }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>

<el-button
v-if="!isEmptyValue(process) && is_document && isEmptyValue(printFormats)"
v-if="isEmptyValue(printFormatsList)"
plain
type="info"
size="small"
Expand Down Expand Up @@ -80,6 +81,11 @@ import { defineComponent, computed, ref } from '@vue/composition-api'
import language from '@/lang'
import store from '@/store'

// Constants
import {
FINANCIAL_REPORT_TABLE_NAME
} from '@/utils/ADempiere/dictionary/report/financialReport.ts'

// Utils and Helper Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { showNotification } from '@/utils/ADempiere/notification.js'
Expand Down Expand Up @@ -107,12 +113,12 @@ export default defineComponent({
* Ref
*/
const isLoading = ref(false)

/**
* Const
*/
const containerUuid = props.tabAttributes.uuid
const { process } = props.tabAttributes
const { is_document } = props.tabAttributes.table

/**
* Computed
Expand All @@ -137,7 +143,7 @@ export default defineComponent({
return store.getters.getStoredReport(process.uuid)
})

const printFormats = computed(() => {
const printFormatsList = computed(() => {
if (isEmptyValue(process)) {
return []
}
Expand Down Expand Up @@ -188,7 +194,7 @@ export default defineComponent({
}

function loadProcessData() {
if (isEmptyValue(process) || isEmptyValue(is_document)) {
if (isEmptyValue(process)) {
return
}
if (!isEmptyValue(getReportDefinition.value)) {
Expand All @@ -208,10 +214,10 @@ export default defineComponent({
isLoading,
// Const
process,
is_document,
FINANCIAL_REPORT_TABLE_NAME,
// Computed
recordId,
printFormats,
printFormatsList,
currentTableName,
getReportDefinition,
// Methods
Expand Down
22 changes: 2 additions & 20 deletions src/store/modules/ADempiere/dictionary/window/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ import store from '@/store'

// API Request Methods
import { requestWindowMetadata } from '@/api/ADempiere/dictionary/window.ts'
import { listPrintFormatsTableRequest } from '@/api/ADempiere/reportManagement/printFormat.ts'

// Constants
import { CLIENT, DOCUMENT_ACTION, DOCUMENT_STATUS } from '@/utils/ADempiere/constants/systemColumns'
import { DISPLAY_COLUMN_PREFIX, IS_ADVANCED_QUERY } from '@/utils/ADempiere/dictionaryUtils'
import { ROW_ATTRIBUTES } from '@/utils/ADempiere/tableUtils'
import { ACTION_None } from '@/utils/ADempiere/dictionary/workflow'
import { FINANCIAL_REPORT_CODE } from '@/utils/ADempiere/dictionary/report/financialReport.ts'

// Utils and Helper Methods
import { FINANCIAL_REPORT_CODE } from '@/utils/ADempiere/constants/report.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { convertArrayKeyValueToObject } from '@/utils/ADempiere/formatValue/iterableFormat'
import {
Expand Down Expand Up @@ -974,23 +973,6 @@ export default {
parentUuid: parentUuid + IS_ADVANCED_QUERY,
tabAdvanceQuery
})
},
setPrintFormatWindow({ commit }, {
tableName,
reportId
}) {
return new Promise(resolve => {
listPrintFormatsTableRequest({
tableName
})
.then(response => {
const { print_formats } = response
commit('setPrintFormatsList', {
reportId,
printFormatList: print_formats
})
resolve(print_formats)
})
})
}

}
6 changes: 3 additions & 3 deletions src/store/modules/ADempiere/reportManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ const reportManager = {
}
listPrintFormatsTableRequest({ tableName })
.then(async printFormatResponse => {
const printFormatList = await Promise.all(
const printFormatsList = await Promise.all(
printFormatResponse.print_formats.map(async printFormatItem => {
await Promise.allSettled([
dispatch('getReportViewsFromServer', {
Expand All @@ -394,10 +394,10 @@ const reportManager = {

commit('setPrintFormatsList', {
reportId,
printFormatList
printFormatsList: printFormatsList
})

resolve(printFormatList)
resolve(printFormatsList)
})
.catch(error => {
console.warn(`Error getting print formats: ${error.message}. Code: ${error.code}.`)
Expand Down
2 changes: 0 additions & 2 deletions src/utils/ADempiere/constants/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import language from '@/lang'

const today = new Date()

export const FINANCIAL_REPORT_CODE = 'FinReport'

export const REPORT_VIEWER_NAME = 'Report Viewer'

export const staticReportRoutes = [
Expand Down
21 changes: 21 additions & 0 deletions src/utils/ADempiere/dictionary/report/financialReport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
* Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

export const FINANCIAL_REPORT_CODE = 'FinReport'

export const FINANCIAL_REPORT_TABLE_NAME = 'PA_Report'

0 comments on commit e5e9fe4

Please sign in to comment.