OpenERP fields.function() explanation [duplicate]

2019-02-10 06:44发布

This question already has an answer here:

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

2条回答
走好不送
2楼-- · 2019-02-10 07:23

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.

查看更多
孤傲高冷的网名
3楼-- · 2019-02-10 07:37

'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

查看更多
登录 后发表回答