Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
1451 มุมมอง

Hello I am a student only begininng with odoo so i dont know everything. 

I have been trying to limit what a user group can see on the transfer page (transfers with scheduled date between today's date and today's date-14days)

I tried multiple things but i don't know what to use to do this ( tried with the domain in the record rule of the group but i cant find how to get today's date)

If you could help me it would be awesome because i don't know much like i said.


Here is my failed attempt at the domain :

[('scheduled_date','>=', ((context_today()-datetime.timedelta(days=14)).strftime('%Y-%m-%d')))]


I hope you can help me.

Have a great day !!!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

If you need to get the today's date, In odoo you can use "fields.date.today()" to get the today's date in Python. So please try with this to get today's date


Hope it helps

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Hello thanks everyone for the tips !

Unfortunately, it gave me errors for both the answers :

1st error said fields wasn't defined.

2nd said the same but with conext_today.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

i think it should be something like this

context_today()-relativedelta(days=14)

haven't test yet

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ค. 16
3353
1
ต.ค. 20
3091
0
ก.พ. 25
18
2
ต.ค. 22
11751
2
มี.ค. 15
6810