Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
1868 Lượt xem

I have create a securit group:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<record id="show_cost_price" model="res.groups">
<field name="name">show cost price</field>
</record>
</openerp>

And a view:

<record model="ir.ui.view" id="show_cost_price_form_product_template">
<field name="name">show_cost_price_form_product_template</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//label[@for='standard_price']" position="attributes">
<attribute name="groups">hide_cost.show_cost_price"</attribute>
</xpath>
</field>
</record>

Odoo hide the label for all users ignoring the security group.


Ảnh đại diện
Huỷ bỏ

Did you added users in that group ?

Tác giả

Yes. The admin user. Other users are not in the group. None of the groups can view the label.

Tác giả Câu trả lời hay nhất

Solved. Sintaxt error:

<attribute name="groups">hide_cost.show_cost_price"</attribute>

Changed to

<attribute name="groups">hide_cost.show_cost_price</attribute>




Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

  Just try  this if you are trying to hide the field label

<xpath expr="//label[@string='string_for_standard_price']" position="attributes">       
<attribute name="groups">hide_cost.show_cost_price"</attribute>
</xpath>
or you can hide that field for the  group by

<xpath expr="//field[@name='standard_price']" position="attributes">
<attribute name="groups">hide_cost.show_cost_price"</attribute>
</xpath>


                                                                                          

Ảnh đại diện
Huỷ bỏ
Tác giả

Hi Anu,

The problem it's the same. Hide label or filed for all users, ignoring the group permisions.