读取XML数据文件时出现Odoo 8解析错误

时间:2016-06-01 07:07:43

标签: odoo-8

我正在尝试使用以下数据文件预设产品记录:

<openerp>
  <data>
    <record id="product_template_ovhssd3" model="product.template">
      <field name="name">OVH SSD 3</field>
      <field name="list_price">14.51</field>
      <field name="sale_ok">False</field>
      <field name="categ_id" ref="category_vps"/>
      <field name="type">consu</field>
    </record>
  </data>
</openerp>

这导致openerp日志文件中出现以下错误:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/openerp/service/server.py", line 291, in app
    return self.app(e, s)
  File "/usr/lib/python2.7/dist-packages/openerp/service/wsgi_server.py", line 216, in application
    return application_unproxied(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/openerp/service/wsgi_server.py", line 202, in application_unproxied
    result = handler(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1293, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1267, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1431, in dispatch
    ir_http = request.registry['ir.http']
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 349, in registry
    return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
  File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 339, in get
    update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 370, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 351, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 255, 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/python2.7/dist-packages/openerp/modules/loading.py", line 176, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 118, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 900, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 986, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 852, in parse
    self._tags[rec.tag](self.cr, rec, n, mode=mode)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 692, in _tag_record
    model = self.pool[rec_model]
  File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 102, in __getitem__
    return self.models[model_name]
ParseError: "product.template" while parsing /vagrant/infrastructure/data/product_template.xml:12, near
<record id="product_template_ovhssd3" model="product.template">
        <field name="name">OVH SSD 3</field>
        <field name="list_price">14.51</field>
        <field name="sale_ok">False</field>
        <field name="categ_id" ref="category_vps"/>
        <field name="type">consu</field>
    </record>

我的问题是:我做错了什么?我也试过model="product.product",差异很大。

1 个答案:

答案 0 :(得分:0)

确保在product的依赖列表中列出了__openerp__.py模块。