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. I am using:
/__manifest__.py
{
'name':'aplication',
'description':'description',
'depends':['base','website'],
'data':['views/custom_view.xml']
}
/__init__.py
import models
/models/__init__.py
from .custom_model import CustomModel
/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
<?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
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'" . So you have to write in init .py file like this....
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
from . import models
Then in /models/__init__.py
import your custom_model.py file by
from . import custom_model
Every time you add new file in models
folder, you have to add it in your /models/__init__.py
file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.