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

Hello,

I want to add a filter to the sales app that shows the sales orders so far in the current month (updated automatically). That way I can add it to a spreadsheet to make a custom dashboard. 

However I have not been able to create a filter that filters the creation date for the current month automatically.


Can someone help?

Thanks 

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

Hi 

Try this code in search view of sale order 

   

<filter string="Current Month" name="current_month"

        domain="[('create_date','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')),

        ('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"/>


Regards

อวตาร
ละทิ้ง
ผู้เขียน

Can you send a screenshot of where to put this code?

Thanks!

คำตอบที่ดีที่สุด

If you don't want to edit the view, (in Odoo 17+) in the filter pop-up you can input the following

(you need developer mode on)

The code is

[("date_order", ">", datetime.datetime.combine(context_today(), datetime.time(6, 0, 0)).strftime("%Y-%m-01 %H:%M:%S"))]
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Sales Order Follow up แก้ไขแล้ว
2
ก.ย. 23
1808
1
ก.พ. 24
1181
1
ธ.ค. 23
4612
1
พ.ค. 25
1892
1
เม.ย. 25
2961