1341 invoiceOut.descriptor asentar factura
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-04-30 11:47:39 +02:00
parent c8bf9d0d7b
commit c68015fb88
3 changed files with 12 additions and 12 deletions

View File

@ -2,15 +2,15 @@ const app = require('vn-loopback/server/server');
describe('invoiceOut delete()', () => { describe('invoiceOut delete()', () => {
const invoiceOutId = 2; const invoiceOutId = 2;
let OriginalInvoice; let OriginalInvoiceOut;
let OriginalTickets; let OriginalTickets;
afterAll(async done => { afterAll(async done => {
const newInvoice = await app.models.InvoiceOut.create(OriginalInvoice); const newInvoiceOut = await app.models.InvoiceOut.create(OriginalInvoiceOut);
await newInvoice.updateAttribute('ref', OriginalInvoice.ref); await newInvoiceOut.updateAttribute('ref', OriginalInvoiceOut.ref);
const promises = []; const promises = [];
OriginalTickets.forEach(ticket => { OriginalTickets.forEach(ticket => {
promises.push(ticket.updateAttribute('refFk', newInvoice.ref)); promises.push(ticket.updateAttribute('refFk', newInvoiceOut.ref));
}); });
Promise.all(promises); Promise.all(promises);
@ -26,13 +26,13 @@ describe('invoiceOut delete()', () => {
}); });
it(`should check the two tickets from the invoice id 2 that are not invoiced`, async() => { it(`should check the two tickets from the invoice id 2 that are not invoiced`, async() => {
OriginalInvoice = await app.models.InvoiceOut.findById(invoiceOutId); OriginalInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId);
await app.models.InvoiceOut.delete(invoiceOutId); await app.models.InvoiceOut.delete(invoiceOutId);
OriginalTickets = await app.models.Ticket.find({where: {id: {inq: [2, 3]}}}); OriginalTickets = await app.models.Ticket.find({where: {id: {inq: [2, 3]}}});
const invoice = await app.models.InvoiceOut.findById(invoiceOutId); const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId);
expect(OriginalTickets[0].refFk).toBeNull(); expect(OriginalTickets[0].refFk).toBeNull();
expect(OriginalTickets[1].refFk).toBeNull(); expect(OriginalTickets[1].refFk).toBeNull();
expect(invoice).toBeNull(); expect(invoiceOut).toBeNull();
}); });
}); });

View File

@ -10,8 +10,8 @@ class Controller {
this.$http = $http; this.$http = $http;
this.aclService = aclService; this.aclService = aclService;
this.moreOptions = [ this.moreOptions = [
{callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'}, {callback: this.showInvoiceOutPdf, name: 'Show invoice PDF'},
{callback: this.showDeleteInvoiceOutDialog, name: 'Delete InvoiceOut', acl: 'invoicing'}, {callback: this.showDeleteInvoiceOutDialog, name: 'Delete Invoice', acl: 'invoicing'},
{callback: this.showBookInvoiceOutDialog, name: 'Book invoice', acl: 'invoicing'} {callback: this.showBookInvoiceOutDialog, name: 'Book invoice', acl: 'invoicing'}
]; ];
} }
@ -80,7 +80,7 @@ class Controller {
const query = `/invoiceOut/api/InvoiceOuts/${this.invoiceOut.ref}/book`; const query = `/invoiceOut/api/InvoiceOuts/${this.invoiceOut.ref}/book`;
this.$http.post(query).then(() => { this.$http.post(query).then(() => {
this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked')); this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked'));
this.$state.go('invoiceOut.index'); this.$state.reload();
}); });
} }
} }

View File

@ -2,8 +2,8 @@ Volume exceded: Volumen excedido
Volume: Volumen Volume: Volumen
Client card: Ficha del cliente Client card: Ficha del cliente
Invoice ticket list: Listado de tickets de la factura Invoice ticket list: Listado de tickets de la factura
Show invoice out PDF: Ver factura emitida en PDF Show invoice PDF: Ver factura en PDF
Delete InvoiceOut: Borrar factura Delete Invoice: Borrar factura
InvoiceOut deleted: Factura eliminada InvoiceOut deleted: Factura eliminada
Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura?
Book invoice: Asentar factura Book invoice: Asentar factura