This question has been flagged
1 Reply
5725 Views

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<record id="hr_timesheet_sheet_tree_leistungserfassung" model="ir.ui.view">

<field name="name">hr.leistungserfassung.tree</field>

<field name="model">hr_timesheet_sheet.sheet</field>

<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_tree_simplified"/>

<field name="arch" type="xml">

<!--<xpath expr="//field[@name='date_to']" position="after">-->

<xpath expr="//form/sheet/group/group/field[@name='date_to']" position="after">

<field name="testfield" widget="float_time" string="testfield"/>

<field name="testfield2" widget="float_time" string="testfield2"/>

</xpath>

</field>

</record>

</data>

</openerp>


what is wrong here? I want to put those 2 fields after the date_to field.

this xpath thing is not working never.

Avatar
Discard
Best Answer

Hello, 

external ID / XML ID """hr_timesheet_sheet_tree_simplified""" is define tree view inside default Odoo module "hr_timesheet_sheet". And you are trying to search element inside "form" thats why you can not get any result for you xpath.


Please make proper inheritance inside your view and then use proper xpath, it works well. You have to make your view as like below.

<record id="hr_timesheet_sheet_tree_leistungserfassung" model="ir.ui.view">
<field name="name">hr.leistungserfassung.tree</field>
<field name="model">hr_timesheet_sheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet/group/group/field[@name='date_to']" position="after">
<field name="testfield" widget="float_time" string="testfield"/>
<field name="testfield2" widget="float_time" string="testfield2"/>
</xpath>
</field>
</record>


Above view inheritance is working well. Please try it inside your Odoo.


Avatar
Discard