Skip to Content
Menu
This question has been flagged
1 Reply
3356 Views

my button doesnt redirect to desired url

this is my pthon code
 @api.one   
 def btn_view_google_map(self):       
    return {           
        'type': 'ir.actions.act_url',           
        'name':'btn_view_google_map',           
        'url': "https://maps.google.com/?ll=0,0",            
         'target': 'new'       
      }


this is my xml view 
button name="btn_view_google_map" type="object" string="View On Google Maps" class="btn_primary" icon="fa-map"/


Avatar
Discard
Best Answer

Hello Muhammad Zulfi Rusdani,

Hope you are doing well.

In your code, you write the @api.one above the function but the ir.action.act_url doesn't work with @api.one and it works with @api.multi If your Odoo version is less than 13 and If you use Odoo Version Greater than or Equal to 13 then don't write @api.multi so please rewrite the code like below.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard

@api.multi
def btn_view_google_map(self):
return {
'type': 'ir.actions.act_url',
'name':'btn_view_google_map',
'url': "https://maps.google.com/?ll=0,0",
'target': 'new'
}

Related Posts Replies Views Activity
0
Dec 24
12
0
Nov 24
6
0
Nov 24
53
0
Nov 24
265
0
Oct 24
95