Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1716 Weergaven

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 

Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Auteur

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

Thanks!

Beste antwoord

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"))]
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
sep. 23
1953
1
feb. 24
1260
1
dec. 23
4783
1
mei 25
2160
1
apr. 25
3227