summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNasreddin (bon) <bon@odoo.com>2020-09-16 14:40:18 +0000
committerNasreddin (bon) <bon@odoo.com>2020-09-17 09:30:45 +0000
commite6454bd104135d4851e932e500fe3fc344ff26ea (patch)
treec82c39d2c63935f36181f542ba8e0ba561eb02bd
parent641ae07dbce1d0515fb0710a3363db47b27548e7 (diff)
[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#57928 X-original-commit: cae352a90b2d8a562fbf57391ce88fde4488e8cf Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
-rw-r--r--addons/hr_timesheet/views/hr_timesheet_views.xml7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/hr_timesheet/views/hr_timesheet_views.xml b/addons/hr_timesheet/views/hr_timesheet_views.xml
index a0a8b9b8b10..d2b6f57ade5 100644
--- a/addons/hr_timesheet/views/hr_timesheet_views.xml
+++ b/addons/hr_timesheet/views/hr_timesheet_views.xml
@@ -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>