feat: refs #6897 add EntryConfig model and enhance entry filtering with new parameters #3366

Merged
pablone merged 15 commits from 6897-refactorEntryBuyList into dev 2025-02-12 06:37:44 +00:00
1 changed files with 2 additions and 3 deletions
Showing only changes of commit f347d9668f - Show all commits

View File

@ -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
Review

{}, myOptions

{}, myOptions
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
Review

const [result]

const [result]
if (tx) await tx.commit();
return result[0];