Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4221 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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


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


and it will work fine :)

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
sty 19
4646
0
mar 23
2397
0
lip 19
4602
3
lip 19
6238
0
gru 18
3079