Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

explanation of fields.property

By
vikram
on 12/10/13, 3:10 AM 3,255 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.

2
Max
On 2/26/14, 5:57 AM

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

0
Vaibhav
On 12/10/13, 6:07 AM

Hello Vikram,

Please refer below link :

click here

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

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

vikram
on 12/10/13, 8:56 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 12/10/13, 3:10 AM
Seen: 3255 times
Last updated: 3/16/15, 8:10 AM