Odoo 10 view inherit error:

醉酒当歌 提交于 2019-12-25 09:07:03

问题


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?


回答1:


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>



回答2:


Like this:

<field name="inherit_id" ref="sale_timesheet.view_sale_service_inherit_form2"/>

also make sure on your __manifest__.py file you are depending on sale_timesheet

Best regards



来源:https://stackoverflow.com/questions/43346274/odoo-10-view-inherit-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!