diff --git a/addons/hr/__manifest__.py b/addons/hr/__manifest__.py
index cb2942140ed..2ccaa7557a0 100644
--- a/addons/hr/__manifest__.py
+++ b/addons/hr/__manifest__.py
@@ -33,6 +33,7 @@
'report/hr_employee_badge.xml',
'views/hr_employee_views.xml',
'views/hr_department_views.xml',
+ 'views/hr_work_location_views.xml',
'views/hr_views.xml',
'views/hr_templates.xml',
'views/res_config_settings_views.xml',
diff --git a/addons/hr/data/hr_demo.xml b/addons/hr/data/hr_demo.xml
index 0860970a3f6..726bd211926 100644
--- a/addons/hr/data/hr_demo.xml
+++ b/addons/hr/data/hr_demo.xml
@@ -111,6 +111,13 @@ You are approachable, honest and a fun team player
If you have development competencies, we can propose you specific traineeships
+
+
+
+ Building 1, Second Floor
+
+
+
@@ -159,7 +166,7 @@ If you have development competencies, we can propose you specific traineeships
- Building 1, Second Floor
+
(237)-125-2389
aiden.hughes71@example.com
@@ -174,7 +181,7 @@ If you have development competencies, we can propose you specific traineeships
Chief Technical Officer
- Building 1, Second Floor
+
(376)-310-7863
ronnie.hart87@example.com
@@ -187,7 +194,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(538)-497-4804
(538)-672-3185
anita.oliver32@example.com
@@ -201,9 +208,9 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(450)-719-4182
- sharlene.rhodes49@example.comcom
+ sharlene.rhodes49@example.com
@@ -214,7 +221,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(332)-775-6660
randall.lewis74@example.com
@@ -227,7 +234,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(157)-363-8229
jennie.fletcher76@example.com
@@ -242,7 +249,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
+3281813700
gilles@odoo.com
@@ -255,7 +262,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(449)-505-5146
keith.byrd52@example.com
@@ -268,7 +275,7 @@ If you have development competencies, we can propose you specific traineeships
Consultant
- Building 1, Second Floor
+
(203)-276-7903
audrey.peterson25@example.com
@@ -281,7 +288,7 @@ If you have development competencies, we can propose you specific traineeships
Consultant
- Building 1, Second Floor
+
(663)-707-8451
toni.jimenez23@example.com
@@ -294,7 +301,7 @@ If you have development competencies, we can propose you specific traineeships
Marketing and Community Manager
- Building 1, Second Floor
+
(916)-264-7362
jeffrey.kelly72@example.com
@@ -307,7 +314,7 @@ If you have development competencies, we can propose you specific traineeships
Human Resources Manager
- Building 1, Second Floor
+
(360)-694-7266
tina.williamson98@example.com
@@ -318,7 +325,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(350)-912-1201
walter.horton80@example.com
@@ -329,7 +336,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(114)-262-1607
paul.williams59@example.com
@@ -340,7 +347,7 @@ If you have development competencies, we can propose you specific traineeships
Consultant
- Building 1, Second Floor
+
(883)-331-5378
doris.cole31@example.com
@@ -351,7 +358,7 @@ If you have development competencies, we can propose you specific traineeships
Marketing and Community Manager
- Building 1, Second Floor
+
(206)-267-3735
jod@odoo.com
@@ -362,7 +369,7 @@ If you have development competencies, we can propose you specific traineeships
Experienced Developer
- Building 1, Second Floor
+
(754)-532-3841
beth.evans77@example.com
@@ -373,7 +380,7 @@ If you have development competencies, we can propose you specific traineeships
Consultant
- Building 1, Second Floor
+
(944)-518-8232
ernest.reed47@example.com
@@ -384,7 +391,7 @@ If you have development competencies, we can propose you specific traineeships
Marketing and Community Manager
- Building 1, Second Floor
+
(644)-169-1352
eli.lambert22@example.com
@@ -395,7 +402,7 @@ If you have development competencies, we can propose you specific traineeships
Consultant
- Building 1, Second Floor
+
abigail.peterson39@example.com
(482)-233-3393
diff --git a/addons/hr/models/__init__.py b/addons/hr/models/__init__.py
index 33d41e98980..631717c89bf 100644
--- a/addons/hr/models/__init__.py
+++ b/addons/hr/models/__init__.py
@@ -8,6 +8,7 @@ from . import hr_employee_public
from . import hr_department
from . import hr_job
from . import hr_plan
+from . import hr_work_location
from . import mail_alias
from . import mail_channel
from . import models
diff --git a/addons/hr/models/hr_employee_base.py b/addons/hr/models/hr_employee_base.py
index 9986c5e1a1a..6d5d4cee2f2 100644
--- a/addons/hr/models/hr_employee_base.py
+++ b/addons/hr/models/hr_employee_base.py
@@ -27,7 +27,8 @@ class HrEmployeeBase(models.AbstractModel):
work_phone = fields.Char('Work Phone', compute="_compute_phones", store=True, readonly=False)
mobile_phone = fields.Char('Work Mobile')
work_email = fields.Char('Work Email')
- work_location = fields.Char('Work Location')
+ work_location_id = fields.Many2one('hr.work.location', 'Work Location', compute="_compute_work_location_id", store=True, readonly=False,
+ domain="[('address_id', '=', address_id), '|', ('company_id', '=', False), ('company_id', '=', company_id)]")
user_id = fields.Many2one('res.users')
resource_id = fields.Many2one('resource.resource')
resource_calendar_id = fields.Many2one('resource.calendar', domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
@@ -162,6 +163,11 @@ class HrEmployeeBase(models.AbstractModel):
icon = 'presence_undetermined'
employee.hr_icon_display = icon
+ @api.depends('address_id')
+ def _compute_work_location_id(self):
+ to_reset = self.filtered(lambda e: e.address_id != e.work_location_id.address_id)
+ to_reset.work_location_id = False
+
@api.model
def _get_employee_working_now(self):
working_now = []
diff --git a/addons/hr/models/hr_employee_public.py b/addons/hr/models/hr_employee_public.py
index 10edc2ccd7e..9e9ad926032 100644
--- a/addons/hr/models/hr_employee_public.py
+++ b/addons/hr/models/hr_employee_public.py
@@ -24,7 +24,7 @@ class HrEmployeePublic(models.Model):
mobile_phone = fields.Char(readonly=True)
work_phone = fields.Char(readonly=True)
work_email = fields.Char(readonly=True)
- work_location = fields.Char(readonly=True)
+ work_location_id = fields.Many2one(readonly=True)
user_id = fields.Many2one(readonly=True)
resource_id = fields.Many2one(readonly=True)
resource_calendar_id = fields.Many2one(readonly=True)
diff --git a/addons/hr/models/hr_work_location.py b/addons/hr/models/hr_work_location.py
new file mode 100644
index 00000000000..1602ddd4ef9
--- /dev/null
+++ b/addons/hr/models/hr_work_location.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class WorkLocation(models.Model):
+ _name = "hr.work.location"
+ _description = "Work Location"
+ _order = 'name'
+
+ active = fields.Boolean(default=True)
+ name = fields.Char(string="Work Location", required=True)
+ company_id = fields.Many2one('res.company', required=True, default=lambda self: self.env.company)
+ address_id = fields.Many2one('res.partner', required=True, string="Work Address", domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
diff --git a/addons/hr/models/res_users.py b/addons/hr/models/res_users.py
index dcc8407de42..26ecb9e1027 100644
--- a/addons/hr/models/res_users.py
+++ b/addons/hr/models/res_users.py
@@ -21,7 +21,7 @@ class User(models.Model):
category_ids = fields.Many2many(related='employee_id.category_ids', string="Employee Tags", readonly=False, related_sudo=False)
department_id = fields.Many2one(related='employee_id.department_id', readonly=False, related_sudo=False)
address_id = fields.Many2one(related='employee_id.address_id', readonly=False, related_sudo=False)
- work_location = fields.Char(related='employee_id.work_location', readonly=False, related_sudo=False)
+ work_location_id = fields.Many2one(related='employee_id.work_location_id', readonly=False, related_sudo=False)
employee_parent_id = fields.Many2one(related='employee_id.parent_id', readonly=False, related_sudo=False)
coach_id = fields.Many2one(related='employee_id.coach_id', readonly=False, related_sudo=False)
address_home_id = fields.Many2one(related='employee_id.address_home_id', readonly=False, related_sudo=False)
@@ -138,7 +138,7 @@ class User(models.Model):
'visa_expire',
'visa_no',
'work_email',
- 'work_location',
+ 'work_location_id',
'work_phone',
'certificate',
'study_field',
diff --git a/addons/hr/security/ir.model.access.csv b/addons/hr/security/ir.model.access.csv
index 5f5fbd458c9..0367d605eca 100644
--- a/addons/hr/security/ir.model.access.csv
+++ b/addons/hr/security/ir.model.access.csv
@@ -14,3 +14,5 @@ access_hr_plan_activity_type_hr_user,access_hr_plan_activity_type,model_hr_plan_
access_hr_plan_hr_user,access_hr_plan_hr_user,model_hr_plan,group_hr_user,1,1,1,1
access_hr_plan_wizard,access.hr.plan.wizard,model_hr_plan_wizard,hr.group_hr_manager,1,1,1,0
access_hr_departure_wizard,access.hr.departure.wizard,model_hr_departure_wizard,hr.group_hr_user,1,1,1,0
+access_hr_work_location_user,access_hr_work_location_user,model_hr_work_location,base.group_user,1,0,0,0
+access_hr_work_location_manager,access_hr_work_location_manager,model_hr_work_location,group_hr_manager,1,1,1,1
diff --git a/addons/hr/views/hr_employee_public_views.xml b/addons/hr/views/hr_employee_public_views.xml
index 38cccecc690..a64dae4926b 100644
--- a/addons/hr/views/hr_employee_public_views.xml
+++ b/addons/hr/views/hr_employee_public_views.xml
@@ -56,7 +56,6 @@
-
@@ -74,6 +73,7 @@
+
diff --git a/addons/hr/views/hr_employee_views.xml b/addons/hr/views/hr_employee_views.xml
index f54394c61d1..132c9ef902e 100644
--- a/addons/hr/views/hr_employee_views.xml
+++ b/addons/hr/views/hr_employee_views.xml
@@ -105,7 +105,7 @@
-
+
@@ -220,7 +220,7 @@
-
+
diff --git a/addons/hr/views/hr_views.xml b/addons/hr/views/hr_views.xml
index 94ac5457c48..c6492ae73a7 100644
--- a/addons/hr/views/hr_views.xml
+++ b/addons/hr/views/hr_views.xml
@@ -90,6 +90,13 @@
parent="menu_hr_root"
groups="group_hr_user"/>
+
+
-
+
diff --git a/addons/hr_attendance/views/hr_employee_view.xml b/addons/hr_attendance/views/hr_employee_view.xml
index d84007aa66f..dd68e10285c 100644
--- a/addons/hr_attendance/views/hr_employee_view.xml
+++ b/addons/hr_attendance/views/hr_employee_view.xml
@@ -143,7 +143,7 @@
diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml
index 09f8b8e7e2c..a1ef7628db9 100644
--- a/addons/hr_expense/views/hr_expense_views.xml
+++ b/addons/hr_expense/views/hr_expense_views.xml
@@ -20,7 +20,7 @@
hr.employee
-
+
diff --git a/addons/hr_holidays/views/hr_views.xml b/addons/hr_holidays/views/hr_views.xml
index dbaf7d13360..69af584e92e 100644
--- a/addons/hr_holidays/views/hr_views.xml
+++ b/addons/hr_holidays/views/hr_views.xml
@@ -214,7 +214,7 @@
hr.employee
-
+