2017-06-19 4 views
0

Ich muss Benutzer umleiten, indem Sie die Taste drücken. Button-Code ist wie folgt aus:ODoo Redirect mit JSON

from odoo.http import request 
... 
@api.one 
def go_away(self): 
    return request.redirect('http://example.com/api.jsp?user=1&id=12') 

Odoo wirft Fehler:

AttributeError: 'JsonRequest' object has no attribute 'redirect' 

Wenn ich das versuchen:

werkzeug.utils.redirect(url) 

Odoo sagt:

AttributeError: 'function' object has no attribute 'routing_type' 

kann ich verstehen was ist falsch und wie kann Ich umadressiere Benutzer mit JSON-Daten in Verbindung.

Antwort

0

Ich fand heraus, dass ich so umleiten:

@api.multi 
    def go_away(self) 
    return { 
     'type': 'ir.actions.act_url', 
     'url': url, 
     'target': 'self', 
    }