【问题标题】:OpenERP / Odoo Unexpected View Parsing errorOpenERP / Odoo 意外视图解析错误
【发布时间】:2014-11-04 10:17:17
【问题描述】:

大家好,

我刚刚从 OpenERP 6.1 更新到 Odoo8。 我有一个自己编写的模块,我调整了 Python 代码,一切似乎都很好,我也可以安装模块,但是如果我加载视图,我会收到以下错误:

  File "./openerp/models.py", line 1295, in _validate_fields
raise ValidationError('\n'.join(errors))
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition

Error details:
     Element '<xpath expr="//footer">' cannot be located in parent view

Error context:
    View `mail.compose.message.form`
[view_id: 248, xml_id: email_template.email_compose_message_wizard_inherit_form, model:     mail.compose.message, parent_id: 216]" while parsing /home/gsatter/Dokumente    /odoo/odoo/seekda_addons/seekda_mail_extension/wizard/mail_compose_view.xml:4, near

<record model="ir.ui.view" id="mail.email_compose_message_wizard_form">
        <field name="name">mail.compose.message.form</field>
        <field name="model">mail.compose.message</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Compose Email">
                <group col="6" colspan="4">
                    <field name="model" invisible="1"/>
                    <field name="res_id" invisible="1"/>
                    <field name="email_from" colspan="4" required="1"/>
                    <field name="email_to" colspan="4" required="1"/>
                    <field name="email_cc" colspan="4"/>
                    <field name="email_bcc" colspan="4"/>
                    <field name="reply_to" colspan="4"/>
                    <field name="subject" colspan="4" widget="char" size="512"/>
                    <field name="references" invisible="1"/>
                    <field name="message_id" invisible="1"/>
                </group>
                <notebook colspan="4">
                    <page string="Body">
                        <field name="body_text" colspan="4" nolabel="1" height="300" width="300"/>
                    </page>
                    <page string="Attachments">
                        <field name="attachment_file_ids" colspan="4" nolabel="1" string="Files">
                            <form>
                                <field name="data" filename="name" colspan="4"/>
                                <field name="name" colspan="4"/>
                            </form>
                            <tree>
                                <field name="data" filename="name" colspan="4"/>
                                <field name="name" colspan="4"/>
                            </tree>
                        </field>
                    </page>
                </notebook>
                <group col="4" colspan="4">
                    <label string="" name="placeholder" colspan="1"/>
                    <button icon="gtk-close" special="cancel" string="Cancel"/>
                    <button icon="gtk-ok" name="send_mail" string="Send" type="object"/>
                </group>
            </form>
        </field>
    </record>

有人知道这个向导有什么问题吗? 这是我的观点(向导):

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <record model="ir.ui.view" id="mail.email_compose_message_wizard_form">
        <field name="name">mail.compose.message.form</field>
        <field name="model">mail.compose.message</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Compose Email">
                <group col="6" colspan="4">
                    <field name="model" invisible="1"/>
                    <field name="res_id" invisible="1"/>
                    <field name="email_from" colspan="4" required="1"/>
                    <field name="email_to" colspan="4" required="1"/>
                    <field name="email_cc" colspan="4"/>
                    <field name="email_bcc" colspan="4"/>
                    <field name="reply_to" colspan="4"/>
                    <field name="subject" colspan="4" widget="char" size="512"/>
                    <field name="references" invisible="1"/>
                    <field name="message_id" invisible="1"/>
                </group>
                <notebook colspan="4">
                    <page string="Body">
                        <field name="body_text" colspan="4" nolabel="1" height="300" width="300"/>
                    </page>
                    <page string="Attachments">
                        <field name="attachment_file_ids" colspan="4" nolabel="1" string="Files">
                            <form>
                                <field name="data" filename="name" colspan="4"/>
                                <field name="name" colspan="4"/>
                            </form>
                            <tree>
                                <field name="data" filename="name" colspan="4"/>
                                <field name="name" colspan="4"/>
                            </tree>
                        </field>
                    </page>
                </notebook>
                <group col="4" colspan="4">
                    <label string="" name="placeholder" colspan="1"/>
                    <button icon="gtk-close" special="cancel" string="Cancel"/>
                    <button icon="gtk-ok" name="send_mail" string="Send" type="object"/>
                </group>
            </form>
        </field>
    </record>
</data>

她是一个继承视图顶部的视图(它位于插件 email_template 中):

  <?xml version="1.0" encoding="utf-8"?>
    <openerp>
      <data>

    <record model="ir.ui.view" id="email_compose_message_wizard_inherit_form">
        <field name="name">mail.compose.message.form</field>
        <field name="model">mail.compose.message</field>
        <field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
        <field name="groups_id" eval="[(4,ref('base.group_user'))]"/>
        <field name="arch" type="xml">
            <xpath expr="//footer" position="inside">
                <group class="oe_right oe_form" col="1">
                    <div>Use template
                        <!--FIX: To avoid css issue of many2one field in footer temporary used oe_form (BUG:1152464)-->
                        <field name="template_id" nolabel="1" class='oe_inline'
                            options="{'no_create': True}"
                            on_change="onchange_template_id(template_id, composition_mode, model, res_id, context)" domain="[('model_id.model','=',model)]"
                            context="{'default_model': model, 'default_body_html': body, 'default_subject': subject}"/>
                    </div>
                    <button icon="/email_template/static/src/img/email_template_save.png"
                        type="object" name="save_as_template" string="Save as new template" class="oe_link"
                        help="Save as a new template"/>
                </group>
            </xpath>
        </field>
    </record>

</data>

谢谢

【问题讨论】:

  • 请您提供您的视图 xml 吗?
  • 对不起,我添加了 XML 代码。
  • 问题是,footer 标签在parent 视图中不存在。我试图在您的视图中找到该标签。但找不到:(。请您发布您想要继承的原始视图吗?
  • 奇怪的是,巫师没有继承任何观点。我添加了另一个继承视图顶部的视图

标签: python view openerp odoo


【解决方案1】:

问题是

...
...
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
...
...
    <xpath expr="//footer" position="inside">
    ...
    ...

您上面的视图继承mail.email_compose_message_wizard_form 视图。在您看来,您提到&lt;xpath expr="//footer" position="inside"&gt; 在父视图的footer 选项卡中添加以下代码。但是父视图没有footer标签并且它给出错误Element '&lt;xpath expr="//footer"&gt;' cannot be located in parent view

你可以试试

<xpath expr="//notebook" position="inside">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-24
    • 1970-01-01
    • 2014-09-08
    • 1970-01-01
    相关资源
    最近更新 更多