From 789e70b7a81eb6b1d286c0d4f357f5bba81484ea Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 2 Oct 2024 16:37:58 +0200 Subject: [PATCH] feat: all clients just with global series --- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 4 ++-- src/stores/invoiceOutGlobal.js | 9 +++++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index af0ba0996..a6994dfe3 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -607,6 +607,7 @@ invoiceOut: invoiceWithFutureDate: Exists an invoice with a future date noTicketsToInvoice: There are not tickets to invoice criticalInvoiceError: 'Critical invoicing error, process stopped' + invalidSerialTypeForAll: The serial type must be global when invoicing all clients table: client: Client addressId: Address id diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index f56cd6761..5c2d73dfd 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -616,6 +616,7 @@ invoiceOut: invoiceWithFutureDate: Existe una factura con una fecha futura noTicketsToInvoice: No existen tickets para facturar criticalInvoiceError: Error crítico en la facturación proceso detenido + invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes table: client: Cliente addressId: Id dirección diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index 5bcb21001..31928c776 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -184,7 +184,7 @@ onMounted(async () => { en: invoiceDate: Invoice date - maxShipped: Max date + maxShipped: Max date ticket allClients: All clients oneClient: One client company: Company @@ -196,7 +196,7 @@ en: es: invoiceDate: Fecha de factura - maxShipped: Fecha límite + maxShipped: Fecha límite ticket allClients: Todos los clientes oneClient: Un solo cliente company: Empresa diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js index 42acac013..5212fc6f0 100644 --- a/src/stores/invoiceOutGlobal.js +++ b/src/stores/invoiceOutGlobal.js @@ -161,6 +161,15 @@ export const useInvoiceOutGlobalStore = defineStore({ ); throw new Error('Invalid Serial Type'); } + + if (clientsToInvoice === 'all' && params.serialType !== 'global') { + notify( + 'invoiceOut.globalInvoices.errors.invalidSerialTypeForAll', + 'negative' + ); + throw new Error('For "all" clients, the serialType must be "global"'); + } + if (!params.companyFk) { notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative'); throw new Error('Invalid company');