跳至內容
選單
此問題已被標幟
2 回覆
10750 瀏覽次數

I had seen in list view. But how we will make it in kanban view?

頭像
捨棄
最佳答案

Hello 

Try with below code:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-extend="KanbanView.buttons">
        <t t-jquery="button" t-operation="after">
            <t t-if="widget.modelName == 'yourmodelname'">
                <button
                    class="oe_button oe_highlight"
                    type="button">My Button</button>
            </t>
        </t>
    </t>
</templates>
頭像
捨棄

i tried this and i get a schema error (AssertionError: Document does not comply with schema)

@Mosab - that's because you have to put this XML inside qweb section of the manifest, and not on data (which usually has files stored under /static/src/xml/)

Thus, you would need a controller to bind it with the code you want to run, so a little bit more complicated

最佳答案
Hello, You can try it.

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">

     <t t-extend="ImportView.import_button">

<t t-jquery="button.o_button_import" t-operation="after">           

<button t-if="widget.modelName == 'your model name'" 

class="btn btn-primary" type="button">Button name</button> 

</t>

    </t>
</templates>

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
10月 23
8466
1
9月 23
3190
1
5月 23
2129
2
4月 23
2644
1
3月 23
2061