Files
odoo_source/addons/project_timesheet_holidays/models/res_config_settings.py
T
Tom Kairis bdf29635fb [IMP] hr_timesheet: Improve general UX (back2basics)
Change of several labels to increase consistency.
Adapt the size of certain images so that they are rendered without
modifying their quality.
Display the employee's profile image in the grid view to improve
the visual.
Add the kanban view to the All Timesheets menu.
Modify the Time Off configurations so that the projects displayed are
those of a company and that the tasks are adapted according to
the chosen project and vice versa.
Make the hr_timesheet and timesheet_grid module icon the same
for better consistency.

closes odoo/odoo#51808

Taskid: 2239802
Related: odoo/enterprise#10745
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-06-26 11:15:22 +00:00

26 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
leave_timesheet_project_id = fields.Many2one(
related='company_id.leave_timesheet_project_id', required=True, string="Internal Project",
domain="[('company_id', '=', company_id)]", readonly=False)
leave_timesheet_task_id = fields.Many2one(
related='company_id.leave_timesheet_task_id', string="Time Off Task", readonly=False,
domain="[('company_id', '=', company_id), ('project_id', '=?', leave_timesheet_project_id)]")
@api.onchange('leave_timesheet_project_id')
def _onchange_timesheet_project_id(self):
if self.leave_timesheet_project_id != self.leave_timesheet_task_id.project_id:
self.leave_timesheet_task_id = False
@api.onchange('leave_timesheet_task_id')
def _onchange_timesheet_task_id(self):
if self.leave_timesheet_task_id:
self.leave_timesheet_project_id = self.leave_timesheet_task_id.project_id