I need to open website from the UI of OpenERP project, for example google.com. It must be in act_window tag. How to pass parameters dynamicly in URL , for example http://www.google.bg/?q=sun?
Since you need it to be dynamic, you need to create a method and return an dictionary of ir.actions.url
. Then just attach this method to a button. (Note: you may need to open a wizard with the button on it if you need to have the main button on the sidebar).
from openerp import models, api
class MyClass(models.Model):
_name = "my_module.my_class"
@api.multi
def openURL(self):
q = "sun"
return {
'type': 'ir.actions.act_url',
'url': "http://www.google.bg/?q=%s" % q,
'target': 'new', # open in a new tab
}
In your view XML:
<button name="openURL" string="Open URL" type="object">
the name
attribute is the name of the method to call
I do not know either it can possible with act_window
or not.
but I'm sure that we can open url through ir.actions.url
model.
I do not tried it. but the hint can guide you.
1) create action record with ir.actions.url
model and url
2) create menuitem for the same action with type='url'
3) you need to create wizard to open particular url address. with
'type': 'ir.actions.act_url'
and
'url':"web address"
in return values.
hope, it could help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With