Skip to Content
Menu
This question has been flagged
1 Odpoveď
2468 Zobrazenia

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
Zrušiť
Autor

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
Zrušiť
Autor

I got this error

name 'context_today' is not defined" while evaluating

Related Posts Replies Zobrazenia Aktivita
3
máj 18
7855
2
aug 25
2370
1
júl 25
881
1
aug 25
1151
0
máj 25
1330