fix(suppliers): 库名写死 sage 改 get_module_dbname 跨应用解析
单库应用(如 pipeline)get_module_dbname 全返回主库,写死 'sage' 会把供应商 机构写到错库。开户旁路化:失败不阻断供应商创建。
This commit is contained in:
parent
927ee954ac
commit
aa2c1604d1
@ -32,10 +32,18 @@ try:
|
||||
'updated_at': now_org
|
||||
}
|
||||
db = DBPools()
|
||||
async with db.sqlorContext('sage') as sor_sage:
|
||||
await sor_sage.C('organization', org_rec)
|
||||
# 开账:accounting_orgid='0', 当前用户与供应商的往来账
|
||||
await openRetailRelationshipAccounts(sor_sage, '0', new_orgid, user_orgid)
|
||||
# 库名用 get_module_dbname 跨应用取(单库应用全返回主库,不能写死 'sage')
|
||||
org_dbname = get_module_dbname('rbac')
|
||||
acc_dbname = get_module_dbname('accounting')
|
||||
async with db.sqlorContext(org_dbname) as sor_org:
|
||||
await sor_org.C('organization', org_rec)
|
||||
# 开账:accounting_orgid='0', 当前用户与供应商的往来账(旁路,失败不阻断创建)
|
||||
try:
|
||||
async with db.sqlorContext(acc_dbname) as sor_acc:
|
||||
await openRetailRelationshipAccounts(sor_acc, '0', new_orgid, user_orgid)
|
||||
await sor_acc.sqlExe("COMMIT", {})
|
||||
except Exception as _acc_e:
|
||||
debug(f'suppliers_create: open accounts skipped: {_acc_e}')
|
||||
|
||||
data['orgid'] = new_orgid
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user