bugfix
This commit is contained in:
parent
7537a45956
commit
996a8821e4
@ -14,6 +14,11 @@ from datetime import datetime
|
|||||||
|
|
||||||
accounting_config = None
|
accounting_config = None
|
||||||
|
|
||||||
|
class PFBiz:
|
||||||
|
async def get_orgid_by_trans_role(self, sor, leg, role):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def get_accounting_config(sor):
|
async def get_accounting_config(sor):
|
||||||
global accounting_config
|
global accounting_config
|
||||||
if accounting_config:
|
if accounting_config:
|
||||||
@ -100,10 +105,10 @@ class Accounting:
|
|||||||
debug(f'do_accounting() ...{self.accounting_legs=}')
|
debug(f'do_accounting() ...{self.accounting_legs=}')
|
||||||
self.check_accounting_balance(self.accounting_legs)
|
self.check_accounting_balance(self.accounting_legs)
|
||||||
for leg in self.accounting_legs:
|
for leg in self.accounting_legs:
|
||||||
accounting_orgid = await self.caller.get_orgid_by_trans_role(sor, leg.accounting_orgtype)
|
accounting_orgid = await self.caller.get_orgid_by_trans_role(sor, leg, leg.accounting_orgtype)
|
||||||
orgid = await self.caller.get_orgid_by_trans_role(sor, leg.orgtype)
|
orgid = await self.caller.get_orgid_by_trans_role(sor, leg, leg.orgtype)
|
||||||
org1id = None if leg.org1type is None else \
|
org1id = None if leg.org1type is None else \
|
||||||
await self.caller.get_orgid_by_trans_role(sor, leg.org1type)
|
await self.caller.get_orgid_by_trans_role(sor, leg, leg.org1type)
|
||||||
acc = await get_account(sor, accounting_orgid, orgid, leg.subjectid, org1id=org1id)
|
acc = await get_account(sor, accounting_orgid, orgid, leg.subjectid, org1id=org1id)
|
||||||
if acc is None:
|
if acc is None:
|
||||||
debug(f'can not get accountid {accounting_orgid=}, {orgid=},{leg.subjectid=}, {org1id=}')
|
debug(f'can not get accountid {accounting_orgid=}, {orgid=},{leg.subjectid=}, {org1id=}')
|
||||||
|
|||||||
@ -12,7 +12,7 @@ from .const import *
|
|||||||
from .excep import *
|
from .excep import *
|
||||||
from .getaccount import getAccountByName
|
from .getaccount import getAccountByName
|
||||||
|
|
||||||
class RechargeAccounting:
|
class RechargeBiz(PFBiz):
|
||||||
def __init__(self, recharge_log):
|
def __init__(self, recharge_log):
|
||||||
self.db = DBPools()
|
self.db = DBPools()
|
||||||
self.recharge_log = recharge_log
|
self.recharge_log = recharge_log
|
||||||
@ -40,15 +40,23 @@ class RechargeAccounting:
|
|||||||
'bill_date':self.curdate,
|
'bill_date':self.curdate,
|
||||||
'bill_timestamp':self.timestamp
|
'bill_timestamp':self.timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async def get_orgid_by_trans_role(self, sor, leg, role):
|
||||||
|
if role == 'owner':
|
||||||
|
return '0'
|
||||||
|
if role == 'customer':
|
||||||
|
return self.customerid
|
||||||
|
e = Exception(f'unknown role({role})')
|
||||||
|
exception(f'Exception:{e}')
|
||||||
|
raise e
|
||||||
|
|
||||||
async def accounting(self, sor):
|
async def accounting(self, sor):
|
||||||
self.sor = sor
|
self.sor = sor
|
||||||
bz_date = await get_business_date(sor=sor)
|
bz_date = await get_business_date(sor=sor)
|
||||||
if bz_date != self.curdate:
|
if bz_date != self.curdate:
|
||||||
raise AccountingDateNotInBusinessDate(self.curdate, bz_date)
|
raise AccountingDateNotInBusinessDate(self.curdate, bz_date)
|
||||||
|
|
||||||
ao = Accounting(self, "0", self.customerid)
|
ao = Accounting(self, self)
|
||||||
await self.write_bill(sor)
|
await self.write_bill(sor)
|
||||||
await ao.do_accounting(sor)
|
await ao.do_accounting(sor)
|
||||||
print(f'recharge ok for {self.bill}, {nodes=}')
|
print(f'recharge ok for {self.bill}, {nodes=}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user