[FIX] hr_timesheet: default employee not set on timesheet

Issue

	- Install 'hr_timesheet' module
	- Go to any employee and click on stat button 'Timesheets'
	- Create timesheet
	- Remove employee from filter then add it back

	No timesheets displayed for current employee.

Cause

	There is no "employee_id" in list view. However, 'timesheet_view_tree_user'
	view (who inherit from concerned list view) does have an "employee_id" field
	but the mode is "primary" and therefore not available for the main view.

Solution

	Add "employee_id" in main list view and alter inherited view to
	update attributes of "employee_id" field.

opw-2338055

closes odoo/odoo#57930

X-original-commit: cae352a90b2d8a562fbf57391ce88fde4488e8cf
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
This commit is contained in:
Nasreddin (bon)
2020-09-17 09:55:44 +00:00
parent 811d0a994c
commit f45714d12e
@@ -23,6 +23,7 @@
<field name="arch" type="xml">
<tree editable="top" string="Timesheet Activities" sample="1">
<field name="date"/>
<field name="employee_id" invisible="1"/>
<field name="project_id" required="1" options="{'no_create_edit': True}" context="{'form_view_ref': 'project.project_project_view_form_simplified',}"/>
<field name="task_id" optional="show" options="{'no_create_edit': True, 'no_open': True}" widget="task_with_hours" context="{'default_project_id': project_id}" domain="[('project_id', '=', project_id)]"/>
<field name="name" optional="show" required="0"/>
@@ -40,8 +41,10 @@
<field name="mode">primary</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='date']" position="after">
<field name="employee_id" required="1" widget="many2one_avatar_employee"/>
<xpath expr="//field[@name='employee_id']" position="attributes">
<attribute name="invisible">0</attribute>
<attribute name="required">1</attribute>
<attribute name="widget">many2one_avatar_employee</attribute>
</xpath>
</field>
</record>