fix: use _get_sor() instead of get_module_dbname() in discount item queries
This commit is contained in:
parent
8fde34ee8d
commit
49b6cbe85b
@ -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}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user