Hi all, I'm getting little bit confused on how to do inheritance.
The case is that I want inheritance model "exist_A" and use it on model "new_B", of course, I want add some new field in new_B. In terms of database, I would like store them into model new_B. In another words, without affecting exist_A database. Is there any way to achieve this?
What I have tried is following:
PY file:
Class new_B(models.Model):
# _name = new_B # if I define "_name", it shows that field "new_cloumn" not in " exist_A "
_inherit = 'exist_A' # also I tried _inherits = { 'hr.expense':'id' }, but not sure this is the case I should use "_inherits"
new_cloumn = fields.Char()
XML file:
<record id="tree_view_inherit_new_B" model="ir.ui.view">
<field name="name"> tree.view.inherit.new_B </field>
<field name="model">exist_A</field>
<field name="inherit_id" ref=" exist_A.tree_view"/>
<field name="mode">primary</field> <!-- other similar question's solution, but it is not working for me -->
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="new_cloumn"/>
</xpath>
</field>
</record>
Any help will be appreciated! Thanks!