bugfix
This commit is contained in:
parent
8cb9c690ad
commit
fb9c91839a
@ -5,7 +5,14 @@
|
|||||||
"sortby": "name",
|
"sortby": "name",
|
||||||
"browserfields": {
|
"browserfields": {
|
||||||
"exclouded": ["id", "ppid"],
|
"exclouded": ["id", "ppid"],
|
||||||
"alters": {}
|
"alters": {
|
||||||
|
"psid":{
|
||||||
|
"dataurl":"{{entire_url('../pi_get_all_specs.dspy')}}",
|
||||||
|
"params": {
|
||||||
|
"ppid":"{{params_kw.ppid}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"editexclouded": [
|
"editexclouded": [
|
||||||
"id", "ppid"
|
"id", "ppid"
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
from pricing.pricing import pricing_program_charging
|
from pricing.pricing import pricing_program_charging, get_pricing_specs_by_ppid
|
||||||
from ahserver.serverenv import ServerEnv
|
from ahserver.serverenv import ServerEnv
|
||||||
|
|
||||||
def load_pricing():
|
def load_pricing():
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
env.pricing_program_charging = pricing_program_charging
|
env.pricing_program_charging = pricing_program_charging
|
||||||
|
env.get_pricing_specs_by_ppid = get_pricing_specs_by_ppid
|
||||||
|
|||||||
@ -23,13 +23,26 @@ class PricingProgram:
|
|||||||
recs = await self.sor.R('pricing_item', {'ppid': self.id})
|
recs = await self.sor.R('pricing_item', {'ppid': self.id})
|
||||||
return recs
|
return recs
|
||||||
|
|
||||||
async def get_spec(self, psid):
|
async def get_specs(self):
|
||||||
debug(f'psid={psid}')
|
recs = await self.sor.R('pricing_spec', {'ptid': self.psid})
|
||||||
|
return recs
|
||||||
|
|
||||||
|
asyn def get_spec_by_id(self, psid):
|
||||||
recs = await self.sor.R('pricing_spec', {'id': psid})
|
recs = await self.sor.R('pricing_spec', {'id': psid})
|
||||||
if len(recs) > 0:
|
if len(recs) > 0:
|
||||||
return recs[0]
|
return recs[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
async def get_pricing_specs_by_ppid(ppid):
|
||||||
|
env = ServerEnv()
|
||||||
|
dbname = env.get_module_dbname('pricing')
|
||||||
|
db = DBPools()
|
||||||
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
pp = PricingProgram(ppid, sor)
|
||||||
|
await pp.init()
|
||||||
|
return await pp.get_specs()
|
||||||
|
return []
|
||||||
|
|
||||||
async def get_remote_pricing(sor, charge, data):
|
async def get_remote_pricing(sor, charge, data):
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
get_callerid = env.get_callerid
|
get_callerid = env.get_callerid
|
||||||
@ -47,7 +60,7 @@ async def pricing_program_charging(sor, pricing_program_id, data):
|
|||||||
charges = []
|
charges = []
|
||||||
for item in pp_items:
|
for item in pp_items:
|
||||||
charge = item.copy()
|
charge = item.copy()
|
||||||
spec = await pp.get_spec(item.psid)
|
spec = await pp.get_spec_by_psid(charge.psid)
|
||||||
d = data.get(spec.spec_name)
|
d = data.get(spec.spec_name)
|
||||||
if d is None:
|
if d is None:
|
||||||
continue
|
continue
|
||||||
|
|||||||
1
wwwroot/pi_get_all_specs.dspy
Normal file
1
wwwroot/pi_get_all_specs.dspy
Normal file
@ -0,0 +1 @@
|
|||||||
|
return await get_pricing_specs_by_ppid(params_kw.ppid)
|
||||||
Loading…
x
Reference in New Issue
Block a user