OpenERP fields.function() explanation [duplicate]

£可爱£侵袭症+ 提交于 2019-12-18 16:48:05

问题


I got this code from stock.py file and line number 163

'complete_name': fields.function(_complete_name, type='char', size=256, string="Location Name",
                    store={'stock.location': (_get_sublocations, ['name', 'location_id'], 10)}),

please give me a explanation about below store attribute in above field.

can we use fields.function( with type='many2one' ? if can please give me a reference sample code or sample model class in openerp 7


回答1:


'store'=True will store the value of the field in database. Once stored then the functional fields function will not be executed again.

But if the value of 'store' is a dictionary then (key of the dictionary will be a model name and value will a tuple with list of ids, list of field name and 10-i dont know:-( ) any change/update in the model specified as the key of the dictionary and change/ update is in the ids specified in the tuple and change or update is in the field names specified in the list then the function of the functional field will be loaded and new data will be saved in database




回答2:


You can get information about fields.function from here:

  1. Function Field.
  2. Function Field Description.

You can find many examples in addons.

Hope this will help you.



来源:https://stackoverflow.com/questions/16185195/openerp-fields-function-explanation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!