在我的OpenERP應用程序,我有我試圖理解一個lambda(currency_id):分解一個OpenERP的拉姆達
_defaults = {
'display_type': True,
'journal_ids': [],
'target_move': False,
'currency_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
}
到目前爲止,我的理解是這樣做的:
- 啓動與表res_users,其具有COMPANY_ID字段
- 使用瀏覽命令訪問交流onnected記錄
的瀏覽函數具有的原型:瀏覽(CR,UID,IDS,上下文=無)。我們通過uid作爲ID。 爲什麼我們要通過uid而不是id?
的res_company表具有currency_id場。
然後我假設它使用外鍵通過OpenERP的ORM訪問它。 怎樣的ORM知道如何連接到** res_company場**
類似問題 what is the reason of using _defaults and lambda in python for openerp development?
感謝您的明確答覆。 – ardochhigh