Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create the session, and add the link with the given channel in OpenERP(Odoo)?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 595
    Comment on it

    In below example, I have written Python script to create the session and to add the link with the given channel. To do this, directly use below python code in your .py file

     Session = self.pool["im_chat.session"]
            newid = Session.create(cr, uid, {'user_ids': [(4, user_id)], 'channel_id': channel_id, 'anonymous_name' : anonymous_name}, context=context)
            return Session.session_info(cr, uid, [newid], context=context)
     def test_channel(self, cr, uid, channel, context=None):
            if not channel:
                return {}
            return {
                'url': self.browse(cr, uid, channel[0], context=context or {}).web_page,
                'type': 'ir.actions.act_url'
            } def get_info_for_chat_src(self, cr, uid, channel, context=None):
            url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
            chan = self.browse(cr, uid, channel, context=context)
            return {
                "url": url,
                'buttonText': chan.button_text,
                'inputPlaceholder': chan.input_placeholder,
                'defaultMessage': chan.default_message,
                "channelName": chan.name,
            }

 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: