首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >元素'<xpath expr="//field[@name=&#39;date_due&#39;]">‘不能位于父视图中

元素'<xpath expr="//field[@name=&#39;date_due&#39;]">‘不能位于父视图中
EN

Stack Overflow用户
提问于 2022-04-28 16:03:03
回答 1查看 404关注 0票数 0

我正在升级一个模块,允许从客户/供应商发票中挑选股票。这是一个下载的模块,用于网络11社区,我正在执行一次升级,以供网络15-企业使用。不幸的是,我总是在下面看到错误:

代码语言:javascript
复制
Traceback (most recent call last):
  File "C:\Program Files\odoo-14\server\odoo\http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "C:\Program Files\odoo-14\server\odoo\http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing file:/c:/program%20files/odoo-14/server/odoo/addons/invoice_stock_move/views/invoice_stock_move_view.xml:4
Error while validating view:

Element '<xpath expr="//field[@name=&#39;date_due&#39;]">' cannot be located in parent view

View error context:
{'file': 'c:\\program '
         'files\\odoo-14\\server\\odoo\\addons\\invoice_stock_move\\views\\invoice_stock_move_view.xml',
 'line': 2,
 'name': 'Move Name',
 'view': ir.ui.view(1053,),
 'view.model': 'account.move',
 'view.parent': ir.ui.view(545,),
 'xmlid': 'customer_invoice_stock_move_view'}

这是我的视图文件

代码语言:javascript
复制
<odoo>
    <data>
        <record id="customer_invoice_stock_move_view" model="ir.ui.view">
        <field name="name">Move Name</field>
        <field name="model">account.move</field>
        <field name="inherit_id" ref="account.view_move_form"/>
        <field name="arch" type="xml">
            <xpath expr="//header" position="inside">
                <button name="action_stock_transfer" string="Transfer" type="object"  class="oe_highlight"
                     attrs="{'invisible':[('origin', '!=', False)]}"/>
            </xpath>
            <xpath expr="//field[@name='date_due']" position="after">
                <field name="picking_transfer_id"/>
                <field name="invoice_picking_id" invisible="1"/>
            </xpath>
            <xpath expr="//field[@name='number']" position="before">
                <div class="oe_button_box" name="button_box">
                    <button type="object"
                        name="action_view_picking" states="open,paid"
                        class="oe_stat_button" attrs="{'invisible':[('origin', '!=', False)]}"
                        icon="fa-truck">
                        <field name="picking_count"  string="Shipment" widget="statinfo"/>
                    </button>
                </div>
            </xpath>
        </field>
        </record>

        <record id="supplier_invoice_stock_move_view" model="ir.ui.view">
            <field name="name">Move Name</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_move_form"/>
            <field name="arch" type="xml">
                <xpath expr="//header" position="inside">
                    <button name="action_stock_receive" string="Receive"  class="oe_highlight"
                            type="object"  attrs="{'invisible':[('origin', '!=', False)]}"/>
                </xpath>
                <xpath expr="//field[@name='date_due']" position="after">
                    <field name="picking_type_id"/>
                    <field name="invoice_picking_id" invisible="1"/>
                </xpath>
                <xpath expr="//field[@name='number']" position="before">
                    <div class="oe_button_box" name="button_box">
                        <button type="object"
                            name="action_view_picking"
                            class="oe_stat_button" attrs="{'invisible':[('origin', '!=', False)]}"
                            icon="fa-truck">
                            <field name="picking_count"  string="Shipment" widget="statinfo"/>
                        </button>
                    </div>
                </xpath>
            </field>
        </record>
  </data>
</odoo> 

有人能帮我指出正确的方向吗。

EN

回答 1

Stack Overflow用户

发布于 2022-04-28 17:21:42

在后台:主仪表板>设置>技术设置>视图,以访问父视图:将自定义视图URL中的id替换为id : 545,这是parent_view的id,如错误消息'view.parent':ir.ui.view(545,)中所述

你的网址应该和这个类似:

yourdomain.com /web?#id=545&action=28&model=ir.ui.view&view_type=form

并查证:

(id=545)

  • whether父视图中是否存在date_due字段date_due字段位于作用域

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72046903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档