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

Hello all,

I want to make a filter in a search view.

This filter must accept invoices when their date is in this the current week or the last week.

We consider that the week begins at monday. We consider that the week ends at sunday.

If we are at the beginning of the week actually, we don't go back for 14 days. Current week always begins to the last monday (or the actual monday if we already are monday) and last week always begin to the previous monday. (Do you understand what I mean? Not easy to write it in english...) 

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

I propose this filter :

(monday is weekday 0. sunday is weekday 6)

<filter string="Current and last weeks" name="currentandlastlastweeks" domain="[
        ('date','&gt;=',(context_today()+relativedelta(weeks=-2,days=1,weekday=0)).strftime('%Y-%m-%d')),
        ('date','&lt;',(context_today()+relativedelta(weekday=6)).strftime('%Y-%m-%d'))
                    ]" help="Journal invoices of the current and the last weeks" />


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

Hi,

One way would be: Group By > Add Custom Group > "Accounting Date" , and then in Group By > Accounting Date you can select "Week" , and the invoices will be divided between Wxx, Wxy, ...

BR

Ricardo


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
filter on current week แก้ไขแล้ว
4
ส.ค. 22
13099
0
มี.ค. 24
1042
2
ก.ย. 24
27568
3
ก.ย. 25
254
1
ก.ย. 25
922