fix: refs #8581 update field references for supplier withholding in InvoiceInDescriptorMenu

This commit is contained in:
Jorge Penadés 2025-02-25 15:26:52 +01:00
parent dfb5cfb513
commit 43e0134d41
1 changed files with 169 additions and 153 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, toRefs, reactive } from 'vue'; import { ref, computed, toRefs, reactive, onBeforeMount } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
@ -111,10 +111,9 @@ async function cloneInvoice() {
} }
const isAgricultural = () => { const isAgricultural = () => {
if (!config.value) return false;
return ( return (
invoiceIn.value?.supplier?.sageWithholdingFk === invoiceIn.value?.supplier?.sageWithholdingFk ==
config?.value[0]?.sageFarmerWithholdingFk config.value?.sageFarmerWithholdingFk
); );
}; };
function showPdfInvoice() { function showPdfInvoice() {
@ -153,9 +152,17 @@ const createInvoiceInCorrection = async () => {
); );
push({ path: `/invoice-in/${correctingId}/summary` }); push({ path: `/invoice-in/${correctingId}/summary` });
}; };
</script>
onBeforeMount(async () => {
config.value = (
await axios.get('invoiceinConfigs/findOne', {
params: { fields: ['sageFarmerWithholdingFk'] },
})
).data;
});
</script>
<template> <template>
<template v-if="config">
<FetchData <FetchData
url="InvoiceCorrectionTypes" url="InvoiceCorrectionTypes"
@on-fetch="(data) => (invoiceCorrectionTypes = data)" @on-fetch="(data) => (invoiceCorrectionTypes = data)"
@ -172,12 +179,6 @@ const createInvoiceInCorrection = async () => {
@on-fetch="(data) => (siiTypeInvoiceIns = data)" @on-fetch="(data) => (siiTypeInvoiceIns = data)"
auto-load auto-load
/> />
<FetchData
url="InvoiceInConfigs"
:where="{ fields: ['sageFarmerWithholdingFk'] }"
auto-load
@on-fetch="(data) => (config = data)"
/>
<InvoiceInToBook> <InvoiceInToBook>
<template #content="{ book }"> <template #content="{ book }">
<QItem <QItem
@ -208,7 +209,12 @@ const createInvoiceInCorrection = async () => {
> >
<QItemSection>{{ t('invoiceIn.descriptorMenu.deleteInvoice') }}</QItemSection> <QItemSection>{{ t('invoiceIn.descriptorMenu.deleteInvoice') }}</QItemSection>
</QItem> </QItem>
<QItem v-if="canEditProp('clone')" v-ripple clickable @click="triggerMenu('clone')"> <QItem
v-if="canEditProp('clone')"
v-ripple
clickable
@click="triggerMenu('clone')"
>
<QItemSection>{{ t('invoiceIn.descriptorMenu.cloneInvoice') }}</QItemSection> <QItemSection>{{ t('invoiceIn.descriptorMenu.cloneInvoice') }}</QItemSection>
</QItem> </QItem>
<QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('showPdf')"> <QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('showPdf')">
@ -232,7 +238,12 @@ const createInvoiceInCorrection = async () => {
>{{ t('invoiceIn.descriptorMenu.createCorrective') }}...</QItemSection >{{ t('invoiceIn.descriptorMenu.createCorrective') }}...</QItemSection
> >
</QItem> </QItem>
<QItem v-if="invoice.dmsFk" v-ripple clickable @click="downloadFile(invoice.dmsFk)"> <QItem
v-if="invoice.dmsFk"
v-ripple
clickable
@click="downloadFile(invoice.dmsFk)"
>
<QItemSection>{{ t('components.smartCard.downloadFile') }}</QItemSection> <QItemSection>{{ t('components.smartCard.downloadFile') }}</QItemSection>
</QItem> </QItem>
<QDialog ref="correctionDialogRef"> <QDialog ref="correctionDialogRef">
@ -296,7 +307,12 @@ const createInvoiceInCorrection = async () => {
</QItem> </QItem>
</QCardSection> </QCardSection>
<QCardActions class="justify-end q-mr-sm"> <QCardActions class="justify-end q-mr-sm">
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup /> <QBtn
flat
:label="t('globals.close')"
color="primary"
v-close-popup
/>
<QBtn <QBtn
:label="t('globals.save')" :label="t('globals.save')"
color="primary" color="primary"
@ -307,8 +323,8 @@ const createInvoiceInCorrection = async () => {
</QCardActions> </QCardActions>
</QCard> </QCard>
</QDialog> </QDialog>
</template>
</template> </template>
<i18n> <i18n>
en: en:
isNotLinked: The entry {bookEntry} has been deleted with {accountingEntries} entries isNotLinked: The entry {bookEntry} has been deleted with {accountingEntries} entries