From ebe538bc2baebc22260f143c1ac1cb4153bea82d Mon Sep 17 00:00:00 2001 From: Sreejith P Date: Thu, 26 Apr 2018 09:48:49 +0530 Subject: [PATCH] [FIX] Changed related field --- hr_resignation/models/hr_resignation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hr_resignation/models/hr_resignation.py b/hr_resignation/models/hr_resignation.py index 6bd2f1e09..fe55dc80e 100644 --- a/hr_resignation/models/hr_resignation.py +++ b/hr_resignation/models/hr_resignation.py @@ -22,7 +22,7 @@ class HrResignation(models.Model): help='Name of the employee for whom the request is creating') department_id = fields.Many2one('hr.department', string="Department", related='employee_id.department_id', help='Department of the employee') - joined_date = fields.Date(string="Join Date", required=True, related='employee_id.joining_date', + joined_date = fields.Date(string="Join Date", required=True, help='Joining date of the employee') expected_revealing_date = fields.Date(string="Revealing Date", required=True, help='Date on which he is revealing from the company') @@ -33,6 +33,10 @@ class HrResignation(models.Model): state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirm'), ('approved', 'Approved'), ('cancel', 'Cancel')], string='Status', default='draft') + @api.onchange('employee_id') + def set_join_date(self): + self.joined_date = self.employee_id.joining_date if self.employee_id.joining_date else '' + @api.model def create(self, vals): # assigning the sequence for the record