#6276 createNewWarehouse methods migrated from silex to salix #1850
|
@ -86,19 +86,15 @@ module.exports = Self => {
|
||||||
|
|
||||||
await Self.updateTracking(ctx, saleFk, originalQuantity, code, isChecked, null, isScanned, myOptions);
|
await Self.updateTracking(ctx, saleFk, originalQuantity, code, isChecked, null, isScanned, myOptions);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const buy = await models.Buy.findById(buyFk, myOptions);
|
||||||
|
if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw new UserError($t('The line could not be marked'));
|
throw new UserError($t('The line could not be marked'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const buy = await models.Buy.findOne({
|
|
||||||
where: {
|
|
||||||
id: buyFk,
|
|
||||||
itemOriginalFk: {neq: null}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (buy) await models.SaleBuy.create({saleFk, buyFk});
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
fdescribe('saleTracking mark()', () => {
|
describe('saleTracking mark()', () => {
|
||||||
const saleFk = 1;
|
const saleFk = 1;
|
||||||
const originalQuantity = 10;
|
const originalQuantity = 10;
|
||||||
const code = 'PREPARED';
|
const code = 'PREPARED';
|
||||||
|
|
Loading…
Reference in New Issue