【问题标题】:"Can't render view" Error while starting OpenERP 7启动 OpenERP 7 时出现“无法渲染视图”错误
【发布时间】:2014-02-17 15:13:50
【问题描述】:

我的生产数据库中出现以下错误,拒绝我的登录。我需要关于如何解决它的建议。

2014-02-15 22:42:24,733 18124 ERROR myDB openerp.addons.base.ir.ir_ui_view: Can't render view project_issue.view_project_form_inherited for model: project.project
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_ui_view.py", line 126, in _check_render_view
    fvg = self.pool.get(view.model).fields_view_get(cr, uid, view_id=view.id, view_type=view.type, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2239, in fields_view_get
    arch=apply_view_inheritance(cr, user, source, sql_res['id']),
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2197, in apply_view_inheritance
    source = apply_inheritance_specs(source, view_arch, view_id)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2181, in apply_inheritance_specs
    raise_view_error("Element '%s' not found in parent view '%%(parent_xml_id)s'" % tag, inherit_id)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2074, in raise_view_error
    %  (child_view.xml_id, self._name, error_msg))
AttributeError: View definition error for inherited view 'project_issue.view_project_form_inherited' on model 'project.project': Element '<xpath expr="//page[@name="project_stages"]">' not found in parent view 'project.edit_project'
2014-02-15 22:42:24,739 18124 ERROR myDB openerp.tools.convert: Parse error in /usr/lib/pymodules/python2.7/openerp/addons/project_issue/project_issue_view.xml:302: 
<record id="view_project_form_inherited" model="ir.ui.view">
            <field name="name">project.project.form.inherited</field>
            <field name="model">project.project</field>
            <field name="inherit_id" ref="project.edit_project"/>
            <field name="arch" type="xml">
                <data><xpath expr="//div[@name=&quot;options_active&quot;]" position="inside">
                    <field name="use_issues" class="oe_inline"/>
                    <label for="use_issues"/>
                </xpath>
                <xpath expr="//div[@name=&quot;buttons&quot;]" position="inside">
                    <button name="%(act_project_project_2_project_issue_all)d" string="Issues" type="action" attrs="{'invisible':[('use_issues','=', 0)]}"/>
                </xpath>
                <xpath expr="//page[@name=&quot;project_stages&quot;]" position="attributes">
                    <attribute name="attrs">{'invisible': [('use_tasks', '=', False),('use_issues','=',False)]}</attribute>
                </xpath>
                <field name="priority" position="before">
                    <field name="project_escalation_id"/>
                </field>
                <field name="alias_domain" position="after">
                    <label for="alias_model" class="oe_edit_only" string="creates"/><field name="alias_model" class="oe_edit_only oe_inline"/>
                </field>
            </data></field>
       </record>
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 847, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 814, in _tag_record
    id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_model.py", line 940, in _update
    model_obj.write(cr, uid, [res_id], values, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_ui_view.py", line 214, in write
    return super(view, self).write(cr, uid, ids, vals, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4209, in write
    self._validate(cr, user, ids, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 1548, in _validate
    raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')
2014-02-15 22:42:24,743 18124 ERROR myDB openerp.netsvc: ValidateError
Error occurred while validating the field(s) arch: Invalid XML for View Architecture!
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 433, in dispatch
    return fn(*params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 444, in exp_authenticate
    res_users = pooler.get_pool(db).get('res.users')
  File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 49, in get_pool
    return get_db_and_pool(db_name, force_demo, status, update_module)[1]
  File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 33, in get_db_and_pool
    registry = RegistryManager.get(db_name, force_demo, status, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 192, in get
    update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 218, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 350, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 256, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 188, in load_module_graph
    load_data(module_name, idref, mode)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 76, in <lambda>
    load_data = lambda *args: _load_data(cr, *args, kind='data')
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 124, in _load_data
    tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
  File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 954, in convert_xml_import
    obj.parse(doc.getroot())
  File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 847, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 814, in _tag_record
    id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_model.py", line 940, in _update
    model_obj.write(cr, uid, [res_id], values, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_ui_view.py", line 214, in write
    return super(view, self).write(cr, uid, ids, vals, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4209, in write
    self._validate(cr, user, ids, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 1548, in _validate
    raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')

【问题讨论】:

    标签: openerp openerp-7


    【解决方案1】:
    AttributeError: View definition error for inherited view 'project_issue.view_project_form_inherited' on model 'project.project': Element '<xpath expr="//page[@name="project_stages"]">' not found in parent view 'project.edit_project'
    

    你得到了你的错误信息。 “project_issue”模块似乎有问题。也许有些东西没有正确安装。因此,请尝试使用 --update=all 或 --update=project 来启动您的服务器,这可能会有所帮助。

    如果没有,请尝试在您的数据库中将提到的模块(project_issue 或/和项目)设置为卸载。您可以在 ir_module_module 列状态下执行此操作。希望您可以在此之后登录并进行更多搜索。

    您是否使用影响项目模块的自制模块?如果是这样,可能问题很大(用上面的方法卸载就行了)。

    【讨论】:

      【解决方案2】:

      您的代码似乎有错误。只需删除 &lt;data&gt; 标签,因为它放置在错误的位置。 你的视图应该是这样的。

       <record id="view_project_form_inherited" model="ir.ui.view">
              <field name="name">project.project.form.inherited</field>
              <field name="model">project.project</field>
              <field name="inherit_id" ref="project.edit_project"/>
              <field name="arch" type="xml">
                  <xpath expr="//div[@name='options_active']" position="inside">
                      <field name="use_issues" class="oe_inline"/>
                      <label for="use_issues"/>
                  </xpath>
                  <xpath expr="//div[@name='buttons']" position="inside">
                      <button name="%(act_project_project_2_project_issue_all)d" string="Issues" type="action" attrs="{'invisible':[('use_issues','=', 0)]}"/>
                  </xpath>
                  <xpath expr="//page[@name='project_stages']" position="attributes">
                      <attribute name="attrs">{'invisible': [('use_tasks', '=', False),('use_issues','=',False)]}</attribute>
                  </xpath>
                  <field name="priority" position="before">
                      <field name="project_escalation_id"/>
                  </field>
                  <field name="alias_domain" position="after">
                      <label for="alias_model" class="oe_edit_only" string="creates"/><field name="alias_model" class="oe_edit_only oe_inline"/>
                  </field>
              </field>
         </record>
      

      试试这个。并且不要忘记更新您的模块。希望这会对你有所帮助。

      【讨论】:

      • 我不认为这是他的观点,而是从模块 project_issue(OpenERP 附带),并且 data-tag 是好的。
      • 是的,我知道。在这里他已经在主模块project_issue中进行了更改,因为如果您在主project_issue_view.xml中看到,您将不会在定义的继承视图中找到标签,这是错误的。如果他将删除该标签并仅更新该模块,那么它也将起作用。在我的回答中 - 我说你的模块意味着,他所做的更改的模块,即 project_issue 本身。
      • 这正是我的系统上模块 project_issue 带来的 xml 内容,我从未接触过该模块。
      • 好吧,我给出的答案将解决他的问题,关于你所说的,检查插件的所有模块供你参考,甚至单个模块都不会包含 标记在 视图类型。检查您的修订,更新最新的。否则试试我说的,错误会解决的。
      • 查看代码时您是对的。只需安装模块并查看系统上的表单视图,您就会看到数据标签。我认为这是在安装中完成的。
      猜你喜欢
      • 1970-01-01
      • 2013-08-11
      • 2019-10-18
      • 1970-01-01
      • 2021-11-19
      • 2023-04-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多