This question has been flagged
2 Replies
767 Views

Hi dear Odooers.

How can I set a default view to be used when opening the "all timesheets" screen in the Timesheet module ?

The goal is to present by default the monhtly view instead of the weekly view.

I tried saving the preferred view but it doesn't work.
I assume there is a simple way I didn't see yet... ;-)

Thanks for your support,

V.

Avatar
Discard

This didn't work on v17. Any ideas?

Best Answer

Hello Vincent, 

I searched for month to change my default "My timesheet" to monthly view, and I finally found this morning :-)

Go to Settings in developper mode --> Technique --> Actions --> Interface Actions
There you can search for "Timesheet" to filter the list.
You should see your default "My Timesheets" view, open it.
In the Filter section, adapt the context value by adding " 'grid_range': 'month' " in front of it :

{ 'grid_range': 'month', 'grid_anchor': (datetime.date.today()).strftime('%Y-%m-%d'), 'my_timesheet_display_timer': True, 'group_expand': True, "is_timesheet": 1, }

Save and get back to your Timesheets module... The magic should happen :-)

Kr,

Thibaud

Avatar
Discard
Author

Hi Thibaud.
Un tout grand merci !
Thanks a lot for sharing !
All the best.
Vincent.

Best Answer

This didn't work on v17. Any ideas?

Avatar
Discard

Hello Dimitrios,
it work on my side with the following context value :
{'grid_range': 'month', 'grid_anchor': (datetime.date.today()-relativedelta(months=1)).strftime('%Y-%m-%d'), 'my_timesheet_display_timer': True, 'group_expand': True, "is_timesheet": 1,}

I get the default view in "Month" and I forced to start from the last month with "-relativedelta(months=1)"

Kr

Thibaud

Thanks Thibaud. I'm unclear on how to add the context value. I only see two fields when I click My Timesheets in Actions: Action Name and Action Type. Should I add the code to Action Type?

Never mind, I found it. Developer Mode, then click in Debug menu, Edit Action. Now I have access to the Context Value field and many others.