콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
6 답글
19425 화면

How to redirect a link to a tree view of a model by using Controller?

I tried this but doesn't work:

@http.route('/library/view_rents', auth='public', website="true")

def view_rents(self, **kw):

return {

"type": "ir.actions.act_window",

"res_model": "library.rental",

"views": [(False, "tree"), (False, "form")],

"target": "new",

        }

아바타
취소

auth='public",

how can you make a public user to access the backend

베스트 답변

Hi Rado,

You can redirect a user to specific URL. The URL should be the URL of your tree view.

EX:

action_id = request.env.ref('module_name.xml_id_of_action')
return request.redirect('/web?&#min=1&limit=80&view_type=list&model=sale.order&action=%s' %(action_id))
OR
import werkzeug.utils
werkzeug.utils.redirect('/web?&#min=1&limit=80&view_type=list&model=sale.order&action=%s' %(action_id))
Sudhir Arya
ERP Harbor Consulting Services
Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com
아바타
취소
베스트 답변

try this one:

        return {
         'type': 'ir.actions.act_window',
         'res_model': 'your_model_name',          'view_type': 'form',          'view_mode': 'tree,form',          'views': [(view_id_tree[0].id, 'tree'),(False,'form')],          'view_id ref="your_module_name.your_view_id"': '',          'target': 'current',          'domain': domain,         }


아바타
취소
베스트 답변

Hello Rado,

You can redirect from controller to Tree view as following:

import werkzeug

return werkzeug.utils.redirect('/web#view_type=list&model=library.rental&action=155')

action=action_id of your menu of model


Thanks,

아바타
취소
베스트 답변

Hello
Redirect without controller

Example in modules files addons odoo 10.0:

addons/website/views/website_templates.xml:

<a t-attf-href="/web#action=base.action_view_base_language_install&amp;website_id=#{website.id if website else ''}&amp;url_return=#{url_return}">

addons/website_twitter/static/src/xml/website.twitter.xml

<a class="lnk_configure" href="/web#action=website.action_website_configuration">Twitter Configuration</a>
addons/website_theme_install/views/views.xml

<a href="/web#action=website_theme_install.theme_install_kanban_action">See themes here</a>
Regards

아바타
취소
관련 게시물 답글 화면 활동
1
11월 23
4374
2
7월 24
2665
1
6월 24
5137
1
10월 23
10845
1
10월 23
98