For example class res.partner
. I want res.partner
to inherit class A
. How do I do that?
I don't think this will work:
class custom_res_partner(osv.osv):
_name = "res.partner"
_inherit = "A"
custom_res_partner()
class custom_res_partner(osv.osv):
_name = "custom.res.partner" # New Model will be created
_inherit = "A" # Base class
custom_res_partner()
It will create new model(table) which have all the properties of it's base class according to inheritance rules. Don't use the res.partner because this model is already there.
# odoo-8
from openerp import fields, models, api, _
class res_partner(models.Model):
_inherit = "A"
EDIT:
(This is for odoo version 8)
Create a new module and inherit the model A
in a python file in the module.
For creating a new module, refer to Build an Odoo module
If model is already present and you want it to inherit another model, it should be done like this:
_name
part is important here, with it Odoo knows which model inherits from which. in_inherit
you also need to specifyres.partner
, because you are extending this model.