bugfix
This commit is contained in:
parent
3fa05fdd97
commit
70c609f8c2
@ -174,11 +174,29 @@ class PricingProgram:
|
|||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
fs = FileStorage()
|
fs = FileStorage()
|
||||||
fp = fs.realPath(webpath_xlsx)
|
fp = fs.realPath(webpath_xlsx)
|
||||||
d = load_xlsx_pricing(fp)
|
pricings = load_xlsx_pricing(fp)
|
||||||
async with get_sor_context(env, 'pricing') as sor:
|
async with get_sor_context(env, 'pricing') as sor:
|
||||||
ppts = await sor.R('pricing_program_timing', {'id': pptid})
|
ppts = await sor.R('pricing_program_timing', {'id': pptid})
|
||||||
if ppts:
|
if ppts:
|
||||||
ppt = ppts[0]
|
ppt = ppts[0]
|
||||||
|
pps = await sor.R('pricing_program', {'id': ppt.ppid})
|
||||||
|
if not pps:
|
||||||
|
e = f'pricing_program({pptid}) can not find pricing_program'
|
||||||
|
exception(f)
|
||||||
|
pp = pps[0]
|
||||||
|
fields = DictObject(**yaml.safe_load(pp.pricing_spec))
|
||||||
|
newpricings = []
|
||||||
|
for p in pricings:
|
||||||
|
np = {}
|
||||||
|
for k,v in p.items():
|
||||||
|
for fk, fv in fields.items():
|
||||||
|
if k == fv.label:
|
||||||
|
np.update({fk:v})
|
||||||
|
newpricings.append(np)
|
||||||
|
d = {
|
||||||
|
'fields': fields,
|
||||||
|
'pricings': newpricings
|
||||||
|
}
|
||||||
ppt.pricing_data = yaml.dump(d)
|
ppt.pricing_data = yaml.dump(d)
|
||||||
await sor.U('pricing_program_timing', {
|
await sor.U('pricing_program_timing', {
|
||||||
'id': ppt.id,
|
'id': ppt.id,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user