تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2478 أدوات العرض

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
مايو 18
7862
2
أغسطس 25
2394
1
يوليو 25
896
1
أغسطس 25
1151
0
مايو 25
1338