콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

This is Odoo 14 code that inherit the group and make create and edit False Which Works Great
<record id="product_template_merch_only_form_view" model="ir.ui.view">

<field name="name">product.template.readonly.form</field>

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

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

<field name="groups_id" eval="[(4, ref('group_nocreateedit_user'))]"/>

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

<data><xpath expr="//form" position="attributes">

<attribute name="edit">false</attribute>

<attribute name="create">false</attribute>

<attribute name="name">Product Template</attribute>

</xpath>

</data>

</field>

</record>

now this same i want to work with odoo17 but from odoo16 "groups_id" remove from "ir.ui.view" so how to do that in odoo17 if any other field then we can make it readonly based on _compute function but i did not get anything for this

아바타
취소
베스트 답변

Hi,

groups_id is no longer directly used in ir.ui.view in Odoo 16 and later.  The way to control view access based on groups has changed.

 Here's how you can achieve the same "no create/edit" functionality for your product template view in Odoo 17:

* Create a new access control rule:


<record id="access_product_template_merch_only" model="ir.model.access">

    <field name="name">Product Template Merch Only </field>

    <field name="model_id" ref="model_product_template"/>  

    <field name="group_id" ref="group_nocreateedit_user"/>

     <field name="perm_read">1</field>

    <field name="perm_create">0</field>

    <field name="perm_write">0</field>

    <field name="perm_unlink">0</field>

</record>


*  Hide Create Button :


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

    <field name="name">product.template.readonly.form</field>

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

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

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

        <xpath expr="//form" position="attributes">

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

            </xpath>

    </field>

</record>


Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
2
1월 24
19826
0
5월 23
448
1
8월 21
4664
2
12월 19
3928
2
8월 23
4131