From 05478b43f25e119caf731f9473609e8a5127cbe5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 5 Feb 2024 09:30:29 +0100 Subject: [PATCH] fix: refs #4466 test back --- modules/invoiceIn/back/methods/invoice-in/clone.js | 4 +--- .../ticket/back/methods/sale/specs/clone.spec.js | 14 +++----------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/modules/invoiceIn/back/methods/invoice-in/clone.js b/modules/invoiceIn/back/methods/invoice-in/clone.js index ce1ec178d..88ea0ddcd 100644 --- a/modules/invoiceIn/back/methods/invoice-in/clone.js +++ b/modules/invoiceIn/back/methods/invoice-in/clone.js @@ -110,9 +110,7 @@ module.exports = Self => { foreignValue: dueDated.foreignValue, }, myOptions)); } - } - - if (isRectification) { + } else { for (let intrastat of invoiceInIntrastat) { promises.push(models.InvoiceInIntrastat.create({ invoiceInFk: clone.id, diff --git a/modules/ticket/back/methods/sale/specs/clone.spec.js b/modules/ticket/back/methods/sale/specs/clone.spec.js index f52f7ba38..e2220c028 100644 --- a/modules/ticket/back/methods/sale/specs/clone.spec.js +++ b/modules/ticket/back/methods/sale/specs/clone.spec.js @@ -70,19 +70,11 @@ describe('Ticket cloning - clone function', () => { it('should create a ticket without sales', async() => { const servicesIds = [4]; - const tx = await models.Sale.beginTransaction({}); - const options = {transaction: tx}; - try { - const tickets = await models.Sale.clone(ctx, null, servicesIds, false, options); - const refundedTicket = await getTicketRefund(tickets[0].id, options); - expect(refundedTicket).toBeDefined(); + const tickets = await models.Sale.clone(ctx, null, servicesIds, false, false, options); + const refundedTicket = await getTicketRefund(tickets[0].id, options); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } + expect(refundedTicket).toBeDefined(); }); });