bugfix
This commit is contained in:
parent
695bf5a18e
commit
7e45b4d0e2
@ -43,21 +43,28 @@ class BizAccounting:
|
||||
write acc_detail
|
||||
write acc_balance
|
||||
"""
|
||||
def __init__(self, curdate, accountset, amount_threahold=0.0001):
|
||||
def __init__(self, curdate, biz_order, accountset, amount_threahold=0.0001):
|
||||
self.accounting_config = None
|
||||
self.curdate = curdate
|
||||
self.biz_order = biz_order
|
||||
self.accountset = accountset
|
||||
self.amount_threahold = amount_threahold
|
||||
self.timestamp = timestampstr()
|
||||
|
||||
async def do_accounting(self, sor):
|
||||
legs = self.get_accounting_legs(sor)
|
||||
legs = [l for l in legs if l['amount'] >= self.amount_threahold]
|
||||
self.check_accounting_balance(legs)
|
||||
self.write_billdetail(sor)
|
||||
bill = await write_bill(sor, self.biz_order.customerid,
|
||||
self.biz_order.userid,
|
||||
self.biz_order.id,
|
||||
self.biz_order.business_op,
|
||||
self.biz_order.amount)
|
||||
await self.write_billdetail(sor)
|
||||
self.merge_legs(legs)
|
||||
self.accounting_legs = legs
|
||||
for leg in legs:
|
||||
self.leg_accounting(sor, leg)
|
||||
await self.leg_accounting(sor, leg)
|
||||
|
||||
async def get_orgid_by_trans_role(self, role, accountset):
|
||||
return accountset.get(role)
|
||||
@ -68,9 +75,9 @@ class BizAccounting:
|
||||
for aset in self.accountset.subsets:
|
||||
legs1 = self.get_accountset_legs(sor, aset)
|
||||
leg += legs1
|
||||
returnn legs
|
||||
return legs
|
||||
|
||||
async def get_accountset_legs(self, sor, accountset)
|
||||
async def get_accountset_legs(self, sor, accountset):
|
||||
global accounting_config
|
||||
action = accountset.action.split('_')[0]
|
||||
await get_accounting_config(sor)
|
||||
@ -151,7 +158,7 @@ class BizAccounting:
|
||||
exception(f'{legs=}, {e=}')
|
||||
raise e
|
||||
|
||||
def write_billdetail(self, sor, legs):
|
||||
async def write_billdetail(self, sor, legs):
|
||||
for leg in legs:
|
||||
ns = {
|
||||
'id':getID(),
|
||||
|
Loading…
Reference in New Issue
Block a user