Skip to Content
Menu
This question has been flagged
1 Reply
1697 Views

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"/>


Avatar
Discard
Author

Thank you my friend

Best Answer

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

Avatar
Discard
Author

I got this error

name 'context_today' is not defined" while evaluating

Related Posts Replies Views Activity
3
May 18
6569
2
Nov 24
270
1
Oct 24
335
4
Oct 24
326
2
Oct 24
362