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

    • 0
    • 1
    • 0
    • 0
    • 13
    • 0
    • 0
    • 0
    • 3.30k
    Comment on it

    Step-1 Install the Web LinkedIn module.
    Step-2 After that custmozie .py(Python file) file:
    In below example, I have custmozied .py file. You can directly copy the below python code in your .py file.

    import openerp
    import openerp.addons.web
    from openerp.osv import fields, osv
    
    class Binary(openerp.http.Controller):
        @openerp.http.route('/web_linkedin/binary/url2binary', type='json', auth='user')
        def url2binary(self, url):
            """Used exclusively to load images from LinkedIn profiles, must not be used for anything else."""
            _scheme, _netloc, path, params, query, fragment = urlparse(url)
            # media.linkedin.com is the master domain for LinkedIn media (replicated to CDNs),
            # so forcing it should always work and prevents abusing this method to load arbitrary URLs
            url = urlunparse(('http', 'media.licdn.com', path, params, query, fragment))
            bfile = urllib2.urlopen(url)
            return base64.b64encode(bfile.read())
    
    class web_linkedin_settings(osv.osv_memory):
        _inherit = 'sale.config.settings'
        _columns = {
            'api_key': fields.char(string="API Key", size=50),
            'server_domain': fields.char(),
        }
    
        def get_default_linkedin(self, cr, uid, fields, context=None):
            key = self.pool.get("ir.config_parameter").get_param(cr, uid, "web.linkedin.apikey") or ""
            dom = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
            return {'api_key': key, 'server_domain': dom,}
    
        def set_linkedin(self, cr, uid, ids, context=None):
            key = self.browse(cr, uid, ids[0], context)["api_key"] or ""
            self.pool.get("ir.config_parameter").set_param(cr, uid, "web.linkedin.apikey", key, groups=['base.group_user'])
    
    class web_linkedin_fields(osv.Model):
        _inherit = 'res.partner'
    
        def _get_url(self, cr, uid, ids, name, arg, context=None):
            res = dict((id, False) for id in ids)
            for partner in self.browse(cr, uid, ids, context=context):
                res[partner.id] = partner.linkedin_url
            return res
    
        def linkedin_check_similar_partner(self, cr, uid, linkedin_datas, context=None):
            res = []
            res_partner = self.pool.get('res.partner')
            for linkedin_data in linkedin_datas:
                partner_ids = res_partner.search(cr, uid, ["|", ("linkedin_id", "=", linkedin_data['id']), 
                        "&", ("linkedin_id", "=", False), 
                        "|", ("name", "ilike", linkedin_data['firstName'] + "%" + linkedin_data['lastName']), ("name", "ilike", linkedin_data['lastName'] + "%" + linkedin_data['firstName'])], context=context)
                if partner_ids:
                    partner = res_partner.read(cr, uid, partner_ids[0], ["image", "mobile", "phone", "parent_id", "name", "email", "function", "linkedin_id"], context=context)
                    if partner['linkedin_id'] and partner['linkedin_id'] != linkedin_data['id']:
                        partner.pop('id')
                    if partner['parent_id']:
                        partner['parent_id'] = partner['parent_id'][0]
                    for key, val in partner.items():
                        if not val:
                            partner.pop(key)
                    res.append(partner)
                else:
                    res.append({})
            return res
    
        _columns = {
            'linkedin_id': fields.char(string="LinkedIn ID"),
            'linkedin_url': fields.char(string="LinkedIn url", store=True),
            'linkedin_public_url': fields.function(_get_url, type='text', string="LinkedIn url", 
                help="This url is set automatically when you join the partner with a LinkedIn account."),
        }

 13 Comment(s)

  • Hello Peter, Thanks for reading my blog. Actually, I have posted only .py file on my blog. For completing all of your requirements you will also need it's xml and js files. I will also share its js and xml files very soon.

  • Hi Peter, I understood your problem. Please provide me your email id, where I will share the complete linked-in module. You can easily install and solve your problem. If you again face any problem, let me know, we can chat and resolve the problem by screen sharing on skype or similar software.

  • Hi,

    i get no Error by installation... i become an error when i click the button:

    i try to go to customer , take one , press the LinkedIN Button and become: "LinkedIn: You must specify a valid JavaScript API Domain as part of this key's configuration." but as i told.... i try both version.... http and https - See more at: http://findnerd.com/list/view/How-to-integrate-the-LinkedIn-with-OpenERPOdoo/4424/#sthash.GG0DuU1D.dpuf

  • Hi Siva,

    I try to complete your steps... I have an LinkedIN API Profile with full of accessrights:

    r_contactinfo r_emailaddress r_fullprofile r_network rw_company_admin rw_groups rw_nus w_messages w_share

    2) I put the FQDN from my Server inside the javascript textbox , i try http://servername.companyname.de and https://servername.companyname.de

    3) take the secretkey (try also with customerID) and put it in ODOO, in the LinkedIN configuration

    4) i change the : web_linkedin.py with your code , save it and reload and install it in Odoo

    5) i try to go to customer , take one , press the LinkedIN Button and become:

    "LinkedIn: You must specify a valid JavaScript API Domain as part of this key's configuration." but as i told.... i try both version.... http and https

    can you help?

    regards

    Peter

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: