Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
6972 Lượt xem

So, i bored each time configure views by hands in odoo and decided to create module that contains all changes.

When i go to contacts app, I need tree view load by default.

So how this done? What I supose to put in views.xml?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

You need to update view_mode in action and sequence of view in action.
You can write as following in your custom module to update it.

<record id="contacts.action_contacts" model="ir.actions.act_window">
	<field name="view_mode">tree,form,kanban</field>
</record>
<record id="contacts.action_contacts_view_kanban" model="ir.actions.act_window.view">
	<field name="sequence" eval="4"/>
	<field name="view_mode">kanban</field>
	<field name="view_id" ref="base.res_partner_kanban_view"/>
	<field name="act_window_id" ref="contacts.action_contacts"/>
</record>

Thanks,

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You have to inherit windows action like this ... but for me this doesn't work either ...

<record id="contacts.action_contacts" model="ir.actions.act_window">
        <field name="name">Contacts</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">res.partner</field>
        <field name="view_mode">tree,kanban,form</field>
        <field name="view_type">form</field>
        <field name="view_id" ref="base.view_partner_tree"/>
        <!-- <field name="context">{'search_default_filter_public_contact':1}</field> -->
    </record>

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 23
8025
2
thg 5 21
19090
1
thg 5 19
6333
3
thg 10 18
19455
2
thg 4 17
4626