Frappe data.py modification

Hi,
I’m trying to add new filter to actual one in the Report view.
Timespan setting of last week display the values of last week but not the values of the last 7 days.
So I created a new get_timespan_date_range called “Previous Week”, “Previous Month”, “Previous Quarter”,“Previous 6 months”,“Previous year”
I added the options in the filter.js file and when I open up the menu it’s working:
image

But whenever I try to display data, the return is always empty… I’m not sure what I’m doing wrong… I tried many different ways and nothing works, always empty.
Any suggestions?

def get_timespan_date_range(timespan: str) -> tuple[datetime.datetime, datetime.datetime]:
	today = nowdate()
	date_range_map = {
		"previous week": lambda: (add_to_date(today, days=-1),) * 8,
		"previous month": lambda: (add_to_date(today, months=-1),) * 1,
		"previous quarter": lambda: (add_to_date(today, months=-3),) * 1,
		"previous 6 months": lambda: (add_to_date(today, months=-6),) * 1,
		"previous year": lambda: (add_to_date(today, years=-1),) * 1,
		"last week": lambda: (
			get_first_day_of_week(add_to_date(today, days=-7)),
			get_last_day_of_week(add_to_date(today, days=-7)),
		),
		"last month": lambda: (
			get_first_day(add_to_date(today, months=-1)),
			get_last_day(add_to_date(today, months=-1)),
		),
		"last quarter": lambda: (
			get_quarter_start(add_to_date(today, months=-3)),
			get_quarter_ending(add_to_date(today, months=-3)),
		),
		"last 6 months": lambda: (
			get_quarter_start(add_to_date(today, months=-6)),
			get_quarter_ending(add_to_date(today, months=-3)),
		),
		"last year": lambda: (
			get_year_start(add_to_date(today, years=-1)),
			get_year_ending(add_to_date(today, years=-1)),
		),
		"yesterday": lambda: (add_to_date(today, days=-1),) * 2,
		"today": lambda: (today, today),
		"tomorrow": lambda: (add_to_date(today, days=1),) * 2,
		"this week": lambda: (get_first_day_of_week(today), get_last_day_of_week(today)),
		"this month": lambda: (get_first_day(today), get_last_day(today)),
		"this quarter": lambda: (get_quarter_start(today), get_quarter_ending(today)),
		"this year": lambda: (get_year_start(today), get_year_ending(today)),
		"next week": lambda: (
			get_first_day_of_week(add_to_date(today, days=7)),
			get_last_day_of_week(add_to_date(today, days=7)),
		),
		"next month": lambda: (
			get_first_day(add_to_date(today, months=1)),
			get_last_day(add_to_date(today, months=1)),
		),
		"next quarter": lambda: (
			get_quarter_start(add_to_date(today, months=3)),
			get_quarter_ending(add_to_date(today, months=3)),
		),
		"next 6 months": lambda: (
			get_quarter_start(add_to_date(today, months=3)),
			get_quarter_ending(add_to_date(today, months=6)),
		),
		"next year": lambda: (
			get_year_start(add_to_date(today, years=1)),
			get_year_ending(add_to_date(today, years=1)),
		),
	}

	if timespan in date_range_map:
		return date_range_map[timespan]()

After the modification, I do a bench build and reload the page

anyone?

How is your filter.js file look like?

filter.js look like this

if (
			condition == "Timespan" &&
			["Date", "Datetime", "DateRange", "Select"].includes(df.fieldtype)
		) {
			df.fieldtype = "Select";
			df.options = this.get_timespan_options([
				"Previous",
				"Last",
				"Yesterday",
				"Today",
				"Tomorrow",
				"This",
				"Next",
			]);
		}

get_timespan_options(periods) {
		const period_map = {
			Previous: ["Week", "Month", "Quarter", "6 months", "Year"],
			Last: ["Week", "Month", "Quarter", "6 months", "Year"],
			This: ["Week", "Month", "Quarter", "Year"],
			Next: ["Week", "Month", "Quarter", "6 months", "Year"],
		};

I just tried to modify the last week line instead of doing changes on my new “previous week”.

Even after a reload, I noticed that the new filter dates didnt change the results.

I know my code is being compiled because if I type errors I get build errors but my website is not using the new code yet?

Is a bench restart required?

Any suggestions on how I should debug this?