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>
27 lines
1.5 KiB
Python
27 lines
1.5 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
from odoo import models, fields
|
|
|
|
from .hr_homeworking import DAYS
|
|
|
|
class User(models.Model):
|
|
_inherit = ['res.users']
|
|
|
|
monday_location_id = fields.Many2one("hr.work.location", related="employee_id.monday_location_id", readonly=False, string='Monday')
|
|
tuesday_location_id = fields.Many2one("hr.work.location", related="employee_id.tuesday_location_id", readonly=False, string='Tuesday')
|
|
wednesday_location_id = fields.Many2one("hr.work.location", related="employee_id.wednesday_location_id", readonly=False, string='Wednesday')
|
|
thursday_location_id = fields.Many2one("hr.work.location", related="employee_id.thursday_location_id", readonly=False, string='Thursday')
|
|
friday_location_id = fields.Many2one("hr.work.location", related="employee_id.friday_location_id", readonly=False, string='Friday')
|
|
saturday_location_id = fields.Many2one("hr.work.location", related="employee_id.saturday_location_id", readonly=False, string='Saturday')
|
|
sunday_location_id = fields.Many2one("hr.work.location", related="employee_id.sunday_location_id", readonly=False, string='Sunday')
|
|
|
|
def _get_employee_fields_to_sync(self):
|
|
return super()._get_employee_fields_to_sync() + DAYS
|
|
|
|
@property
|
|
def SELF_READABLE_FIELDS(self):
|
|
return super().SELF_READABLE_FIELDS + DAYS
|
|
|
|
@property
|
|
def SELF_WRITEABLE_FIELDS(self):
|
|
return super().SELF_WRITEABLE_FIELDS + DAYS
|