2013-04-18 23 views
0

我的要求是這樣的 當我添加工人在選擇工人樹視圖,然後需要添加他們總的右側底部總工人field.its確定其展示當我要保存或當我點擊(更新)按鈕。 我指的是購買模塊,但我找不到什麼功能exaclty點擊該按鈕時調用。如何通過按鈕獲得總工人?

我的整個代碼上傳到[email protected] 在bpl.py

指在bpl_view.xml和線335線397按購買模塊我寫function.but其只返回statement.thats也困惑了我。

def button_total(self, cr, uid, ids, context=None): 
    return True 

請諮詢我在這個問題上&爲什麼當單擊該按鈕保存記錄已經automatically.?its僅返回True聲明,請告訴我。 ? ?

screen

回答

1

寫這樣的代碼:

def button_total(self, cr, uid, ids, context=None): 
    tea_worker_line_ids = self.browse(cr, uid, ids[0], context=context).selected_tea_workers_line_ids or [] 
    total_tea_worker = len(tea_worker_line_ids) 
    self.write(cr, uid, ids, {'total_workers': total_tea_worker}, context=context) 
    return True 
+0

wow..its工作阿里亞 感謝 –