我如何在 OpenERP 或 Odoo 中解决此错误消息?
How can i solve this error message in OpenERP or Odoo?
如何解决OpenERP或Odoo中的这个错误?
我正在尝试为自定义模块创建自己的演示数据,但我不知道该怎么做。
我正在使用 Odoo 12,模块是 account.invoices
Error: Odoo Server Error Traceback (most recent call last): File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 656, in
_handle_exception
return super(JsonRequest, self)._handle_exception(exception) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 314, in
_handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/home/ubuntu/OdooAddons/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 346, in
_call_function
return checked_call(self.db, *args, **kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 941, in __call__
return self.method(*args, **kw) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw) File "/home/ubuntu/OdooAddons/odoo/addons/web/controllers/main.py", line 967, in call_button
action = self._call_kw(model, method, args, {}) File "/home/ubuntu/OdooAddons/odoo/addons/web/controllers/main.py", line 955, in _call_kw
return call_kw(request.env[model], method, args, kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/api.py", line 759, in call_kw
return _call_kw_multi(method, model, args, kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/api.py", line 746, in
_call_kw_multi
result = method(recs, *args, **kwargs) File "<decorator-gen-67>", line 2, in button_immediate_upgrade File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 627, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade) File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 561, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 417, in load_modules
force, status, report, loaded_modules, update_module, models_to_check) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) File "/home/ubuntu/OdooAddons/odoo/odoo/tools/convert.py", line 802, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/ubuntu/OdooAddons/odoo/odoo/tools/convert.py", line 852, in convert_xml_import
relaxng.assert_(doc) File "src/lxml/etree.pyx", line 3542, in lxml.etree._Validator.assert_ AssertionError: Element odoo has extra content: data, line 2
我有创建新发票的演示数据代码,但我不知道如何解决这个错误
<odoo>
<data>
<record id="emb_invoice_1" model="account.invoice">
<field name="partner_id" ref="base.res_partner_2"/>
<field name="user_id" ref="base.user_demo"/>
<field name="origin">SO001</field>
<field name="emb_dual_use">True</field>
<field name="emb_message">True Field transport</field>
<field name="amount_untaxed_invoice_signed">750.00</field>
<field name="amount_tax_signed">157.50</field>
<field name="amount_total_signed">907.50</field>
</record>
<record id="emb_invoice_line_ids" model="account.invoice">
<field name="invoice_line_ids">
<field name="order_id" ref="emb_invoice_1"/>
<field name="product_id" ref="product.product">'{[FURN_0096] Customizable Desk (Steel, White)}'</field>
<field name="name">'PC Assamble + 2GB RAM'</field>
<field name="account_id">'162'</field>
<field name="price_unit">'2950.00'</field>
<field name="origin_country" model="res.country.state">'{Spain}'</field>
</field>
</record>
</data>
</odoo>
谢谢!
第二条数据记录中:
account.invoice
中不存在声明的字段,您需要将其替换为正确的模型名称 account.invoice.line
,删除 <field name="invoice_line_ids">
标签并设置 invoice_id
的值.使用 invoice_id
而不是 order_id
.
ref
属性必须是有效的外部 ID。找到 FURN_0096
的外部 ID 并按如下方式替换字段标记(就像您对 partner_id
和 user_id
所做的那样):
<field name="product_id" ref="the external id">
您可以在文档中了解到,如果提供了 ref 属性,它的值必须是有效的 external id,它将被查找并设置为字段的值。
主要用于 Many2one and Reference 个字段
您还必须对最后两个字段使用相同的逻辑:account_id
和 origin_country
。
如何解决OpenERP或Odoo中的这个错误? 我正在尝试为自定义模块创建自己的演示数据,但我不知道该怎么做。 我正在使用 Odoo 12,模块是 account.invoices
Error: Odoo Server Error Traceback (most recent call last): File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 656, in
_handle_exception
return super(JsonRequest, self)._handle_exception(exception) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 314, in
_handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/home/ubuntu/OdooAddons/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 346, in
_call_function
return checked_call(self.db, *args, **kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 941, in __call__
return self.method(*args, **kw) File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw) File "/home/ubuntu/OdooAddons/odoo/addons/web/controllers/main.py", line 967, in call_button
action = self._call_kw(model, method, args, {}) File "/home/ubuntu/OdooAddons/odoo/addons/web/controllers/main.py", line 955, in _call_kw
return call_kw(request.env[model], method, args, kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/api.py", line 759, in call_kw
return _call_kw_multi(method, model, args, kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/api.py", line 746, in
_call_kw_multi
result = method(recs, *args, **kwargs) File "<decorator-gen-67>", line 2, in button_immediate_upgrade File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs) File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 627, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade) File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 561, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 417, in load_modules
force, status, report, loaded_modules, update_module, models_to_check) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report) File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) File "/home/ubuntu/OdooAddons/odoo/odoo/tools/convert.py", line 802, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/ubuntu/OdooAddons/odoo/odoo/tools/convert.py", line 852, in convert_xml_import
relaxng.assert_(doc) File "src/lxml/etree.pyx", line 3542, in lxml.etree._Validator.assert_ AssertionError: Element odoo has extra content: data, line 2
我有创建新发票的演示数据代码,但我不知道如何解决这个错误
<odoo>
<data>
<record id="emb_invoice_1" model="account.invoice">
<field name="partner_id" ref="base.res_partner_2"/>
<field name="user_id" ref="base.user_demo"/>
<field name="origin">SO001</field>
<field name="emb_dual_use">True</field>
<field name="emb_message">True Field transport</field>
<field name="amount_untaxed_invoice_signed">750.00</field>
<field name="amount_tax_signed">157.50</field>
<field name="amount_total_signed">907.50</field>
</record>
<record id="emb_invoice_line_ids" model="account.invoice">
<field name="invoice_line_ids">
<field name="order_id" ref="emb_invoice_1"/>
<field name="product_id" ref="product.product">'{[FURN_0096] Customizable Desk (Steel, White)}'</field>
<field name="name">'PC Assamble + 2GB RAM'</field>
<field name="account_id">'162'</field>
<field name="price_unit">'2950.00'</field>
<field name="origin_country" model="res.country.state">'{Spain}'</field>
</field>
</record>
</data>
</odoo>
谢谢!
第二条数据记录中:
account.invoice
中不存在声明的字段,您需要将其替换为正确的模型名称 account.invoice.line
,删除 <field name="invoice_line_ids">
标签并设置 invoice_id
的值.使用 invoice_id
而不是 order_id
.
ref
属性必须是有效的外部 ID。找到 FURN_0096
的外部 ID 并按如下方式替换字段标记(就像您对 partner_id
和 user_id
所做的那样):
<field name="product_id" ref="the external id">
您可以在文档中了解到,如果提供了 ref 属性,它的值必须是有效的 external id,它将被查找并设置为字段的值。
主要用于 Many2one and Reference 个字段
您还必须对最后两个字段使用相同的逻辑:account_id
和 origin_country
。