Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
6275 Vues

<?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
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
5
janv. 19
4373
1
mars 17
5047
3
juin 16
8570
1
mars 16
21327
3
mai 24
14419