test okl
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2021-08-12 07:39:26 +02:00
parent d49242751e
commit 54634ed22d
6 changed files with 20 additions and 33 deletions

View File

@ -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`

View File

@ -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"
}

View File

@ -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

View File

@ -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);

View File

@ -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) {

View File

@ -2,7 +2,8 @@
"name": "InvoiceInTax",
"base": "Loggable",
"log": {
"model": "InvoiceInLog"
"model": "InvoiceInLog",
"relation": "invoiceIn"
},
"options": {
"mysql": {