Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
9500 Переглядів

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

Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити
Автор

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 Відповіді Переглядів Дія
2
бер. 24
1931
1
лист. 22
3523
1
лип. 23
1717
5
бер. 22
14772
1
трав. 20
4525