feat: refs #6897 add EntryConfig model and enhance entry filtering with new parameters #3366
|
@ -24,7 +24,6 @@ module.exports = Self => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const myOptions = {userId};
|
const myOptions = {userId};
|
||||||
let tx;
|
let tx;
|
||||||
let result;
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
@ -33,12 +32,12 @@ module.exports = Self => {
|
||||||
myOptions.transaction = tx;
|
myOptions.transaction = tx;
|
||||||
}
|
}
|
||||||
const entry = await Self.findById(entryFk, myOptions);
|
const entry = await Self.findById(entryFk, myOptions);
|
||||||
const entryConfig = await Self.app.models.EntryConfig.findOne(myOptions);
|
const entryConfig = await Self.app.models.EntryConfig.findOne({}, myOptions);
|
||||||
|
|
||||||
pablone marked this conversation as resolved
|
|||||||
if (entry.supplierFk === entryConfig.inventorySupplierFk) return;
|
if (entry.supplierFk === entryConfig.inventorySupplierFk) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = await Self.rawSql('CALL vn.buy_recalcPricesByEntry(?)', [entryFk], myOptions);
|
const result = await Self.rawSql('CALL vn.buy_recalcPricesByEntry(?)', [entryFk], myOptions);
|
||||||
|
|
||||||
pablone marked this conversation as resolved
alexm
commented
const [result] const [result]
|
|||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
return result[0];
|
return result[0];
|
||||||
|
|
Loading…
Reference in New Issue
{}, myOptions