Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

[v8] what does the error message "No module named xyz" mean?

By
gunnar
on 10/28/14, 11:22 PM 1,077 views

I have a custom Module that adds functionality to Instant Messaging [im_chat]. And naturally my module depends on [im_chat] being installed.

Eventhough [im_chat] is installed, still I get an error message when I want to install my Module [im_chat_history] that somewhat implies [im_chat] was not installed

2014-10-23 13:20:39,427 1691 CRITICAL odoo-8_test openerp.modules.module: Couldn't load module im_chat_history
2014-10-23 13:20:39,427 1691 CRITICAL odoo-8_test openerp.modules.module: No module named im_chat

I have an __init__.py in my Module that imports the im_chat Module

__init__.py

import im_chat

And it looks to me (having no skills of coding and/or python) odoo fails to do that (importing im_chat).

Does anybody has a hint, what could be wrong here?

 

============== the code =======================

 

im.py

from openerp.osv import fields,osv

class im_history(osv.osv):
    _inherit = 'im.message'


im_history()

 

 

im_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
      <record id="view_im_history" model="ir.ui.view">
        <field name="name">im.message.tree</field>
        <field name="model">im.message</field>
        <field name="arch" type="xml">
                <tree string="IM">
                    <field name="date"/>
                    <field name="from_id"/>
                    <field name="to_id"/>
                    <field name="message"/>
                </tree>
        </field>
      </record>

      <!-- Top menu item -->
        <menuitem name="IM"
            id="im_history_root"
            groups="base.group_user"
            sequence="10"/>

        <record id="open_view_im_history" model="ir.actions.act_window">
            <field name="name">Instant messaging history</field>
            <field name="res_model">im.message</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_im_history"/>
        </record>

        <menuitem name="Actions" id="im_history" parent="im_history_root" groups="base.group_user"/>
        <menuitem action="open_view_im_history" id="menu_open_view_im_history" parent="im_history" sequence="20" groups="base.group_user"/>


    </data>
</openerp>

 


__init__.py

import im

 

 

__openerp__.py

{
    "name" : "Instant messaging history",
    "version" : "1.1",
    "author" : "L",
    "category" : "Generic Modules/Messaging",
    "website" : "-",
    "description": "Adds history view to instant messaging module.",
    "depends" : ["im_chat"],
    "init_xml" : [],
    "update_xml" : ["im_view.xml"],
    "installable": True
}

 

I had some similar errors with custom modules while putting the python dependencies at __openerp__.py Removing those dependencies from __openerp__.py fixed the problem for me. Hope it could help you too.. Cheers

Alejandro Perez Cosio
on 10/28/14, 11:44 PM

apparently that was not it. Removed a line that lists the dependency of [im_chat] but still get the same error File "/opt/odoo/odoo-server/addons-custom/im_chat_history/__init__.py", line 1, in import im_chat ImportError: No module named im_chat

gunnar
on 10/29/14, 12:41 AM
4

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 10/29/14, 4:28 AM

In contrary to regular python, importing other Odoo modules is done using the __openerp__.py file. Remove the "import" line from your __init__.py file. Only add to that file the actual python files in your custom module directory, nothing else.

Instead, edit the __openerp__.py file and find the key "depends". In a list, sum up all the modules by their directory name that you require from Odoo to work.

For example:
"depends": ['account', 'sale', 'im_chat']

thanks, that helped with the "No Module named 'xy'" Problem. Now I am getting a " KeyError: 'im.message' " . I find the string 'im.message' in two of my Module's files: 1. 'im_view.xml' & 2. 'im.py'. I have posted the code in my Question above for reference

gunnar
on 10/29/14, 5:58 PM

In my current Odoo version there is no im.message in the source code. There is however a "im_chat.message" available. Check if this is the class you require OR the model is in a different Odoo module.

Ludo - Neobis
on 10/30/14, 4:07 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/28/14, 11:22 PM
Seen: 1077 times
Last updated: 3/16/15, 8:10 AM