Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
8635 Ansichten

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.

Avatar
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
März 24
2500
3
Juli 23
5795
2
Okt. 22
4967
3
März 24
2667
2
Juni 24
10822