refs #6270 makeInvoice #1963

Merged
carlossa merged 11 commits from 6270-electronicInvoiceBack into dev 2024-02-05 07:44:18 +00:00
4 changed files with 21 additions and 19 deletions

View File

@ -203,5 +203,7 @@
"Cannot past travels with entries": "Cannot past travels with entries", "Cannot past travels with entries": "Cannot past travels with entries",
"It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}",
"Incorrect pin": "Incorrect pin.", "Incorrect pin": "Incorrect pin.",
"The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified" "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified",
"Fecha fuera de rango": "Fecha fuera de rango",
"There is no zone for these parameters 34": "There is no zone for these parameters 34"
} }

View File

@ -108,6 +108,23 @@ module.exports = function(Self) {
await Self.rawSql('CALL invoiceOutBooking(?)', [resultInvoice.id], myOptions); await Self.rawSql('CALL invoiceOutBooking(?)', [resultInvoice.id], myOptions);
const client = await models.Client.findById(clientId,
{fields: ['hasElectronicInvoice', 'name', 'email']}, myOptions);
if (client.hasElectronicInvoice) {
const url = await models.Url.getUrl();
await models.NotificationQueue.create({
notificationFk: 'invoice-electronic',
authorFk: client.id,
params: JSON.stringify(
{
'name': client.name,
'email': client.email,
'ticketId': ticketsIds.join(','),
'url': url + 'ticket/index?q=' + encodeURIComponent(JSON.stringify({clientFk: clientId}))
})
}, myOptions);
}
if (tx) await tx.commit(); if (tx) await tx.commit();
return resultInvoice.id; return resultInvoice.id;

View File

@ -248,23 +248,6 @@ class Controller extends Section {
if (this.ticket.address.incotermsFk && !this.ticket.weight && !force) if (this.ticket.address.incotermsFk && !this.ticket.weight && !force)
return this.$.withoutWeightConfirmation.show(); return this.$.withoutWeightConfirmation.show();
const client = this.ticket.client;
if (client.hasElectronicInvoice) {
this.$http.post(`NotificationQueues`, {
notificationFk: 'invoice-electronic',
authorFk: client.id,
params: JSON.stringify(
{
'name': client.name,
'email': client.email,
'ticketId': this.id,
'url': window.location.href
})
}).then(() => {
this.vnApp.showSuccess(this.$t('Invoice sent'));
});
}
return this.$http.post(`Tickets/invoiceTicketsAndPdf`, {ticketsIds: [this.id]}) return this.$http.post(`Tickets/invoiceTicketsAndPdf`, {ticketsIds: [this.id]})
.then(() => this.reload()) .then(() => this.reload())
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));

View File

@ -10,7 +10,7 @@ module.exports = {
required: true required: true
}, },
ticketId: { ticketId: {
type: [Number], type: [String],
required: true required: true
}, },
url: { url: {