无法根据访问权限进行修改 [英] cannot fiend view based on access rights
本文介绍了无法根据访问权限进行修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<record id="view_res_partner_pricelist" model="ir.ui.view">
<field name="name">view.res.partner.pricelist.form</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.view_partner_property_form" />
<field name="context">{'readonly_by_pass': True}</field>
<field name="arch" type="xml">
<xpath expr="//page[@name='accounting']" position="replace"/>
</field>
</record>
这是我在其中隐藏会计"标签的视图,并且如果打开联系人表单的用户具有会计&资助访问权限,但是如果用户没有访问权限,则会出现错误
this is my view where I hide tab Accounting, and it works ok if the user that opens contact form have accounting & finance access rights, but if the user doesn't have them then I get an error
AttributeError: Element '<xpath expr="//page[@name='accounting']">' cannot be located in parent view
Error context:
View `view.res.partner.pricelist.form`
我该如何为没有会计和财务访问权限的用户使用这项功能?
how can I make this work for users who don't have accounting and finances access rights?
推荐答案
有趣...您应该通过在视图的groups_id字段的视图记录定义中添加组要求来解决它,例如:
Interesting... You should get it solved by adding the group requirement in the view record definition on the groups_id field of your view, like:
<record id="view_res_partner_pricelist" model="ir.ui.view">
<field name="name">view.res.partner.pricelist.form</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.view_partner_property_form" />
<field name="context">{'readonly_by_pass': True}</field>
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='accounting']" position="replace"/>
</field>
</record>
这篇关于无法根据访问权限进行修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文