This question has been flagged
2 Replies
11785 Views

I am new in openerp so just wanted to know the use of fields.property and a clean way or steps to implement that. I had gonw through some of the modules like stock but I couldnt grasp it. Please help.

Avatar
Discard
Best Answer

When should I use it?

fields.property is used to set a default value per company for a field. A property field can take almost any field type so it is able to replace normal fields in most situations.

You can also specify group access permissions for a property field to restrict who is able to change the value.

How does it work?

When it is defined, you specify the type of data it will contain and if appropriate, a relational object and domain etc. You can also define an XML file which lets you specify the default value.

From a technical point of view, a fields.property field works like a many2one field towards the ir.property model. The ir.property model has an optional res_id column that references a model and record ID. The res_id can be left blank to act as a default value, or can reference a model and record ID to provide a value for a specific record.

When OpenERP imports the XML file containing the default value for a field, it creates a record in the ir_property table with res_id empty. When the user changes the value of a field for a record from the default value, a new row will be created in ir.property with the res_id set to that record and the value set to the value entered by the user.

When reading the fields.property field F of record R, OpenERP will first check to see if a row exists in ir_property with the res_id set to R and return the value. Otherwise, it will look to see if an ir_property row exists for field F where res_id is not specified, and will return the value.

More information and Implementation Examples:

For more information on implementation, see this link:

https://doc.openerp.com/trunk/server/03_module_dev_02/#property-fields

Avatar
Discard
Best Answer

Hello Vikram,

Please refer below link :

click here

I think on this link, you will get proper explanation. :)

Avatar
Discard
Author

Hie dude....I have gone through dat before but still doesnt understand.....