Odoo Help

1

0
6 Answers
1
Kalpana Hemnani
06/07/15 12:06


Hello Shawn,

You can use 'groups' for number of groups you want to show this field just like below:

<field name="amount_words" position="attributes">

    <attribute name="groups">other_than_service_order_group_name</attribute>

</field>

After doing this, field will only be seen to groups you have mentioned in group attribute.

Hope this helps!

Thanks,

Kalpana Hemnani

 

1 Comment
ePillars Systems LLC, Shawn Varghese
06/07/15 12:49

Thanks Kalpana, but here I would have to assign the majority of my users to a separate group which seems unnecessary. I have commented in the other post. Please let me know in case you have any other suggestions.

0
Carlos A García
10/04/19 18:08

For me in the same situation works this way. First, create a new group (group_purchase_restrict) in Odoo or your module, and then declare the XML view like this:

<record id="purchase_order_form_mods" model="ir.ui.view">

    <field name="name">purchase.order.form.mods</field>

    <field name="model">purchase.order</field>

    <field name="inherit_id" ref="purchase.purchase_order_form" />

    <field name="arch" type="xml">

        <xpath expr="//button[@name='purchase_confirm'][1]" position="attributes">

            <attribute name="groups">purchase.group_purchase_user,purchase.group_purchase_manager</attribute>

        </xpath>

    </field>

</record>


<record id="purchase_order_form_mods_restrict" model="ir.ui.view">

    <field name="name">purchase.order.form.mods.restrict</field>

    <field name="model">purchase.order</field>

    <field name="inherit_id" ref="purchase.purchase_order_form" />

    <field name="groups_id" eval="[(6, 0, [ref('purchase_mods.group_purchase_restrict') ])]"/>

    <field name="arch" type="xml">

        <xpath expr="//button[@name='purchase_confirm'][1]" position="attributes">

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

        </xpath>

    </field>

</record>

This way hide the button only for the users belonging to the new group (group_purchase_restrict).

 I hope it helps

0
Farid Ghanchi
07/07/15 02:14

Dear Shawn,

You can create a new wizard, And in this wizard you can choose a User/Customer (Specific User) and on this User/Customer give a access to this new field is visible or invisible. 

Thanks.

Farid Ghanchi

0
Avatar

Solanki Shamji

--Solanki Shamji--

1366
| 5 2 9
Baroda, Índia
--Solanki Shamji--

Hello!

Solanki Shamji
06/07/15 11:35

Hello,

Please check the this url.

http://pinakinnayi.blogspot.in/2013/06/field-level-security-in-openerp.html

Hope this will help you.

Thanks.

Shamji


1 Comment
ePillars Systems LLC, Shawn Varghese
06/07/15 12:47

Thanks Solanki, but I think the link describes how to display it for a certain group. In my case, there are only very few users who should not see the field, so I created a group for that purpose. The workaround would be to create a separate group, assign everyone else to that group and apply groups to that. But that would be a tedious task and not the ideal way to do it. I think the code snippet that I posted with some tweaks should accomplish the task. Please let me know if you have any other ideas.

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now