#6276 createNewWarehouse methods migrated from silex to salix #1850

Merged
jorgep merged 158 commits from 6276-createNewWarehouse into dev 2024-03-06 11:32:11 +00:00
2 changed files with 2 additions and 22 deletions
Showing only changes of commit 2fb68e81c9 - Show all commits

View File

@ -70,8 +70,7 @@ module.exports = Self => {
}, ctx.options);
if (item.family == 'EMB') return;
const isInPreparing = await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*');
if (!ctx.isNewInstance && isInPreparing) return;
if (await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*')) return;
await models.Sale.rawSql(`CALL catalog_calcFromItem(?,?,?,?)`, [
jorgep marked this conversation as resolved Outdated
Outdated
Review

isNEwInstance o isNewInstance.
Añadir test para este caso

isNEwInstance o isNewInstance. Añadir test para este caso
ticket.landed,
@ -89,7 +88,7 @@ module.exports = Self => {
if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return;
if (newQuantity < item.minQuantity && newQuantity != available && !isInPreparing)
if (newQuantity < item.minQuantity && newQuantity != available)
throw new UserError('The amount cannot be less than the minimum');
if (ctx.isNewInstance || isReduction) return;

View File

@ -233,25 +233,6 @@ describe('sale model ', () => {
}
});
it('should change the quantity if it has production role and is not a new instance', async() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue(getActiveCtx(9));
const tx = await models.Sale.beginTransaction({});
const options = {transaction: tx};
try {
const saleId = 1;
const newQuantity = 10;
const {quantity} = await models.Collection.setSaleQuantity(saleId, newQuantity, options);
expect(quantity).toEqual(newQuantity);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
describe('newPrice', () => {
it('should increase quantity if you have enough available and the new price is the same as the previous one', async() => {
const ctx = {