feat: refs #6739 transferInvoice new functionality #2412

Merged
jon merged 10 commits from 6739-transferInvoiceOut into dev 2024-05-10 04:51:42 +00:00
2 changed files with 13 additions and 15 deletions
Showing only changes of commit d4f734455d - Show all commits

View File

@ -33,7 +33,6 @@ module.exports = Self => {
try {
await Self.makePdf(id, options);
} catch (err) {
console.error(err);
throw new UserError('Error while generating PDF', 'pdfError');
}

View File

@ -148,25 +148,24 @@ class Controller extends Section {
invoiceCorrectionTypeFk: this.invoiceCorrectionType,
checked: this.checked
};
const transferInvoiceRequest = () => {
this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
const invoiceId = res.data;
this.vnApp.showSuccess(this.$t('Transferred invoice'));
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
});
};
this.$http.get(`Clients/${this.clientId}`).then(response => {
const clientData = response.data;
const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress;
if (this.checked && hasToInvoiceByAddress) {
if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?')) {
this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
const invoiceId = res.data;
this.vnApp.showSuccess(this.$t('Transferred invoice'));
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
});
}
} else {
this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
const invoiceId = res.data;
this.vnApp.showSuccess(this.$t('Transferred invoice'));
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
});
}
if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?'))
jon marked this conversation as resolved Outdated

usar el negado para no llamar 2 veces a la funcion

usar el negado para no llamar 2 veces a la funcion
transferInvoiceRequest();
} else
transferInvoiceRequest();
});
}
}