refactor: refs #6739 transferInvoice() refactor
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-05-07 11:35:05 +02:00
parent 4e78307a8d
commit d4f734455d
2 changed files with 13 additions and 15 deletions

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?'))
transferInvoiceRequest();
} else
transferInvoiceRequest();
});
}
}