Hi all, currently I encounter a weird situation --- If I change a record id, It shows me some error and the error part is not related at all. Here is the details.
Following code works fine.
XML file
<record id="expense_new_view_tree" model="ir.ui.view">
<field name="name">expense_new.expense_new.view.tree</field>
<field name="model">expense_new.expense_new</field>
<field name="inherit_id" ref="hr_expense.view_expenses_tree"/>
<field name="arch" type="xml">
...
<xpath expr="//field[@name='total_amount']" position="replace">
</xpath>
</field>
</record>
<record id="expense_new_view_form" model="ir.ui.view">
<field name="name">expense_new.expense_new.view.form</field>
<field name="model">expense_new.expense_new</field>
<field name="inherit_id" ref="hr_expense.hr_expense_form_view"/>
<field name="arch" type="xml">
...
<xpath expr="/form/sheet/group/group[1]" position="replace"/>
<xpath expr="/form/sheet/group/group[2]" position="replace"/>
<xpath expr="//field[@name='reference']" position="replace"/>
</field>
</record>
<menuitem id="expense_new_menu_root" name="Expense_new module"/>
<record id="expense_new_action_submit_expense" model="ir.actions.act_window">
<field name="name">My Expenses to Submit ("draft" expenses))</field>
<field name="res_model">expense_new.expense_new</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('employee_id.user_id', '=', uid),('state', '=', 'draft')]</field>
</record>
<menuitem id="expense_new_menu_submit_expense" name="No.1" parent="expense_new.expense_new_menu_root" action="expense_new_action_submit_expense"/>
I believe this is not about PY file.
Issue details: if I change id = "expense_new_view_tree" to id = "view_expenses_tree_inherit_expense_new", then Odoo gives me error says that "total_amount" not found in parent view. So if I comment that part of code out. then It shows that group[2] not found in parent view. But If I change id back, everything works.
Can anyone explain what is going on in my code? Is it about inheritance? I have checked database "ir_ui_view", but I can't find any clue. Please help me out! Thx a lot!
Try deleting expense_new_view_tree view from database and redefine it to view_expenses_tree_inherit_expense_new and do module update
Thx, It works for me! you can write a answer so I can up-vote it. BTW, Do you know why tho? Sometimes it happens? just bad luck or I should write any code for it?