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

Hello,


I have this button that i want to be invisible after a certain amount of days after payment date

I tried different things but no luck .

  <button name="cancel" attrs="{'invisible': [('state', '=', 'draft'), ('payment_date', '&lt;', datetime.datetime.strftime('%d-%m-%Y'))]}" groups="account.group_account_manager" string="Cancel" type="object"/>


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

Thank you my friend

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

Hello Chgh,

Please try below code. Hope it helps.

<button 
    name="cancel" 
    attrs="{'invisible': [('state', '=', 'draft'), ('payment_date', '&lt;', context_today().strftime('%Y-%m-%d'))]}" 
    groups="account.group_account_manager" 
    string="Cancel" 
    type="object"/>

Regards,
Pranjal

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

I got this error

name 'context_today' is not defined" while evaluating

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
พ.ค. 18
7881
2
ส.ค. 25
2404
1
ก.ค. 25
909
1
ส.ค. 25
1151
0
พ.ค. 25
1344