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

Hello. Anyone know what is the best way to redirect from website front end to odoo web back end, if I click a link ? Because I cannot return dictionary action_window from website.

For example: I have a product on my website, so if I click a link, it redirect to back end with spesific form, model, action and product id.

Thanks for your help

อวตาร
ละทิ้ง

Hi, I need some more info. Why would you want to send "form, mode or action" to backend?

Hai Lucio. I send "form, mode or action" to backend in case when I design an email template with front end designer and save or cancel it, it will redirect exactly the last opened action or form. I think it will usefully for odoo if you want anything about redirect from website to web (front to back). 
 
On Tuesday, July 28, 2015, Lucio <lucio-nardelli-itecnis-com@mail.odoo.com> wrote:

Hi, I need some more info. Why would you want to send "form, mode or action" to backend?

--
Lucio
Sent by Odoo S.A. using Odoo about Forum Post How redirect from Website Front end to Odoo Web Back end ?


--
Beloved Friend

Andre Leander

คำตอบที่ดีที่สุด

Have you tried this?


<a class="btn btn-primary" t-att-href="'/web#menu_id=%s&amp;action=%s&amp;id=%s&amp;view_type=form&amp;model=your_model' % (%(addon.menu_id)d, %(addon.action_id)d, your_res_id, )">Go to backend</a>
อวตาร
ละทิ้ง

Thanks Martin

in my case its returning but it says the form view can not be loaded ???? any solution

it worked in chrome. but its not working in Firefox.

I need to tree view with domain like I open sale order tree view display specific partner orders from website to odoo backend.

คำตอบที่ดีที่สุด

Using domain on url does not work on version 17

This is the solution:
Create an action record,
Set the domain empty
Browse the action reference object and update the domain field,
Then call your redirect url with the action

e.g 
my_action.xml

           
Dashboard (Memo)            
memo.model            
ir.actions.act_window           
[]             
tree,form        


your_controller.py

@http.route(['/get-data-info/'])    
def get_data_info(self, items):       
  ​"""items : '[8,88,90,70]' 
​action_id = request.env.ref('module.myaction')        
​menu_id = request.env.ref('module.my_menu')
​act_obj = request.env['ir.actions.act_window']    
​awid= act_obj .browse([ action_id.id])
​if awid:            
​awid.update({ 'domain': [('id', 'in', eval(items))]})        
​url = f"/web#action={action_id.id}&model=memo.model&view_type=list&cids=1&menu_id={menu_id.id}"        ​return request.redirect(url)



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

To redirect from the frontend of a website to the backend of Odoo, you can use the following code:

href="https://your-odoo-server/web#id=product_id&model=product.product&action=your_action_id">Link text

Replace your-odoo-server with the URL of your Odoo server, product_id with the ID of the product you want to open, product.product with the model name of the product, and your_action_id with the ID of the action you want to execute.

You can find the model name and action ID by going to the Developer Mode in the backend of Odoo and looking for the appropriate model and action.

Keep in mind that this will only work if the user is already logged in to the backend of Odoo. If they are not logged in, they will be redirected to the login page before being redirected to the desired page.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

https://www.odoo.com/forum/help-1/how-to-redirect-from-front-end-to-backend-112126

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Did you find a way ? I have the same need..

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 24
1998
0
ม.ค. 21
4941
How do I change my Odoo Website URL? แก้ไขแล้ว
1
เม.ย. 17
7466
0
ก.ค. 18
5526
0
ม.ค. 24
1316