跳至内容
菜单
此问题已终结
1 回复
2467 查看

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

相关帖文 回复 查看 活动
3
5月 18
7855
2
8月 25
2370
1
7月 25
881
1
8月 25
1151
0
5月 25
1330