Odoo Help

0

try to make this xpath work, get error

By
wizardz
on 6/9/16, 8:09 AM 833 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.

3

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.


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/9/16, 8:09 AM
Seen: 833 times
Last updated: 6/10/16, 2:38 AM