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

how can I get my im_chat_history Module to work under odoo 8.0?

By
gunnar
on 10/23/14, 9:42 PM 1,751 views

I have a custom Module that adds a menu "IM". It provides a list of all internal instant Messages between odoo users and they can be searched with the standard odoo search

The Module [im_chat] by default stores these messages in the database already but it doesn't provide a view to list and Search them. That is what my Module [im_chat_history] adds to it.

IMPORTANT: I am not talking about the more advanced "Live Chat"  [im_livechat] Module (which has a built-in messaging history for external chats as they come in for a support chat from a website for example)

This [im_chat_history] module has originally been been made for an OpenERP 7.0 (actually saas1) "Instant Messaging" Module [im] and I am trying to make it work with odoo 8.0 im_chat

I have already adjusted the Module in some parts (changing dependencies from 'im' to 'im_chat' and several small things). As I don't have any programming skills my capabilities are pretty limited here
I can do an "Update Modules list" but installation fails

/var/log/odoo/odoo-server.log looks like this:

2014-10-23 13:20:38,147 1691 INFO odoo-8_test openerp.modules.loading: loading 1 modules...
2014-10-23 13:20:38,358 1691 INFO odoo-8_test openerp.modules.loading: 1 modules loaded in 0.21s, 0 queries
2014-10-23 13:20:38,392 1691 INFO odoo-8_test openerp.modules.loading: loading 41 modules...
2014-10-23 13:20:39,422 1691 INFO odoo-8_test openerp.modules.loading: 41 modules loaded in 1.03s, 0 queries
2014-10-23 13:20:39,426 1691 INFO odoo-8_test openerp.modules.loading: loading 42 modules...
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
2014-10-23 13:20:39,427 1691 ERROR odoo-8_test openerp.http: Exception during JSON request handling.
2014-10-23 13:20:39,429 1691 INFO odoo-8_test werkzeug: 192.168.1.241 - - [23/Oct/2014 13:20:39] "POST /web/dataset/call_button HTTP/1.0" 200 -


I don't get much out of that but "... No module named im_chat" seems weird to me because there IS a module im_chat (and it is installed as well)

Also it would be niver whether it didn't add a Menu on the Top of the screen but adding a submenu (on the left) when you do to inside of 'Messaging' (where you open the Calender, or edit "My Groups"

the code is to be found here https://github.com/vrms/odoo_im_chat_history   (branch 'master') or just take a look at it below:

=================================

__init__.py

import im

=================================

__openerp__.py

{

"name" : "Instant messaging history",

"version" : "1.0",

"author" : "L",

"category" : "Generic Modules/Human Resources",

"website" : "-",

"description": "Adds history view to imstant messaging module.",

"depends" : ["im"],

"init_xml" : [],

"update_xml" : ["im_view.xml"],

"installable": True

}

=================================

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>

EDIT: I reverted the code above to my original branch saas1

Hi, confused at your karma points and your question. But maybe again check your _openerp_.py file. "update_xml" : ["im_view.xml"], I would USE...: 'data': ['im_view.xml'], And next. it's the _inherit that needs checking after that. Good luck

Vee
on 10/26/14, 7:31 AM

thanks for your feedback. Karma sums up upon activity in this forum not upon skills in python or coding ... so much for that. I have tried your suggested change >> data': ['im_view.xml'], in line 10 in my _openerp_.py file but that does not help with my symptoms (can't install the module with an error message "ImportError: No module named im_chat"). I have no idea about coding, or Python and I don't quite know what to do with your second suggestion "the _inherit that needs checking". The only time the term "inherit" appears is in line 4 of my im.py >> _inherit = 'im.message'. Any suggestion what might need to be changed there?

gunnar
on 10/26/14, 7:54 PM

Pls look at __init__.py to understand this you are not referencing the right .py file name. it should be im.py ..right???

Vee
on 10/27/14, 10:49 AM

that was not it. the error now is " File "/opt/odoo/odoo-server/addons-custom/im_chat_history/__init__.py", line 2, in import im.py ImportError: No module named py“ I think that this "import im_chat" is meant to import the installed module [im_chat] (which my module depends on). The same construction worked under the priginal version [saas1] of my im_chat_history. Just back then the Module it depended on was call [im] (now [im_chat])

gunnar
on 10/27/14, 7:00 PM
0
Mohammed Roshan
On 2/18/15, 6:19 AM

Try this

__init__.py

import im

__openerp__.py

{

    "name" : "Instant messaging history",

    "version" : "1.0",

    "author" : "L",

    "category" : "Generic Modules/Human Resources",

    "website" : "-",

    "description": "Adds history view to imstant messaging module.",

    "depends" : ["im_chat"],

    "init_xml" : [],

    'data':["im_view.xml"],

    "installable": True

}

 

im.py


from openerp.osv import fields,osv
class im_history(osv.osv):

        _inherit = 'im_chat.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_chat.message.tree</field>

    <field name="model">im_chat.message</field>

    <field name="arch" type="xml">

    <tree string="IM">

    <field name="create_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_chat.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>

It worked for me in odoo 8

 

 

thanks Mohammed. Looks like the indentation is ruined by the forum formatting, so I can't get it running. Tried to fix the indentation manually but that just lead from one error message to another. Do you have your code on github or elsewhere maybe?

gunnar
on 2/18/15, 8:24 AM

is that your github? https://github.com/elgenioroshan. If yes,wold you mind to fork my repo, and just add your branch?

gunnar
on 2/18/15, 8:30 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/23/14, 9:42 PM
Seen: 1751 times
Last updated: 3/16/15, 8:10 AM