#6276 createNewWarehouse methods migrated from silex to salix #1850
|
@ -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
|
||||
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;
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue
isNEwInstance o isNewInstance.
Añadir test para este caso