Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creat Google Maps in OpenERP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 214
    Comment on it

    Use below method to create Google Maps in OpenERP
    1- use this code .py file in openerp

    from openerp.osv import osv,fields
    
    class launch_map(osv.osv):
        _inherit = "res.partner"
    
        def open_map(self, cr, uid, ids, context=None):
            if context is None:
                context = {}
    
            partner = self.browse(cr, uid, ids[0], context=context)
            url = "http://maps.google.com/maps?oi=map&q="
            if partner.street:
                url += partner.street.replace(' ','+')
            if partner.city:
                url += '+'+partner.city.replace(' ','+')
            if partner.state_id:
                url += '+'+partner.state_id.name.replace(' ','+')
            if partner.country_id:
                url += '+'+partner.country_id.name.replace(' ','+')
            if partner.zip:
                url += '+'+partner.zip.replace(' ','+')
    
            return {
                'type': 'ir.actions.act_url',
                'url': url,
                'target': 'new'
            }
    

    2- In .xml file use this code

    <pre>
    <openerp>
    <data>
    
    <record model="ir.ui.view" id="view_partner_form_googlemaps">
        <field name="name">res.partner.form.googlemaps</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partne_form"/>
        <field name="arch" type="xml">
            <xpath expr="//sheet/div[@name='buttons']" position="inside">
                <button name="open_map" string="Google Maps" type="object"/>
            </xpath>
        </field>
    </record>
    
    </data>
    </openerp>
    

 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: