refactor: refs #6739 transferInvoice() refactor
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
4e78307a8d
commit
d4f734455d
|
@ -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?'))
|
||||
transferInvoiceRequest();
|
||||
} else
|
||||
transferInvoiceRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue