This question has been flagged

Hello, I am really confused about the ir.property table in OpenERP 7. I dont understand why it is used or needed. All the records on that table have a many2one type, and then have different fields which relates two objects together. If all this table does is relate two objects together, then why not create a many2one field on a child object? Why use the ir.property table to establish the relationship?

Avatar
Discard
Best Answer

Using properties or normal fields:

When you want to add a new feature, you will have to choose to implement it as a property or as normal field.

  • Use a normal field when you inherit from an object and want to extend this object.

  • Use a property when the new feature is not related to the object but to an external concept.

Here are a few tips to help you choose between a normal field or a property:

Normal fields extend the object, adding more features or data.

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

  • Different value for the same property depending on the company

  • Rights management per field

  • It's a link between resources (many2one)


The default "Account Receivable" for a specific partner is implemented as a property because:

  • This is a concept related to the account chart and not to the partner, so it is an account property that is visible on a partner form. Rights have to be managed on this fields for accountants, these are not the same rights that are applied to partner objects. So you have specific rights just for this field of the partner form: only accountants may change the account receivable of a partner.
  • This is a multi-company field: the same partner may have different account receivable values depending on the company the user belongs to. In a multi-company system, there is one account chart per company. The account receivable of a partner depends on the company it placed the sale order.
  • The default account receivable is the same for all partners and is configured from the general property menu (in administration).

An example product expiry module (implements all delays related to products: removal date, product usetime) is implemented as simple fields on the product.product object because:

  • It extends a product, the life_time field is a concept related to a product, not to another object.

  • There is no need for rights management per field, the information is managed by the same people that manage products.


Source: https://doc.openerp.com/trunk/server/03_module_dev_02/

Avatar
Discard