Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to integrate the Live chat with OpenERP(Odoo)?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 646
    Comment on it

    Step-1 Install the live chat (im_livechat) module.
    Step-2 After that customize .py(Python file) file:
    In below example, I have custmozied the .py file. You can directly paste below python code in your .py file.

    class im_livechat_channel(osv.Model):
        _name = 'im_livechat.channel'
    
        def _get_default_image(self, cr, uid, context=None):
            image_path = openerp.modules.get_module_resource('im_livechat', 'static/src/img', 'default.png')
            return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
        def _get_image(self, cr, uid, ids, name, args, context=None):
            result = dict.fromkeys(ids, False)
            for obj in self.browse(cr, uid, ids, context=context):
                result[obj.id] = tools.image_get_resized_images(obj.image)
            return result
        def _set_image(self, cr, uid, id, name, value, args, context=None):
            return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
    
        def _are_you_inside(self, cr, uid, ids, name, arg, context=None):
            res = {}
            for record in self.browse(cr, uid, ids, context=context):
                res[record.id] = False
                for user in record.user_ids:
                    if user.id == uid:
                        res[record.id] = True
                        break
            return res
    
        def _script_external(self, cr, uid, ids, name, arg, context=None):
            values = {
                "url": self.pool.get('ir.config_parameter').get_param(cr, openerp.SUPERUSER_ID, 'web.base.url'),
                "dbname":cr.dbname
            }
            res = {}
            for record in self.browse(cr, uid, ids, context=context):
                values["channel"] = record.id
                res[record.id] = self.pool['ir.ui.view'].render(cr, uid, 'im_livechat.external_loader', values, context=context)
            return res
    
        def _script_internal(self, cr, uid, ids, name, arg, context=None):
            values = {
                "url": self.pool.get('ir.config_parameter').get_param(cr, openerp.SUPERUSER_ID, 'web.base.url'),
                "dbname":cr.dbname
            }
            res = {}
            for record in self.browse(cr, uid, ids, context=context):
                values["channel"] = record.id
                res[record.id] = self.pool['ir.ui.view'].render(cr, uid, 'im_livechat.internal_loader', values, context=context)
            return res
    
        def _web_page(self, cr, uid, ids, name, arg, context=None):
            res = {}
            for record in self.browse(cr, uid, ids, context=context):
                res[record.id] = self.pool.get('ir.config_parameter').get_param(cr, openerp.SUPERUSER_ID, 'web.base.url') + \
                    "/im_livechat/support/%s/%i" % (cr.dbname, record.id)
            return res

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: