3

我是 odoo-13 的新手,在调试此错误时需要帮助。我的动机是使用 python3 在 odoo 中创建一个自定义模块。它在我本地安装的 odoo 中工作,但如果我尝试将它安装在安装的其他服务器上,它会产生以下错误,请帮我解决这个错误。将来谢谢。

Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo/odoo/odoo/http.py", line 619, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo/odoo/http.py", line 309, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo/odoo/odoo/tools/pycompat.py", line 14, in reraise
    raise value
  File "/opt/odoo/odoo/odoo/http.py", line 664, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo/odoo/http.py", line 345, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo/odoo/service/model.py", line 93, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo/odoo/http.py", line 338, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo/odoo/http.py", line 910, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo/odoo/http.py", line 510, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1324, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1312, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/odoo/api.py", line 395, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo/odoo/api.py", line 382, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-58>", line 2, in button_immediate_install
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 72, in check_and_log
    return method(self, *args, **kwargs)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 463, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/opt/odoo/odoo/odoo/modules/registry.py", line 85, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/odoo/odoo/odoo/modules/loading.py", line 420, in load_modules
    loaded_modules, update_module, models_to_check)
  File "/opt/odoo/odoo/odoo/modules/loading.py", line 312, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/opt/odoo/odoo/odoo/modules/loading.py", line 231, in load_module_graph
    module.with_context(overwrite=overwrite)._update_translations()
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 889, in _update_translations
    self.env['ir.translation']._load_module_terms(mod_names, filter_lang)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_translation.py", line 822, in _load_module_terms
    tools.trans_load(self._cr, trans_file, lang, verbose=False, module_name=module_name, context=context)
  File "/opt/odoo/odoo/odoo/tools/translate.py", line 1053, in trans_load
    result = trans_load_data(cr, fileobj, fileformat, lang, verbose=verbose, module_name=module_name, context=context)
  File "/opt/odoo/odoo/odoo/tools/translate.py", line 1103, in trans_load_data
    for row in reader:
  File "/opt/odoo/odoo/odoo/tools/translate.py", line 600, in __iter__
    _, module = match.groups()
AttributeError: 'NoneType' object has no attribute 'groups'
4

2 回答 2

1

我在自定义模块中的一个 .po 文件(翻译)中发现了问题。

我不得不将有问题的文件移出 i18n 目录(重命名文件也可以),然后我导出翻译文件并再次进行翻译。

于 2020-07-25T19:49:53.810 回答
0

我遇到了同样的问题,我也找到了它的来源。如果您不想删除翻译文件,这会很有帮助。

这是由于 .po 文件中缺少“模块”标签。这是 .po 文件中翻译的典型示例。

#. module: sale
#: model:ir.actions.report,print_report_name:sale.action_report_pro_forma_invoice
msgid "'PRO-FORMA - %s' % (object.name)"
msgstr "'PRO-FORMA - %s' % (object.name)"
于 2022-02-11T15:48:13.470 回答