تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
10312 أدوات العرض

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



الصورة الرمزية
إهمال

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>

أفضل إجابة

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.

الصورة الرمزية
إهمال
الكاتب

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

الكاتب

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

<field name="employee_id"/>

</xpath>

</field>

</record>

الكاتب

amal get anything clue?

الكاتب

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مايو 17
4131
1
سبتمبر 22
2111
4
مايو 18
10946
0
مارس 23
4983
2
مارس 22
9463