請教osv_memory wizard中的return值問題
-
小弟上次經mrshelly大指點 採用新的osv_memory wizard 編寫程式
遇到一個問題 就是執行onchange_product_id Function時 return 值能改變頁面上顯示資料
但是執行count_inv Function時 return 值卻無法改變頁面上顯示資料
請問是我哪裡漏失了? 請大大指教 Thanks
附件為可執行之osv_memory wizard
def onchange_product_id(self, cr, uid, ids, product_id,IDX):
if product_id!='False':
PT_ID="0"
cr.execute("""select product_tmpl_id from product_product where id='"""+str(product_id)+"""'""")
resT = cr.fetchall()
for rowT in resT:
PT_ID=str(rowT[0])
list_price="0"
standard_price="0"
cr.execute('select list_price,standard_price from product_template where id='+PT_ID)
resPR = cr.fetchall()
for rowPR in resPR:
list_price=str(rowPR[0])
standard_price=str(rowPR[1])
val = {
'price_unit_sale'+str(IDX): list_price,
'price_unit_purchase'+str(IDX): standard_price
}
return {'value': val}
def count_inv(self, cr, uid, ids, context=None):
x=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
record = self.read(cr, uid, ids, [])
record = record and record[0]
inv_total_qty=0
inv_total_amount=0
for n in x:
product_name=str(record[('product_name'+str(n))])
if product_name!='False':
product_qty=str(record[('product_qty'+str(n))])
price_unit_purchase=str(record[('price_unit_purchase'+str(n))])
f_purchase_subamount=float(product_qty)*float(price_unit_purchase)
inv_total_qty=inv_total_qty+int(product_qty)
inv_total_amount=inv_total_amount+f_purchase_subamount
A=inv_total_qty
B=inv_total_amount
val = {
'inv_total_qty1' : inv_total_qty,
'inv_total_amount1' : inv_total_amount
}
return {'value': val}