コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
8119 ビュー

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
2173
3
7月 23
5344
2
10月 22
4496
3
3月 24
2233
2
6月 24
10134