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