简体   繁体   English

python odoo 10 错误

[英]python odoo 10 error

I'm starting to use odoo but I do not start very well, nothing but mistakes, generate a simple module to start我开始使用odoo但是我开始不是很好,除了错误什么都没有,生成一个简单的模块开始

"%pyodoo%\python.exe" odoo-bin scaffold mi_module

uncomment all the commented lines and I get the following error取消注释所有注释行,我收到以下错误

Error:
Odoo Server Error

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 741, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 651, in _tag_record
    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
    _load_data(cr, module_name, idref, mode, kind='data')
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 94, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 788, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 849, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 738, in parse
    self.parse(rec, mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 748, in parse
    exc_info[2]
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 741, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 651, in _tag_record
    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\base\ir\ir_model.py", line 1469, in _update
    record = record.create(values)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\base\ir\ir_actions.py", line 217, in create
    return super(IrActionsActWindow, self).create(vals)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\base\ir\ir_actions.py", line 46, in create
    res = super(IrActions, self).create(vals)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\models.py", line 3278, in create
    record = self.browse(self._create(old_vals))
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\models.py", line 3431, in _create
    self._validate_fields(vals)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\models.py", line 967, in _validate_fields
    check(self)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\base\ir\ir_actions.py", line 125, in _check_model
    raise ValidationError(_('Invalid model name %r in action definition.') % action.res_model)
odoo.tools.convert.ParseError: "Nombre de modelo 'mi_module.mi_module' no valido en la definición de la acción.
None" while parsing file:/c:/program%20files%20(x86)/odoo%2011.0/server/odoo/addons/mi_module/views/views.xml:10, near
<record model="ir.actions.act_window" id="mi_module.action_window">
      <field name="name">mi_module window</field>
      <field name="res_model">mi_module.mi_module</field>
      <field name="view_mode">tree,form</field>
    </record>

simply generate the module to start and then enter odoo, install the module but I get this error.只需生成要启动的模块,然后输入 odoo,安装模块,但出现此错误。 I am using windows and the final version of odoo.我正在使用 windows 和 odoo 的最终版本。 Should I use another version of odoo to start?我应该使用其他版本的 odoo 来启动吗?

It should be like this !!应该是这样的!!

if your class defined as:如果您的课程定义为:

class mi_module(models.Model):
    _name = "mi.module"

    #"Body"

you have to do it as :你必须这样做:

<record model="ir.actions.act_window" id="mi_module.action_window">
    <field name="name">mi module window</field>
    <field name="res_model">mi.module</field>
    <field name="view_mode">tree,form</field>
</record>

Vishal Khichadiya in the post above found the solution. Vishal Khichadiya 在上面的帖子中找到了解决方案。 However, I think you should start from understanding how it works.但是,我认为您应该从了解它的工作原理开始。 Two ways of fast learning would be:两种快速学习的方法是:

  1. Download some simple apps and see the files, learn how they are built and try to replicate it.下载一些简单的应用程序并查看文件,了解它们是如何构建的并尝试复制它。 I would recommend starting with simple view edits.我建议从简单的视图编辑开始。
  2. Activate the developer mode and make some front-end changes.激活开发者模式并进行一些前端更改。 If it is possible to save and things are working simply replace your front-end changes with a module.如果可以保存并且一切正常,只需将您的前端更改替换为模块即可。 The easiest would be editing the list /tree views - add some stuff here and there.最简单的方法是编辑列表/树视图 - 在这里和那里添加一些东西。

What version of Odoo should you use?您应该使用哪个版本的 Odoo? Probably 11 is the only right version as it is using different Python version than 10 and older.可能 11 是唯一正确的版本,因为它使用的 Python 版本与 10 及更早版本不同。 Get familiar with official Odoo forum as you might get an instant help in there.熟悉官方 Odoo 论坛,因为您可能会在那里获得即时帮助。

E:\odoo-11.0>"E:\odoo-11.0\venv\Scripts\python.exe" "E:\odoo-11.0\odoo-bin" scaffold openacademy addons

Instead use this kind of path in the command prompt to scaffold a modole.而是在命令提示符中使用这种路径来构建模块。

Thanks Abhay S感谢 Abhay S

I believe Vishal Khichadiya already answered your question however, if you do not understand how it works it will be pointless to use his answer我相信 Vishal Khichadiya 已经回答了您的问题,但是,如果您不了解它是如何工作的,那么使用他的回答将毫无意义

starting odoo could be frustrating but when you know how it works it will get easier.启动 odoo 可能会令人沮丧,但是当您知道它是如何工作的时,它会变得更容易。

please read on the documentation of your odoo version to understand how things works functionally请阅读您的 odoo 版本的文档以了解事物的功能运作方式

for your version odoo 11 go to this link https://www.odoo.com/documentation/11.0/howtos/backend.html对于您的 odoo 11 版本,请转到此链接https://www.odoo.com/documentation/11.0/howtos/backend.html

after finishing the above read this for more technical information完成上述内容后,请阅读本文以获取更多技术信息

https://odoo-development.readthedocs.io/en/latest/# https://odoo-development.readthedocs.io/en/latest/#

I just started odoo too and I found out its more research than development我也刚开始使用 odoo,我发现它的研究多于开发

good luck祝你好运

If you are on Windows try using "_" instead ".", like this:如果您使用的是 Windows,请尝试使用“_”代替“.”,如下所示:

<field name="res_model">mi_module_mi_module</field> <field name="res_model">mi_module_mi_module</field>

PLease check your /mi_module/models/__init__.py file :- if their is something like from . import models请检查您的/mi_module/models/__init__.py文件:- 如果它们类似于from . import models from . import models then it is ok. from . import models就可以了。

check also /mi_module/__init__.py :- must be from . import models还要检查/mi_module/__init__.py :- 必须from . import models from . import models

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM