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

Hi,

I want to add a button to the calendar view header and show it only when the user is on the everybody view of the timeoff module.

I can add the button but it appears on every calendar with a custom qweb template.


<?xml version="1.0" encoding="UTF-8"?>
<template xml:space="preserve">
    <t t-extend="CalendarView.buttons">
        <t t-jquery="div.o_calendar_buttons" t-operation="append">
            <button>Custom Action</button>
        </t>
    </t>
</template>


I tried  this

 <t t-if="widget.modelName == 'hr.leave.report.calendar'"  t-jquery="div.o_calendar_buttons" t-operation="append">

But there's a js error : TypeError: dict.widget is undefined

And


 <t t-if="modelName == 'hr.leave.report.calendar'" t-jquery="div.o_calendar_buttons" t-operation="append">

Don't throw an error, but the button never shows off.




Is it possible to do this ?


Regards






อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I can't find any solution using the the template.

It works if I use a condition on the js side in the renderButtons method

if (this.modelName != 'my_model') 



อวตาร
ละทิ้ง

can you help me with the JS part? or you can assist me with whole procedure?
I have to add custom button in Planning calendar view and print report. Any assistance will be helpful. Thanks

Related Posts ตอบกลับ มุมมอง กิจกรรม
How to extend CalendarModel แก้ไขแล้ว
1
ก.ค. 20
3243
0
ก.ค. 20
3068
0
ก.พ. 25
713
2
ม.ค. 25
1248
0
ธ.ค. 21
1947