Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
8051 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
mar 24
2119
3
lip 23
5292
2
paź 22
4408
3
mar 24
2169
2
cze 24
10011