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

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

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

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

Thank you Ankit for the compliment.

Whoever did flag Sudhir's answer should refrain from doing so! Flagging a post means giving -100 karma points and marking the post as flagged for the moderators.

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

I think that using groups would be a better an easier solution overall.

In the view where you want to hide the notebook page create a new view and make it only accesible to the group who shouldn't see the page.

Access the page by xpath

and done :)

อวตาร
ละทิ้ง

for some reason i cant post the code... it should be

'

<xpath expr="//page[0]" position="attributes">

<attribute name="invisible">1</attribute>

</xpath>

'

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

Maybe you can add any Group in your XML.

อวตาร
ละทิ้ง