简体   繁体   English

安装模块subtype_id时出现odoo 11错误

[英]odoo 11 error when installing module subtype_id

I am trying to make odoo work in windows 10 but I can not make it work odoo, I have searched a lot to try to solve this error but I can not solve it. 我正在尝试使odoo在Windows 10中工作,但我无法使其在odoo中工作,我进行了大量搜索以尝试解决此错误,但我无法解决。 I am using: 我在用:

  1. windows 10 窗户10
  2. Odoo 11 奥杜11

/__manifest__.py /__manifest__.py

{
    'name':'aplication',
    'description':'description',
    'depends':['base','website'],
    'data':['views/custom_view.xml']
}

/__init__.py /__init__.py

import models

/models/__init__.py /models/__init__.py

from .custom_model import CustomModel

/models/custom_model.py /models/custom_model.py

from odoo import models,fields

class CustomModel(models.Model):
    _name = 'custom.model'
    name = fields.Char(string='Name')

/views/custom_view.xml /views/custom_view.xml

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <menuitem name="Top Menu" id="custom_top_menu"/>
    <menuitem name="Sub Child Menu" id="custom_sub_menu" parent="custom_top_menu"/>
    <record id="custom_action" model="ir.actions.act_window">
        <field name="name">Child Menu</field>
        <field name="res_model">custom.model</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="oe_view_nocontent_create">
                Click here to create item !
            </p>
        </field>
    </record>
    <menuitem name="Child Menu" id="custom_child_menu" action="custom_action"
    parent="custom_sub_menu"/>

</odoo>

The error I get is 我得到的错误是

  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\registry.py", line 306, in init_models
    model._auto_init()
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\models.py", line 2139, in _auto_init
    new = field.update_db(self, columns)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\fields.py", line 1945, in update_db
    return super(Many2one, self).update_db(model, columns)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\fields.py", line 856, in update_db
    self.update_db_notnull(model, column)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\fields.py", line 896, in update_db_notnull
    model._init_column(self.name)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\models.py", line 2056, in _init_column
    value = field.default(self)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\mail\wizard\mail_compose_message.py", line 126, in <lambda>
    subtype_id = fields.Many2one(default=lambda self: self.sudo().env.ref('mail.mt_comment', raise_if_not_found=False).id)
AttributeError: 'NoneType' object has no attribute 'id'

I do not know how to fix this error, I've tried everything So I'm seeing this error is in the mail module, which is in the addons folder 我不知道如何解决此错误,我已经尝试了所有方法,所以我看到此错误在邮件模块中,该模块在addons文件夹中

odoo 11 error when installing module subtype_id Hello, I tried to install the module which you have been made.This gave the error of "ImportError: No module named 'models'" . 安装模块subtype_id时出现odoo 11错误您好,我尝试安装已完成的模块。这产生了错误“ ImportError:No module named'models'”。 So you have to write in init .py file like this.... 所以你必须这样写init .py文件。

from . 来自。 import models this will solved your error. 导入模型,这将解决您的错误。

you ask about an error in mail module this is caused by your another custom module in your path. 您询问邮件模块中的错误,这是由您的路径中的另一个自定义模块引起的。 there is no other error in this module.so check your other custom modules. 此模块没有其他错误。请检查其他自定义模块。

Try this: 尝试这个:

In your /__init__.py , import all python files in the models folder by 在您的/__init__.py ,通过以下方式导入models文件夹中的所有python文件:

from . import models

Then in /models/__init__.py import your custom_model.py file by 然后在/models/__init__.py导入您的custom_model.py文件,方法是

from . import custom_model

Every time you add new file in models folder, you have to add it in your /models/__init__.py file. 每次在models文件夹中添加新文件时,都必须将其添加到/models/__init__.py文件中。

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

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