Odoo Help


Explain fields.property()

on 7/16/13, 8:12 AM 14,376 views


I can't find documentation on fields.property() type of fields. How do they work?

As an example: In OpenERP 7, /addons/stock/product.py, starting from line 484 there are property() fields declared:

class product_template(osv.osv):
   _name = 'product.template'
   _inherit = 'product.template'
   _columns = {
       'property_stock_procurement': fields.property(
        string="Procurement Location",
        help="This stock location will be used, instead of the default one, as the source location for stock moves generated by procurements."),
    'property_stock_production': fields.property(
        string="Production Location",
        help="This stock location will be used, instead of the default one, as the source location for stock moves generated by manufacturing orders."),

In particular, the above declared field 'property_stock_production' does not appear to be in database tables even after 'stock' module installation (checked with Pgadmin). Please explain the purpose and nature of fields.property()

On 7/17/13, 1:29 AM

Fairly decent explanation here: https://doc.openerp.com/trunk/server/03_module_dev_02/#property-fields

In particular:

"The fields.property class inherits from fields.function and overrides the read and write method. The type of this field is many2one, so in the form a property is represented like a many2one function. But the value of a property is stored in the ir.property class/table as a complete record. The stored value is a field of type reference (not many2one) because each property may point to a different object. "


"A property is a concept that is attached to an object and has special features:

  • Different value for the same property depending on the company

  • Rights management per field

  • It's a link between resources (many2one)

So yes, it won't show in the database 'stock' table, but it will be in the ir_property table. This allows for different properties for the same object depending on the users current company.

Hope that helps a bit :)

On 3/27/15, 1:01 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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 7/16/13, 8:12 AM
Seen: 14376 times
Last updated: 7/28/16, 8:08 AM