inheritance - OpenERP 7.0: Why does product.product inherit from product.template? -
what advantage gained having product.product
inherit product.template
instead of defining fields directly in product.product
?
_name = "product.product" _description = "product" _inherits = {'product.template': 'product_tmpl_id'}
when use technique in new code?
when using _inherits
kind of polymorphic model in database way.
for example product.product
inherits product.template
or res.users
inherits res.partner
. mean create model gets know how of model
adds aditional data/columns in new database table. when create user, partner data stored in res_partner
table (and partner created) , user related info stored in res_users
table.
to use dict: _inherits = {'res.partner': 'partner_id'}
key corresponds base model , value foreign key base model.
from here can mix inheritance if dare...
here links:
https://doc.openerp.com/v6.0/developer/2_5_objects_fields_methods/object_inherits/
hope helps.
Comments
Post a Comment