Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
9492 Näkymät

Odoo 13 on Odoo.sh:


How can I allow a specific user (or group) edit access on only ONE FIELD on the Product screen?

I need this user to be able to read and see everything on the screen, but they can only edit one field.


See screenshot: https://pasteboard.co/JwyYaqE.png

Avatar
Hylkää
Paras vastaus

Hi Russ Schneider,

You can do this by using group.

Just you need to inherit of product form view and need to mention group_id and then you can make field readonly and editable.

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

    <field name = "name"> product.template.cancel.form.mods </field>

    <field name = "model"> product.product </field>

    <field name = "inherit_id" ref = "product.product_normal_form_view" />

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

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

        <xpath expr = "// field [@ name = 'your_field_name']" position = "attributes">

            <attribute name = "readonly"> 0 </attribute>

        </xpath>

        <xpath expr = "// field [@ name = 'your_field_name']" position = "attributes">

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

        </xpath>

    </field>

</record>

Thanks ...

For more information Contact us:- https: //kanakinfosystems.com/odoo-development-services

Avatar
Hylkää
Tekijä

This IS a correct answer. It works. But I was hoping to find a more elegant solution that didn't involve over 100 xpath declarations, hardcoded. :)

Does this works in odoo16?

groups_id is allowed only for new view and not for inherited views in v16.

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
maalisk. 24
1931
1
marrask. 22
3521
1
heinäk. 23
1716
5
maalisk. 22
14761
1
toukok. 20
4522