Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
10325 Weergaven

My program

class ProjectTask(models.Model):

    _inherit = "project.task"

class AccountAnalyticLine(models.Model):

    _inherit = 'account.analytic.line'

     employee_id = fields.Many2one('hr.employee', string="Employee")

xml

<xpath expr="//page/field[@name='timesheet_ids']/tree/field[@name='user_id']" position="after">

                        <field name="employee_id"/>  

 </xpath>

Notes

I inherited the view and add the above but I get an error external id not found.Please help me how to solve this issue. Thanks in advance



Avatar
Annuleer

The field you are trying to change is not in viewtaskform2

please try this :

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

<field name="name">employee taks form</field>

<field name="model">project.task</field>

<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited"/>

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

<xpath expr="//notebook/page/field[@name='timesheet_ids']/tree/field[@name='user_id']" position="after">

<field name="employee_id"/>

</xpath>

</field>

</record>

Beste antwoord

hello,

here is an example to add a field to sale order line :

py file

_inherit = 'sale.order.line'

my_field = fields.Many2one('some.class', string="Any Name")


xml file

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

            <field name="name">my.name</field>

            <field name="model">sale.order</field>

            <field name="inherit_id" ref="sale.view_order_form"/>

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

                <xpath expr="//notebook/page/field[@name='order_line']/tree/field[@name='product_uom_qty']" position="after">

                    <field name="my_field"/>

                </xpath>

            </field>

        </record>

Hope this helps.If you need more help, please post your code.

Avatar
Annuleer
Auteur

Thanks amal. But I use my code like this.But I didn't get.Here is xml code

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

<field name="name">employee taks form</field>

<field name="model">project.task</field>

<field name="inherit_id" ref="project.view_task_form2"/>

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

Auteur

<xpath expr="//notebook/page/field[@name='timesheet_ids']/tree/field[@name='user_id']" position="after">

<field name="employee_id"/>

</xpath>

</field>

</record>

Auteur

amal get anything clue?

Auteur

Thanks amal this is my mistake.my view id is wrong.The one2many is inherited.so I didn't notice that.this is corroct id

<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited"/>

Gerelateerde posts Antwoorden Weergaven Activiteit
1
mei 17
4141
1
sep. 22
2117
4
mei 18
10959
0
mrt. 23
5004
2
mrt. 22
9473