7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
6 changed files with 124 additions and 105 deletions
Showing only changes of commit 02e38eb711 - Show all commits

View File

@ -46,7 +46,7 @@ module.exports = Self => {
}
try {
const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk]);
const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk], myOptions);
if (!item?.available) throw new UserError($t('We do not have availability for the selected item'));

View File

@ -56,7 +56,7 @@ module.exports = Self => {
if (tickets.length) await sendRocketTickets(tickets);
return getCollection(id, tickets, sales, placements, myOptions);
};
async function sendRocketTickets(tickets) {
for (let ticket of tickets) {
let observations = ticket.observaciones.split(' ');
@ -169,4 +169,3 @@ module.exports = Self => {
}
}
};
};

View File

@ -43,11 +43,14 @@ describe('collection getSalesFromTicketOrCollection()', () => {
it('should print a sticker', async() => {
const tx = await models.Collection.beginTransaction({});
const options = {transaction: tx};
const query = 'SELECT * FROM printQueue pq JOIN printQueueArgs pqa ON pqa.printQueueFk = pq.id';
try {
const printQueueBefore = await models.Collection.rawSql('SELECT * FROM printQueue', [], options);
const printQueueBefore = await models.Collection.rawSql(
query, [], options);
await models.Collection.getSalesFromTicketOrCollection(ctx,
collectionOrTicketFk, print, source, options);
const printQueueAfter = await models.Collection.rawSql('SELECT * FROM printQueue', [], options);
collectionOrTicketFk, true, source, options);
const printQueueAfter = await models.Collection.rawSql(
query, [], options);
expect(printQueueAfter.length).toEqual(printQueueBefore.length + 1);
await tx.rollback();
@ -56,4 +59,24 @@ describe('collection getSalesFromTicketOrCollection()', () => {
throw e;
}
});
it('should getSalesFromTicketOrCollection', async() => {
const tx = await models.Collection.beginTransaction({});
try {
const options = {transaction: tx};
await models.Ticket.updateAll({id: collectionOrTicketFk}, {shipped: '2001-01-02 00:00:00.000'}, options);
const ticketTrackingBefore = await models.TicketTracking.find(null, options);
await models.Collection.getSalesFromTicketOrCollection(ctx,
collectionOrTicketFk, false, source, options);
const ticketTrackingAfter = await models.TicketTracking.find(null, options);
expect(ticketTrackingAfter.length).toEqual(ticketTrackingBefore.length + 1);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -47,7 +47,8 @@ module.exports = Self => {
}, 0);
discardItems.push(item);
const [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?) itemPacking', [item, warehouseFk]);
const [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?) itemPacking',
[item, warehouseFk], myOptions);
let packing;
if (result) packing = result.itemPacking;
@ -56,11 +57,7 @@ module.exports = Self => {
quantity = quantity * packing;
await Self.rawSql('CALL vn.itemShelving_add(?, ?, ?, NULL, NULL, ?, ?)',
[shelvingFk,
item,
quantity,
packing,
warehouseFk]
[shelvingFk, item, quantity, packing, warehouseFk], myOptions
);
}
}

View File

@ -39,8 +39,8 @@ module.exports = Self => {
};
let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions);
const [alternatives] = await models.ItemShelving.rawSql(
'CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]
const [alternatives] = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)',
[shelvingFk], myOptions
);
if (itemShelvings) {

View File

@ -96,7 +96,7 @@ module.exports = Self => {
neq: null
}
}
});
}, myOptions);
}
if (isBuy)
await models.SaleBuy.create({saleFk, buyFk}, myOptions);