diff --git a/e2e/paths/09-invoice-in/02_descriptor.spec.js b/e2e/paths/09-invoice-in/02_descriptor.spec.js index 00ed49ec9..02bbce7ac 100644 --- a/e2e/paths/09-invoice-in/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-in/02_descriptor.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -// #3082 clone is broken due to a strange trigger from production -xdescribe('InvoiceIn descriptor path', () => { +describe('InvoiceIn descriptor path', () => { let browser; let page; diff --git a/modules/invoiceIn/back/methods/invoice-in/clone.js b/modules/invoiceIn/back/methods/invoice-in/clone.js index 35478b045..18df53a95 100644 --- a/modules/invoiceIn/back/methods/invoice-in/clone.js +++ b/modules/invoiceIn/back/methods/invoice-in/clone.js @@ -52,10 +52,11 @@ module.exports = Self => { const issued = new Date(sourceInvoiceIn.issued); issued.setMonth(issued.getMonth() + 1); + const clonedRef = sourceInvoiceIn.supplierRef + '(2)'; const clone = await models.InvoiceIn.create({ serial: sourceInvoiceIn.serial, - supplierRef: sourceInvoiceIn.supplierRef, + supplierRef: clonedRef, supplierFk: sourceInvoiceIn.supplierFk, issued: issued, currencyFk: sourceInvoiceIn.currencyFk, 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 71e3c2f6d..e0f191962 100644 --- a/modules/invoiceIn/back/methods/invoice-in/specs/clone.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in/specs/clone.spec.js @@ -1,7 +1,6 @@ const models = require('vn-loopback/server/server').models; -// #3082 clone is broken due to a strange trigger from production -xdescribe('invoiceIn clone()', () => { +describe('invoiceIn clone()', () => { it('should return the cloned invoiceIn and also clone invoiceInDueDays and invoiceInTaxes if there are any referencing the invoiceIn', async() => { const userId = 1; const ctx = { @@ -18,7 +17,7 @@ xdescribe('invoiceIn clone()', () => { try { const clone = await models.InvoiceIn.clone(ctx, 1, options); - expect(clone.supplierRef).toEqual('1234'); + expect(clone.supplierRef).toEqual('1234(2)'); const invoiceInTaxes = await models.InvoiceInTax.find({where: {invoiceInFk: clone.id}}, options);