feat: refs #6739 transferInvoice new functionality #2412
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
transferInvoiceRequest();
|
||||
} else
|
||||
transferInvoiceRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
usar el negado para no llamar 2 veces a la funcion