3

我最近安装了 Odoo 9.0。但是,我需要一个仅适用于 Odoo 8.0 的模块。

我想知道是否可以对这个模块进行微小的更改以使其与 Odoo 9.0 兼容?新模块只是一个日历,只需使用 Web 界面:链接到模块

这是安装时的错误

Odoo Server Error
Traceback (most recent call last):
  File "/odoo/odoo-server/openerp/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/openerp/http.py", line 680, in dispatch
    result = self._call_function(**self.params)
  File "/odoo/odoo-server/openerp/http.py", line 316, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/openerp/http.py", line 309, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/openerp/http.py", line 959, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/openerp/http.py", line 509, in response_wrap
    response = f(*args, **kw)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 896, in call_button
    action = self._call_kw(model, method, args, {})
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 884, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/odoo/odoo-server/openerp/addons/base/module/module.py", line 459, in button_immediate_install
    return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
  File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/odoo/odoo-server/openerp/addons/base/module/module.py", line 533, in _button_immediate_function
    registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
  File "/odoo/odoo-server/openerp/modules/registry.py", line 386, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/odoo/odoo-server/openerp/modules/loading.py", line 338, in load_modules
    loaded_modules, update_module)
  File "/odoo/odoo-server/openerp/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/odoo/odoo-server/openerp/modules/loading.py", line 156, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/odoo/odoo-server/openerp/modules/loading.py", line 98, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/odoo/odoo-server/openerp/tools/convert.py", line 851, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/odoo/odoo-server/openerp/tools/convert.py", line 938, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "/odoo/odoo-server/openerp/tools/convert.py", line 801, in parse
    self.parse(rec, mode)
  File "/odoo/odoo-server/openerp/tools/convert.py", line 804, in parse
    self._tags[rec.tag](self.cr, rec, de, mode=mode)
  File "/odoo/odoo-server/openerp/tools/convert.py", line 777, in _tag_template
    return self._tag_record(cr, record, data_node)
  File "/odoo/odoo-server/openerp/tools/convert.py", line 708, in _tag_record
    id = self.pool['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 "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 1142, in _update
    res_id = model_obj.create(cr, uid, values, context=context)
  File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/odoo/odoo-server/openerp/addons/base/ir/ir_ui_view.py", line 351, in create
    context=context)
  File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/odoo/odoo-server/openerp/api.py", line 354, in old_api
    result = method(recs, *args, **kwargs)
  File "/odoo/odoo-server/openerp/models.py", line 4151, in create
    record = self.browse(self._create(old_vals))
  File "/odoo/odoo-server/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/odoo/odoo-server/openerp/api.py", line 490, in new_api
    result = method(self._model, cr, uid, *args, **old_kwargs)
  File "/odoo/odoo-server/openerp/models.py", line 4342, in _create
    recs._validate_fields(vals)
  File "/odoo/odoo-server/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/odoo/odoo-server/openerp/models.py", line 1271, in _validate_fields
    raise ValidationError('\n'.join(errors))
ParseError: "Invalid view definition

Error details:
Element '<xpath expr="//script[@src='/web/static/src/js/formats.js']">' cannot be located in parent view

Error context:
View `persian_calendar`
[view_id: 853, xml_id: n/a, model: n/a, parent_id: 159]
None" while parsing None:6, near
<data inherit_id="web.assets_backend">

            <xpath expr="//script[@src='/web/static/src/js/formats.js']" position="replace">
                <script type="text/javascript" src="/persian_calendar/static/src/js/formats.js"/>
            </xpath>
        </data>
4

3 回答 3

4

您面临的是一个特殊情况。Odoo 9 的前端发生了很多变化(比如使用更少)。没有明确的方法可以将模块从 v8 升级到 v9。不过,这里有一些建议:

  • 使用新的 API,因为旧的 API 在 Odoo v10 中肯定已经消失了。这将使以后升级到它更容易。
  • 前端发生了很多变化,您的大部分模板/视图继承都需要刷新。最快的方法仍然是尝试安装它并在出现问题时解决问题
  • 模型逻辑没有太大变化。进行大改造的是 Odoo 9 中的会计和 Odoo 10 中的制造。您现在使用的大多数逻辑仍然有效

关于您的问题,这可能并不容易。我升级了一个模块,显示我在 Odoo 9 上使用 Highcharts 创建的自定义仪表板,并且需要很多步骤才能使其工作。

于 2017-01-15T08:47:53.377 回答
1

没有将模块从 Odoo 8 转换为 Odoo 9 的工具,但问题是 odoo 8 使用旧的 Api,您可以使用官方文档转换代码以查看差异 例如在函数中:在旧 Api 我们在 Arguments 中有声明 cr、uid、ids、context,但在新的 Api 中我们不必这样做;)

于 2018-05-16T16:55:33.137 回答
0

转换模块的步骤:

  1. 版本中的脚手架新模块
  2. 复制 al .py 文件并运行(检查错误)
  3. 复制视图并再次运行(不继承)
  4. 重写 inhetied 视图并检查所有 xpath 是否存在(如本例)
  5. 重写权限
于 2020-09-07T14:25:21.337 回答