Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
9479 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor

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.

Related Posts Răspunsuri Vizualizări Activitate
2
mar. 24
1929
1
nov. 22
3510
1
iul. 23
1715
5
mar. 22
14747
1
mai 20
4520