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

hello everyone, i'm trying to create read only tree view, my custom tree view is inherited from 'res.bank'. we can remove create button from control panel view (search / filter ir.ui.view) by using 

 
....

but I can still click some record and then opening default form (i don't make any form, and i dont want to show it) and it can do CRUD thing.

아바타
취소
베스트 답변

Hi,
You have mentioned that you are creating a readonly tree view for res.bank by inheriting the existing tree view. The tree view only has the Create option(No button for Edit and in the action, there is no option for duplicate, but we can delete the records). Hope you have added code for removing the create button from the view(But it is not visible here).


Code to remove the create and delete options from the res.bank tree view:

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


    <field name="name">res.bank.view.tree.inherit.custom_module</field>


    <field name="model">res.bank</field>


    <field name="inherit_id" ref="base.view_res_bank_tree"/>


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


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


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


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


        </xpath>


    </field>


</record>


As you have mentioned above, when you click on any record, the form will be opened. The form view is already defined(please check the base module) and added in the window action. So, you need to update the window action linked to the menuitem Contacts/Configuration/Banks:

<record id="base.action_res_bank_form" model="ir.actions.act_window">


    <field name="res_model">res.bank</field>


    <field name="view_mode">tree</field>


</record>


This will prevent opening the form view from the tree view.

Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
2
3월 24
2117
3
7월 23
5286
2
10월 22
4407
3
3월 24
2166
2
6월 24
10006