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.

2

how to invisble a notebook page only for specific users?

By
aneesh ATEES Infomedia Pvt Ltd
on 9/3/15, 2:44 AM 479 views

i want to invisible inventory procurements sales variants from the product page for  the portal user.how to solve it

3

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 9/3/15, 3:37 AM

Hello Aneesh,

In xml, you cannot hide the page using any condition or attrs.

For that, you can override fields_view_get and add the `invisible="1"` attribute on your page on a specific condition(s).

Example:

from lxml import etree

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): if context is None: context = {} res = super(class_name, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) for node in doc.xpath("//page[@string='My Page']"): if uid in [1, 2, 3]: #ID of the users for whom page should be invisible node.set('invisible', "1") res['arch'] = etree.tostring(doc) return res
Hope this will help you.

Good replay..@ Sudhir Arya

Ankit H Gandhi(AHG)
on 9/13/15, 9:35 AM

Thank you Ankit for the compliment.

Sudhir Arya (SA)
on 9/14/15, 4:57 AM
0
Juan Muñoz
On 9/7/15, 4:23 AM

Maybe you can add any Group in your XML.

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: 9/3/15, 2:44 AM
Seen: 479 times
Last updated: 9/12/15, 3:53 AM