Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
11814 มุมมอง

Hi everyone. I'm trying to redirect to and external website but nothing is happening. But nothing happens when I call that function, not even an error or something. I'm using werkzeug because I need to pass some parameters to the url.
I tried to raise Warning just to check if the function is working properly and it is working.

XML

<record id="test_action" model="ir.actions.server">
<field name="name">My Action</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_logout_test"/>
<field name="state">code</field>
<field name="code">model.raiseKey()</field>
</record>

<menuitem id="test_menu" name="Test" 
action="test_action" groups="base.group_user"/>
def raiseKey(self):    
werkzeug.utils.redirect('**URL**') 
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Server action execute code in a safe sandbox using safe_eval and it will not return anything except you explicitly assigned action variable in your code 

<field name="code">     
   action = {   
       'type': 'ir.actions.act_url',
       'url': ' **URL**' . # take compute field on model and use as record.url
       'target': 'self',
     }  
</field>

อวตาร
ละทิ้ง
ผู้เขียน

It worked, thanks!

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 24
2210
Odoo Mail Sending Limit แก้ไขแล้ว
2
ธ.ค. 23
14681
0
ต.ค. 23
33
3
ต.ค. 23
788
1
ต.ค. 23
569