Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to redirect the user to another site?

By
Rafael Reuber
on 7/26/15, 3:22 PM 613 views

I need to redirect the user to another site the user clicks on a specific button.

I'm trying doing this like described as below. But is does not work.

When the program reaches on the method index from the VrtxEvents controller, the system redirect the request to the location http://localhost:8069/www.gmail.com.

But the expected behavior is it redirect to the location www.gmail.com. 

My view

<record model="ir.ui.view" id="vrtx_view_event_tree">
<field name="name">event.event.tree</field>
<field name="model">event.event</field>
<field name="arch" type="xml">
<tree string="Events" create="false" edit="false" delete="false">
<field name="name" string="Name"/>
<field name="date_begin"/>
<field name="date_end"/>
<field name="state"/>
<button string="Click Here" name="pagseguro" type="object"/>
</tree>
</field>


My model

class Event(models.Model):
_inherit = "event.event"
@api.multi
def pagseguro(self):
return {
"url": "/vrtx_events/vrtx_events/",
"type": "ir.actions.act_url"
}


My controller class:

from openerp import http
from werkzeug.utils import redirect
class VrtxEvents(http.Controller):
@http.route('/vrtx_events/vrtx_events/', auth='public')
def index(self, **kw):
response = redirect("www.gmail.com")
return response

0

Ermin Trevisan

--Ermin Trevisan--
3548
| 6 3 7
Walchwil, Switzerland
--Ermin Trevisan--


Ermin Trevisan
On 7/27/15, 4:02 AM

If you are talking about the website builder of Odoo 8.0, you insert a building block containing a button and change the link to the desired place.

Hi Ermin. I'm talking about a module that should redirect request to a external site. Thank you.

Rafael Reuber
on 7/27/15, 6:05 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/26/15, 3:22 PM
Seen: 613 times
Last updated: 7/27/15, 5:57 PM