Merge pull request 'refs #6270 makeInvoice' (!1963) from 6270-electronicInvoiceBack into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1963 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
810df2ab95
|
@ -203,5 +203,7 @@
|
|||
"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}}",
|
||||
"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"
|
||||
}
|
|
@ -108,6 +108,23 @@ module.exports = function(Self) {
|
|||
|
||||
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();
|
||||
|
||||
return resultInvoice.id;
|
||||
|
|
|
@ -248,23 +248,6 @@ class Controller extends Section {
|
|||
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',
|
||||
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]})
|
||||
.then(() => this.reload())
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
required: true
|
||||
},
|
||||
ticketId: {
|
||||
type: [Number],
|
||||
type: [String],
|
||||
required: true
|
||||
},
|
||||
url: {
|
||||
|
|
Loading…
Reference in New Issue