From 6530e87508b0ea3040fe551346db1667a8dc2776 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 5 Jul 2023 15:20:51 +0200 Subject: [PATCH] refs #4614 feat(ticket): prevent invoice without weight --- db/changes/232801/00-ticketWeight.sql | 8 +-- .../ticket/front/descriptor-menu/index.html | 51 ++++++++++++------- modules/ticket/front/descriptor-menu/index.js | 14 ++--- .../front/descriptor-menu/locale/es.yml | 8 ++- modules/ticket/front/descriptor/locale/es.yml | 2 - 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/db/changes/232801/00-ticketWeight.sql b/db/changes/232801/00-ticketWeight.sql index 1888043485..0b727b4347 100644 --- a/db/changes/232801/00-ticketWeight.sql +++ b/db/changes/232801/00-ticketWeight.sql @@ -1,7 +1,7 @@ -UPDATE vn.ticket t - JOIN vn.ticketObservation o ON o.ticketFk = t.id +UPDATE `vn`.`ticket` t + JOIN `vn`.`ticketObservation` o ON o.ticketFk = t.id SET t.weight = cast(REPLACE(o.description, ',', '.') as decimal(10,2)) WHERE o.observationTypeFk = 6; -DELETE FROM vn.ticketObservation WHERE observationTypeFk = 6; -DELETE FROM vn.observationType WHERE id = 6; +DELETE FROM `vn`.`ticketObservation` WHERE observationTypeFk = 6; +DELETE FROM `vn`.`observationType` WHERE id = 6; diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index 6b4f967acc..5c76df97a3 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -101,23 +101,32 @@ translate> Change shipped hour - - SMS Pending payment - - - SMS Minimum import - - - SMS Notify changes + Send SMS... + + + + Pending payment + + + Minimum import + + + Notify changes + + + Set ticket weight @@ -371,3 +380,11 @@ + + + + diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 71a0c782fd..c849b59ebb 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -249,16 +249,11 @@ class Controller extends Section { this.$.sms.open(); } - makeInvoice() { - const params = {ticketsIds: [this.id]}; - /* - This should call the notification sistem to insert a new notification - in te queue, yet to check how to handle user permissions, - as of 08-11-2022 every employee can insert a new notification in the queue + makeInvoice(force) { + if (this.ticket.address.incotermsFk && !this.ticket.weight && !force) + return this.$.withoutWeightConfirmation.show(); - */ const client = this.ticket.client; - if (client.hasElectronicInvoice) { this.$http.post(`NotificationQueues`, { notificationFk: 'invoice-electronic', @@ -275,7 +270,8 @@ class Controller extends Section { }); } - return this.$http.post(`Tickets/makeInvoice`, params) + return this.$http.post(`Tickets/makeInvoice`, {ticketsIds: [this.id]}) + .then(() => this.reload()) .then(() => this.reload()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); } diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml index 3830523cfc..3181a753c0 100644 --- a/modules/ticket/front/descriptor-menu/locale/es.yml +++ b/modules/ticket/front/descriptor-menu/locale/es.yml @@ -16,8 +16,14 @@ without warehouse: sin almacén Invoice sent: Factura enviada The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}" Transfer client: Transferir cliente -SMS Notify changes: SMS Notificar cambios +Send SMS...: Enviar SMS... +Notify changes: Notificar cambios +Minimum import: Importe mínimo +Pending payment: Pago pendiente PDF sent!: ¡PDF enviado! Already exist signed delivery note: Ya existe albarán de entrega firmado Are you sure you want to replace this delivery note?: ¿Seguro que quieres reemplazar este albarán de entrega? Create a single ticket with all the content of the current ticket: Crea un ticket único con todo el contenido del ticket actual +Set ticket weight: Establecer peso al ticket +Ticket weight: Peso del ticket +This address has incoterms, you should set the weight before invoice it: Este consigatario tiene incoterms, deberías establecer el peso antes de facturar diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index 3da0134675..86b1a6b57a 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -17,8 +17,6 @@ Shipped hour updated: Hora de envio modificada Deleted ticket: Ticket eliminado Recalculate components: Recalcular componentes Are you sure you want to recalculate the components?: ¿Seguro que quieres recalcular los componentes? -SMS Minimum import: 'SMS Importe minimo' -SMS Pending payment: 'SMS Pago pendiente' Restore ticket: Restaurar ticket You are going to restore this ticket: Vas a restaurar este ticket Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket?