From 49b6cbe85b034f5f71e28cdb67e74df27f1ef156 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 12 Jul 2026 23:01:44 +0800 Subject: [PATCH] fix: use _get_sor() instead of get_module_dbname() in discount item queries --- supplychain/init.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/supplychain/init.py b/supplychain/init.py index b4fb74c..1cb7086 100644 --- a/supplychain/init.py +++ b/supplychain/init.py @@ -970,11 +970,10 @@ async def get_agreement_discount_items(request): 'category_id': r.category_id or '', 'category_name': r.category_name or '', }) # Get existing agreement items from supplychain - dbname = get_module_dbname('supplychain') + db, dbname = _get_sor() items = {} if products: - pids = [p['productid'] for p in products] - async with DBPools().sqlorContext(dbname) as sor: + async with db.sqlorContext(dbname) as sor: rows = await sor.sqlExe( "SELECT id, productid, discount FROM distribution_agreement_items WHERE agreement_id = ${aid}$", {'aid': agreement_id} @@ -1019,10 +1018,10 @@ async def get_contract_discount_items(request): 'category_id': r.category_id or '', 'category_name': r.category_name or '', }) # Get existing contract items from supplychain - dbname = get_module_dbname('supplychain') + db, dbname = _get_sor() items = {} if products: - async with DBPools().sqlorContext(dbname) as sor: + async with db.sqlorContext(dbname) as sor: rows = await sor.sqlExe( "SELECT id, productid, discount FROM supply_contract_items WHERE contract_id = ${cid}$", {'cid': contract_id}