diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 89d5d463a..65d68ab21 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2312,16 +2312,6 @@ REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issu (9, 1009, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1242, 1, 442, 1), (10, 1010, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1243, 1, 442, 1); -INSERT INTO vn.invoiceInTax (invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) - VALUES - (1, 252.25, '4751000000', NULL, 7, 61), - (2, 223.17, '6210000567', NULL, 8, 20), - (3, 95.60, '7001000000', NULL, 8, 35), - (4, 446.63, '7001000000', NULL, 6, 61), - (5, 64.23, '6210000567', NULL, 8, 20), - (6, 29.95, '7001000000', NULL, 7, 20), - (7, 58.64, '6210000567', NULL, 8, 20); - INSERT INTO `vn`.`invoiceInDueDay`(`invoiceInFk`, `dueDated`, `bankFk`, `amount`) VALUES (1, CURDATE(), 1, 237), @@ -2349,13 +2339,20 @@ INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`) (9, 9, 9), (10, 10, 10); -INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxCodeFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`, `created`) +INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`) VALUES - (1, 4, 99.99, '2000000000', null, null, null, CURDATE()), - (2, 4, 999.99, '2000000000', null, null, null, CURDATE()), - (3, 4, 1000.50, '2000000000', null, null, null, CURDATE()), - (4, 4, 0.50, '2000000000', null, null, null, CURDATE()), - (5, 4, 150.50, '2000000000', null, null, null, CURDATE()); + (1, 99.99, '2000000000', null, null, null), + (2, 999.99, '2000000000', null, null, null), + (3, 1000.50, '2000000000', null, null, null), + (4, 0.50, '2000000000', null, null, null), + (5, 150.50, '2000000000', null, null, null), + (1, 252.25, '4751000000', NULL, 7, 61), + (2, 223.17, '6210000567', NULL, 8, 20), + (3, 95.60, '7001000000', NULL, 8, 35), + (4, 446.63, '7001000000', NULL, 6, 61), + (5, 64.23, '6210000567', NULL, 8, 20), + (6, 29.95, '7001000000', NULL, 7, 20), + (7, 58.64, '6210000567', NULL, 8, 20); INSERT INTO `vn`.`ticketRecalc`(`ticketFk`) SELECT `id` diff --git a/loopback/locale/es.json b/loopback/locale/es.json index f301df8cc..fe0027657 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -194,5 +194,6 @@ "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada", "This document already exists on this ticket": "Este documento ya existe en el ticket", "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", - "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes" + "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", + "INACTIVE_PROVIDER": "INACTIVE_PROVIDER" } \ No newline at end of file diff --git a/modules/invoiceIn/back/methods/invoice-in/clone.js b/modules/invoiceIn/back/methods/invoice-in/clone.js index c1bf0f3ac..5835c5438 100644 --- a/modules/invoiceIn/back/methods/invoice-in/clone.js +++ b/modules/invoiceIn/back/methods/invoice-in/clone.js @@ -69,25 +69,13 @@ module.exports = Self => { deductibleExpenseFk: sourceInvoiceIn.deductibleExpenseFk, }, myOptions); - const oldProperties = await loggable.translateValues(Self, sourceInvoiceIn); - const newProperties = await loggable.translateValues(Self, clone); - await models.InvoiceInLog.create({ - originFk: clone.id, - userFk: userId, - action: 'insert', - changedModel: 'InvoiceIn', - changedModelId: clone.id, - oldInstance: oldProperties, - newInstance: newProperties - }, myOptions); - const promises = []; for (let tax of sourceInvoiceInTax) { promises.push(models.InvoiceInTax.create({ invoiceInFk: clone.id, taxableBase: tax.taxableBase, - expenceFk: tax.expenceFk, + expenseFk: tax.expenseFk, foreignValue: tax.foreignValue, taxTypeSageFk: tax.taxTypeSageFk, transactionTypeSageFk: tax.transactionTypeSageFk diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/clone.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/clone.spec.js index 09b7e6019..035ee2661 100644 --- a/modules/invoiceIn/back/methods/invoice-in/specs/clone.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in/specs/clone.spec.js @@ -21,7 +21,7 @@ describe('invoiceIn clone()', () => { const invoiceInTaxes = await models.InvoiceInTax.find({where: {invoiceInFk: clone.id}}, options); - expect(invoiceInTaxes.length).toEqual(1); + expect(invoiceInTaxes.length).toEqual(2); const invoiceInDueDays = await models.InvoiceInDueDay.find({where: {invoiceInFk: clone.id}}, options); diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js index 0ef8fbaab..656b97d6d 100644 --- a/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js @@ -9,7 +9,7 @@ describe('invoiceIn summary()', () => { const summary = await models.InvoiceIn.summary(1, options); expect(summary.supplierRef).toEqual('1234'); - expect(summary.totals.totalTaxableBase).toEqual(252.25); + expect(summary.totals.totalTaxableBase).toEqual(352.24); await tx.rollback(); } catch (e) { diff --git a/modules/invoiceIn/back/models/invoice-in-tax.json b/modules/invoiceIn/back/models/invoice-in-tax.json index af93a05bc..789020161 100644 --- a/modules/invoiceIn/back/models/invoice-in-tax.json +++ b/modules/invoiceIn/back/models/invoice-in-tax.json @@ -2,7 +2,8 @@ "name": "InvoiceInTax", "base": "Loggable", "log": { - "model": "InvoiceInLog" + "model": "InvoiceInLog", + "relation": "invoiceIn" }, "options": { "mysql": {