diff --git a/modules/item/back/methods/item/clone.js b/modules/item/back/methods/item/clone.js index fc1682912..14fc1e365 100644 --- a/modules/item/back/methods/item/clone.js +++ b/modules/item/back/methods/item/clone.js @@ -31,7 +31,13 @@ module.exports = Self => { if (!origin) throw new UserError(`That item doesn't exists`); + origin.itemTag = undefined; + origin.description = undefined; + origin.image = undefined; + origin.comment = undefined; + const newItem = await Self.create(origin, options); + let promises = []; await cloneTaxes(origin.id, newItem.id, promises, options); diff --git a/modules/item/back/methods/item/specs/clone.spec.js b/modules/item/back/methods/item/specs/clone.spec.js index 859a3167f..a1bd0f6c8 100644 --- a/modules/item/back/methods/item/specs/clone.spec.js +++ b/modules/item/back/methods/item/specs/clone.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -describe('item clone()', () => { +fdescribe('item clone()', () => { let nextItemId; beforeEach(async() => { @@ -17,6 +17,10 @@ describe('item clone()', () => { let result = await app.models.Item.clone(itemFk); expect(result.id).toEqual(nextItemId); + expect(result.image).toBeUndefined(); + expect(result.itemTag).toBeUndefined(); + expect(result.comment).toBeUndefined(); + expect(result.description).toBeUndefined(); }); it('should attempt to clone the given item but give an error as it doesnt exist', async() => {