refs #4614 feat(ticket): prevent invoice without weight
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-07-05 15:20:51 +02:00
parent 040e9e4197
commit 6530e87508
5 changed files with 50 additions and 33 deletions

View File

@ -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;

View File

@ -101,23 +101,32 @@
translate>
Change shipped hour
</vn-item>
<vn-item
ng-click="$ctrl.sendPaymentSms()"
name="sendPaymentSms"
<vn-item class="dropdown"
vn-click-stop="sendDeliveryNoteMenu.show($event, 'left');"
translate>
SMS Pending payment
</vn-item>
<vn-item
ng-click="$ctrl.sendImportSms()"
name="sendImportSms"
translate>
SMS Minimum import
</vn-item>
<vn-item
ng-click="$ctrl.sendChangesSms()"
name="sendChangesSms"
translate>
SMS Notify changes
Send SMS...
<vn-menu vn-id="sendDeliveryNoteMenu">
<vn-list>
<vn-item
ng-click="$ctrl.sendPaymentSms()"
name="sendPaymentSms"
translate>
Pending payment
</vn-item>
<vn-item
ng-click="$ctrl.sendImportSms()"
name="sendImportSms"
translate>
Minimum import
</vn-item>
<vn-item
ng-click="$ctrl.sendChangesSms()"
name="sendChangesSms"
translate>
Notify changes
</vn-item>
</vn-list>
</vn-menu>
</vn-item>
<vn-item
ng-click="makeInvoiceConfirmation.show()"
@ -165,7 +174,7 @@
</vn-item>
<vn-item
ng-click="setTicketWeight.show()"
vn-acl="employee"
vn-acl="deliveryBoss"
translate>
Set ticket weight
</vn-item>
@ -371,3 +380,11 @@
<button response="accept" translate>Accept</button>
</tpl-buttons>
</vn-dialog>
<!-- Without weight confirmation dialog -->
<vn-confirm
vn-id="withoutWeightConfirmation"
on-accept="$ctrl.makeInvoice(true)"
question="This address has incoterms, you should set the weight before invoice it"
message="Are you sure you want to invoice this ticket?">
</vn-confirm>

View File

@ -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')));
}

View File

@ -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

View File

@ -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?