[ADD] hr_homeworking: add homeworking

Users and employees can now define their usual worklocation
for a day of the week aswell as define unusual ones from the
calendar app. The worklocation is then displayed in the calendar
in two different ways: when only one person is selected, there
is a circle with an icon in it, and a ray that extends to the right
if the person is at the same location for multiple days. If there
are multiple persons selected there is no ray, instead the circles
are grouped by location type and colored accordingly to the filters
in the left panel.

closes odoo/odoo#129585

Task: 3060685
X-original-commit: c74ac3f698d4ea4c9b7a5e060fba4cf77cc9a6d7
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Co-authored-by: dasz <dasz@odoo.com>
This commit is contained in:
Melanie Peyrat (MEPE)
2023-07-25 21:22:46 +02:00
committed by dasz
co-authored by dasz
parent 818c0ed8df
commit b3be3af61c
44 changed files with 2020 additions and 142 deletions
+1 -8
View File
@@ -31,9 +31,7 @@ class HrEmployeeBase(models.AbstractModel):
mobile_phone = fields.Char('Work Mobile', compute="_compute_work_contact_details", store=True, inverse='_inverse_work_contact_details')
work_email = fields.Char('Work Email', compute="_compute_work_contact_details", store=True, inverse='_inverse_work_contact_details')
work_contact_id = fields.Many2one('res.partner', 'Work Contact', copy=False)
work_location_id = fields.Many2one('hr.work.location', 'Work Location', compute="_compute_work_location_id", store=True, readonly=False,
check_company=True,
domain="[('address_id', '=', address_id)]")
work_location_id = fields.Many2one('hr.work.location', 'Work Location')
user_id = fields.Many2one('res.users')
resource_id = fields.Many2one('resource.resource')
resource_calendar_id = fields.Many2one('resource.calendar', check_company=True)
@@ -212,11 +210,6 @@ class HrEmployeeBase(models.AbstractModel):
employee.hr_icon_display = icon
employee.show_hr_icon_display = show_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 = []
+4
View File
@@ -12,5 +12,9 @@ class WorkLocation(models.Model):
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)
location_type = fields.Selection([
('home', 'Home'),
('office', 'Office'),
('other', 'Other')], string='Cover Image', default='office', required=True)
address_id = fields.Many2one('res.partner', required=True, string="Work Address", check_company=True)
location_number = fields.Char()