[IMP] hr_holidays: Display approve view from systray

When clicking on an activity on the systray, the form
view should be the "approve view" (with the stats widget).
The view loaded by the systray JS is the default view.
Hence the approve view need to become the default view.
A few action that used the default view need to be adapted
since that default view has changed.
This commit is contained in:
Lucas Lefèvre
2019-05-17 11:22:10 +02:00
committed by Yannick Tivisse
parent 2b9aec2415
commit fac0df86cb
2 changed files with 24 additions and 23 deletions
@@ -157,7 +157,7 @@ class TestLeaveRequests(TestHrHolidaysBase):
""" Create a department leave """
self.employee_hrmanager.write({'department_id': self.hr_dept.id})
self.assertFalse(self.env['hr.leave'].search([('employee_id', 'in', self.hr_dept.member_ids.ids)]))
leave_form = Form(self.env['hr.leave'].sudo(self.user_hrmanager))
leave_form = Form(self.env['hr.leave'].sudo(self.user_hrmanager), view='hr_holidays.hr_leave_view_form_manager')
leave_form.holiday_status_id = self.holidays_type_1
leave_form.holiday_type = 'department'
leave_form.department_id = self.hr_dept
+23 -22
View File
@@ -46,7 +46,6 @@
domain="[('activity_ids.date_deadline', '<', context_today().strftime('%Y-%m-%d'))]"
help="Show all records which has next action date is before today"/>
<filter string="Today Activities" name="activities_today"
context="{'kanban_view_ref': 'hr_holidays.kanban_actty_view'}"
domain="[('activity_ids.date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
<filter string="Future Activities" name="activities_upcoming_all"
domain="[('activity_ids.date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))
@@ -137,26 +136,6 @@
</field>
</record>
<record id="hr_leave_view_calendar" model="ir.ui.view">
<field name="name">hr.leave.view.calendar</field>
<field name="model">hr.leave</field>
<field name="arch" type="xml">
<calendar string="Time Off Request" event_open_popup="true" date_start="date_from" date_stop="date_to" mode="month" quick_add="False" color="employee_id">
<field name="display_name"/>
</calendar>
</field>
</record>
<record id="hr_leave_view_dashboard" model="ir.ui.view">
<field name="name">hr.leave.view.dashboard</field>
<field name="model">hr.leave</field>
<field name="arch" type="xml">
<calendar js_class="time_off_calendar" string="Time Off Request" event_open_popup="true" date_start="date_from" date_stop="date_to" mode="month" quick_add="False" color="employee_id">
<field name="display_name"/>
</calendar>
</field>
</record>
<record id="hr_leave_view_activity" model="ir.ui.view">
<field name="name">hr.leave.view.activity</field>
<field name="model">hr.leave</field>
@@ -367,7 +346,7 @@
<field name="model">hr.leave</field>
<field name="inherit_id" ref="hr_leave_view_form"/>
<field name="mode">primary</field>
<field name="priority">16</field>
<field name="priority">5</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='holiday_status_id']" position="before">
<field name="employee_id"/>
@@ -385,6 +364,16 @@
</field>
</record>
<record id="hr_leave_view_calendar" model="ir.ui.view">
<field name="name">hr.leave.view.calendar</field>
<field name="model">hr.leave</field>
<field name="arch" type="xml">
<calendar string="Time Off Request" event_open_popup="true" readonly_form_view_id="%(hr_holidays.hr_leave_view_form_manager)d" form_view_id="%(hr_holidays.hr_leave_view_form_manager)d" date_start="date_from" date_stop="date_to" mode="month" quick_add="False" color="employee_id">
<field name="display_name"/>
</calendar>
</field>
</record>
<record id="hr_leave_view_tree" model="ir.ui.view">
<field name="name">hr.holidays.view.tree</field>
<field name="model">hr.leave</field>
@@ -613,6 +602,18 @@
</p>
</field>
</record>
<record id="hr_leave_action_all_tree_form" model="ir.actions.act_window.view">
<field name="sequence">2</field>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="hr_leave_action_all"/>
<field name="view_id" ref="hr_leave_view_tree"/>
</record>
<record id="hr_leave_action_all_view_form" model="ir.actions.act_window.view">
<field name="sequence">10</field>
<field name="view_mode">form</field>
<field name="act_window_id" ref="hr_leave_action_all"/>
<field name="view_id" ref="hr_leave_view_form_manager"/>
</record>
<record id="hr_leave_action_action_approve_department" model="ir.actions.act_window">
<field name="name">Department Time Off</field>