Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
12621 มุมมอง

Hi to all, does any one know here how to add a button outside on a tree view? On the top of tree view i want to add button on it.


Thanks.

อวตาร
ละทิ้ง




custom.tree.view
your.model
















คำตอบที่ดีที่สุด

It's better to add a button on your 'more' . Like this :

 <act_window id="Id" name="Name in the more"
src_model="model with the button" res_model="wizard called" view_type="form"

view_mode="form" key2="client_action_multi" target="new" />

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

    <field name="name"Name</field>

    <field name="model">Wizard called</field>

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

        <form>

        </form> 

    </field>

</record>


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi, 

Refer the blog on how to add button near the tree view 

Here is the link to the blog/video

https://www.cybrosys.com/blog/how-to-add-a-create-button-near-tree-kanban-view-in-odoo-15

https://www.youtube.com/watch?v=KUNMxMMVwgU

Regards

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Yes it is posible to add button in list view outside tree view but it will add button for all tree view.


<templates id="template" xml:space="preserve">

  <t t-extend="ListView.buttons">

<t t-jquery="button.oe_list_add" t-operation="append">

<button class="oe_button oe_highlight"

type="button">Test</button>

</t>

</t>

</templates>

อวตาร
ละทิ้ง
ผู้เขียน

What about field? I mean, when a user is in tree view there is a selection field shown to him so that he can select on it before the tree is being populated.

using wizard add selection options under "More" menu in List view. You can refer default sale module wizard code.

ผู้เขียน

Can you give me more explanation on how to do it? I really kindda lost on "....

"templates" or "template"?
this is an xml inside /static/src/xml of your module
What else?