Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenERP fields.function() explanation [duplicate]

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

like image 775
Priyan RockZ Avatar asked Apr 24 '13 06:04

Priyan RockZ


2 Answers

'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

like image 182
OmaL Avatar answered Oct 22 '22 11:10

OmaL


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.

like image 22
Sudhir Arya Avatar answered Oct 22 '22 13:10

Sudhir Arya