简体   繁体   中英

from odoo import models, fields, api, _ ModuleNotFoundError: No module named 'odoo'

I am working in odoo v11 and try to update some python files but when I opened the files I got this error from odoo import models, fields, api, _ ModuleNotFoundError: No module named 'odoo' I haven't update anything before this message the picture may explain more

from odoo import models, fields, api, _
from odoo.exceptions import ValidationError


class OpExamSession(models.Model):
    _name = 'op.exam.session'
    _inherit = ['mail.thread']
    _description = 'Exam Session'

    name = fields.Char(
        'Exam Session', size=256, required=True, track_visibility='onchange')
    course_id = fields.Many2one(
        'op.course', 'Course', required=True, track_visibility='onchange')
    batch_id = fields.Many2one(
        'op.batch', 'Batch', required=True, track_visibility='onchange')
    exam_code = fields.Char(
        'Exam Session Code', size=16,
        required=True, track_visibility='onchange')
    start_date = fields.Date(
        'Start Date', required=True, track_visibility='onchange')
    end_date = fields.Date(
        'End Date', required=True, track_visibility='onchange')  

the error message is

Traceback (most recent call last):
  File "E:/shouk1_26-11/odoo/source/odoo/addons/openeducat_exam/models/exam_session.py", line 22, in <module>
    from odoo import models, fields, api, _
ModuleNotFoundError: No module named 'odoo'

Process finished with exit code 1

It's likely an error raised due to your odoo/addons path not set. If the path is set then you should change the sequence in the odoo conf file:

addons_path = /odoo/addons/directory/path/addons,
              /odoo/addons/directory/path/odoo/addons

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.

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