コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4328 ビュー

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 :)

アバター
破棄
関連投稿 返信 ビュー 活動
1
1月 19
4737
4
9月 25
6393
0
3月 23
2493
0
7月 19
4705
0
12月 18
3154