[FIX] hr_timesheet: employee in the same company as the timesheet

When encoding a timesheet, we want it to be linked to an employee of the
same company. Purpose is for the current user to find its correct employee
directly, and so its timesheet cost.

Task-1999686
This commit is contained in:
jem-odoo
2019-09-27 11:43:13 +00:00
parent de8e413e08
commit a1268c15eb
3 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ class AccountAnalyticLine(models.Model):
task_id = fields.Many2one('project.task', 'Task', index=True, domain="[('company_id', '=', company_id)]")
project_id = fields.Many2one('project.project', 'Project', domain=[('allow_timesheets', '=', True)])
employee_id = fields.Many2one('hr.employee', "Employee")
employee_id = fields.Many2one('hr.employee', "Employee", check_company=True)
department_id = fields.Many2one('hr.department', "Department", compute='_compute_department_id', store=True, compute_sudo=True)
encoding_uom_id = fields.Many2one('uom.uom', compute='_compute_encoding_uom_id')
@@ -27,6 +27,7 @@
<field name="project_id" required="1" context="{'form_view_ref': 'project.project_project_view_form_simplified',}"/>
<field name="task_id" context="{'default_project_id': project_id}" domain="[('project_id', '=', project_id)]"/>
<field name="unit_amount" widget="timesheet_uom" sum="Total"/>
<field name="company_id" invisible="1"/>
</tree>
</field>
</record>
@@ -41,6 +42,7 @@
<xpath expr="//field[@name='date']" position="after">
<field name="employee_id" required="1" options='{"no_open": True}'/>
<field name="user_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</xpath>
</field>
</record>
@@ -94,6 +94,7 @@
<field name="name"/>
<field name="unit_amount" widget="timesheet_uom"/>
<field name="project_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>
<kanban class="o_kanban_mobile">
<field name="date"/>
@@ -136,6 +137,7 @@
<field name="name"/>
<field name="unit_amount" string="Duration" widget="float_time"/>
<field name="project_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</group>
</sheet>
</form>