Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
4483 Переглядів

Hi,

I have been searching everywhere for this answer, but with no luck.

I want to use payslip.date_to.days to get the INT value from the date, to use in a condition for a rule.

I can do it like this:

date_to = str(payslip.date_to)[8:10]

if int(date_to) > 15:

    result = True


And it works! But I was told that is not the correct way to do it "pythonically".

Best way would be simply:

if payslip.date_to.days > 15:
    result = True

But all I get is Wrong python code defined for salary rule.

Аватар
Відмінити
Найкраща відповідь

Hi Denisse,
only remove the "s" from day:


if payslip.date_to.day > 15:
    result = True


and it will work fine :)

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
січ. 19
4824
4
вер. 25
6590
0
бер. 23
2647
0
лип. 19
4834
0
груд. 18
3258