Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
10343 Vizualizări

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



Imagine profil
Abandonează

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>

Cel mai bun răspuns

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.

Imagine profil
Abandonează
Autor

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">

Autor

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

<field name="employee_id"/>

</xpath>

</field>

</record>

Autor

amal get anything clue?

Autor

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"/>

Related Posts Răspunsuri Vizualizări Activitate
1
mai 17
4155
1
sept. 22
2126
4
mai 18
10996
0
mar. 23
5029
2
mar. 22
9501