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 myOptions = {userId};
|
||||
let tx;
|
||||
let result;
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
|
@ -33,12 +32,12 @@ module.exports = Self => {
|
|||
myOptions.transaction = tx;
|
||||
}
|
||||
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;
|
||||
|
||||
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();
|
||||
return result[0];
|
||||
|
|
Loading…
Reference in New Issue
{}, myOptions