diff options
| author | Mathieu Duckerts-Antoine <dam@odoo.com> | 2019-08-04 20:53:34 +0000 |
|---|---|---|
| committer | Mathieu Duckerts-Antoine <dam@odoo.com> | 2019-08-13 08:18:15 +0000 |
| commit | 6d4ac56b0f6e25b46341dcb9ac3c08ae7b84c4f4 (patch) | |
| tree | 57640bd3bf7d7271d176ff221c6e26871dc075bc /addons | |
| parent | d561868bfa406b5ab22fd2719ec4426a773f4935 (diff) | |
[IMP] *: adapt xml files to new date filters functioning
A previous commit modifies the way in which
date filters work in the Filters menu.
In particular, the attribute default_period of filters
with date attribute cannot take anymore values
like 'this_week', 'last_7_days',...
This commit modifies the xml acoordingly by replacing
the attributes date and default_period by a suitable
domain.
Task ID: 2028787
Diffstat (limited to 'addons')
7 files changed, 20 insertions, 7 deletions
diff --git a/addons/crm/report/crm_activity_report_views.xml b/addons/crm/report/crm_activity_report_views.xml index ddd8b28f781..17266c870fa 100644 --- a/addons/crm/report/crm_activity_report_views.xml +++ b/addons/crm/report/crm_activity_report_views.xml @@ -54,7 +54,9 @@ <filter string="Won" name="won" domain="[('stage_id.is_won', '=', True)]"/> <separator/> - <filter string="Completion Date" name="completion_date" date="date" default_period="last_365_days"/> + <filter string="Completed Last 365 Days" name="completion_date" domain="[ + ('date', '>=', (datetime.datetime.combine(context_today() + relativedelta(days=-365), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), + ('date', '<', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/> <group expand="1" string="Group By"> <filter string="Subtype" name="group_by_subtype" context="{'group_by':'subtype_id'}"/> <filter string="Activity Type" name="group_by_activity_type" context="{'group_by':'mail_activity_type_id'}"/> diff --git a/addons/im_livechat/report/im_livechat_report_channel_views.xml b/addons/im_livechat/report/im_livechat_report_channel_views.xml index b1c38e18cce..f33543f9fff 100644 --- a/addons/im_livechat/report/im_livechat_report_channel_views.xml +++ b/addons/im_livechat/report/im_livechat_report_channel_views.xml @@ -33,7 +33,9 @@ <filter name="missed_session" string="Missed sessions" domain="[('nbr_speaker','<=', 1)]"/> <filter name="treated_session" string="Treated sessions" domain="[('nbr_speaker','>', 1)]"/> <filter name="last_24h" string="Last 24h" domain="[('start_date','>', (context_today() - datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d') )]"/> - <filter name="start_date_filter" string="Start Date" date="start_date" default_period="this_week"/> + <filter name="start_date_filter" string="This Week" domain="[ + ('start_date', '>=', (datetime.datetime.combine(context_today() + relativedelta(weeks=-1,days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), + ('start_date', '<', (datetime.datetime.combine(context_today() + relativedelta(days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/> <group expand="0" string="Group By..."> <filter name="group_by_session" string="Code" domain="[]" context="{'group_by':'technical_name'}"/> <filter name="group_by_channel" string="Channel" domain="[]" context="{'group_by':'channel_id'}"/> diff --git a/addons/im_livechat/report/im_livechat_report_operator_views.xml b/addons/im_livechat/report/im_livechat_report_operator_views.xml index f7c99bba35a..c608df0f896 100644 --- a/addons/im_livechat/report/im_livechat_report_operator_views.xml +++ b/addons/im_livechat/report/im_livechat_report_operator_views.xml @@ -31,7 +31,9 @@ <field name="arch" type="xml"> <search string="Search report"> <filter name="last_24h" string="Last 24h" domain="[('start_date','>', (context_today() - datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d') )]"/> - <filter name="start_date_filter" string="Start Date" date="start_date" default_period="this_week"/> + <filter name="start_date_filter" string="This Week" domain="[ + ('start_date', '>=', (datetime.datetime.combine(context_today() + relativedelta(weeks=-1,days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), + ('start_date', '<', (datetime.datetime.combine(context_today() + relativedelta(days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/> <group expand="0" string="Group By..."> <filter name="group_by_channel" string="Channel" domain="[]" context="{'group_by':'channel_id'}"/> <filter name="group_by_operator" string="Operator" domain="[('partner_id','!=', False)]" context="{'group_by':'partner_id'}"/> diff --git a/addons/im_livechat/views/rating_views.xml b/addons/im_livechat/views/rating_views.xml index 2aad1e0fe9a..91b8d1a7b85 100644 --- a/addons/im_livechat/views/rating_views.xml +++ b/addons/im_livechat/views/rating_views.xml @@ -15,7 +15,9 @@ <filter string="Livechat Channel" name="groupby_livechat_channel" context="{'group_by': 'parent_res_name'}"/> </xpath> <xpath expr="/search" position="inside"> - <filter string="Creation Date" name="creation_date_filter" date="create_date" default_period="this_week"/> + <filter string="This Week" name="creation_date_filter" domain="[ + ('create_date', '>=', (datetime.datetime.combine(context_today() + relativedelta(weeks=-1,days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), + ('create_date', '<', (datetime.datetime.combine(context_today() + relativedelta(days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/> </xpath> </field> </record> diff --git a/addons/lunch/views/lunch_orders_views.xml b/addons/lunch/views/lunch_orders_views.xml index ef79c6c7b24..92915aeaf47 100644 --- a/addons/lunch/views/lunch_orders_views.xml +++ b/addons/lunch/views/lunch_orders_views.xml @@ -13,7 +13,7 @@ <filter name="confirmed" string="Received" domain="[('state','=','confirmed')]"/> <filter name="cancelled" string="Cancelled" domain="[('state','=','cancelled')]"/> <separator/> - <filter name="date_filter" string="Date" date="date" default_period="today"/> + <filter name="date_filter" string="Today" domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]" /> <field name="user_id"/> <group expand="0" string="Group By"> <filter name="group_by_supplier" string="By Vendor" context="{'group_by':'supplier_id'}"/> diff --git a/addons/point_of_sale/views/pos_session_view.xml b/addons/point_of_sale/views/pos_session_view.xml index 2ef12e16b2e..041ea1ba86a 100644 --- a/addons/point_of_sale/views/pos_session_view.xml +++ b/addons/point_of_sale/views/pos_session_view.xml @@ -178,7 +178,9 @@ <field name="name" /> <filter name="open_sessions" string="Open" domain="[('state', '=', 'opened')]" /> <separator/> - <filter string="Start Date" name="start_at_filter" date="start_at" default_period="today"/> + <filter string="Start Today" name="start_at_filter" domain="[ + ('start_at', '>=', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), + ('start_at', '<', (datetime.datetime.combine(context_today() + relativedelta(days=1), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/> <field name="config_id" /> <field name="user_id" /> <group expand="0" string="Group By"> diff --git a/addons/project/views/rating_views.xml b/addons/project/views/rating_views.xml index 09dd012de75..618decfda08 100644 --- a/addons/project/views/rating_views.xml +++ b/addons/project/views/rating_views.xml @@ -11,7 +11,10 @@ <filter string="Project" name="groupby_project" context="{'group_by': 'parent_res_name'}"/> </xpath> <xpath expr="/search" position="inside"> - <filter string="Creation Date" name="rating_last_30_days" date="create_date" default_period="last_30_days"/> + <filter string="Last 30 Days" name="rating_last_30_days" domain="[ + ('create_date', '>=', (datetime.datetime.combine(context_today() + relativedelta(days=-30), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')), + ('create_date', '<', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]" + /> <separator/> </xpath> </field> |
