Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to override view of task' timesheets tab in project. Here are new module view.xml:

<record id="view_project_task_form_materials" model="ir.ui.view">
        <field name="name">project.task.form.materials</field>
        <field name="model">project.task</field>
        <field name="inherit_id" ref="view_sale_service_inherit_form2"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='timesheet_ids']/ancestor::page" position="after">
                <page name="materials_used" string="Materials" groups="project.group_tasks_work_on_tasks">
                    <field name="material_ids" groups="project.group_tasks_work_on_tasks">
                        <tree string="Materials used" editable="top">
                            <field name="product_id"/>
                            <field name="quantity"/>
                        </tree>
                    </field>
                </page>
            </xpath>
        </field>
    </record>

When I install the module, an error appears:

External ID not found in the system: project_task_materials.view_sale_service_inherit_form2" while parsing view.xml.

I know the inherited view ID is sale_timesheet.view_sale_service_inherit_form2. How to specify it in my XML file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
216 views
Welcome To Ask or Share your Answers For Others

1 Answer

in ref you need to specify the full xml id using the name of the addon that you inherit the view form

<record id="any_id_you_want" model="ir.ui.view">
    <field name="inherit_id" ref="modul_name.view_xmlid"/>
   ...
   ....
</record>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...