diff --git a/employee_orientation/README.rst b/employee_orientation/README.rst index 05898b0fe..f5fac56b3 100644 --- a/employee_orientation/README.rst +++ b/employee_orientation/README.rst @@ -21,6 +21,7 @@ Credits Gion V15 @cybrosys odoo@cybrosys.com + Contacts -------- * Mail Contact : odoo@cybrosys.com diff --git a/employee_orientation/__manifest__.py b/employee_orientation/__manifest__.py index 4e81584a3..01c1d04a2 100644 --- a/employee_orientation/__manifest__.py +++ b/employee_orientation/__manifest__.py @@ -39,6 +39,7 @@ 'views/print_pack_certificates_template.xml', 'views/report.xml', 'views/employee_training.xml', + 'wizard/orientation_complete.xml', 'security/ir.model.access.csv', ], 'images': ['static/description/banner.png'], diff --git a/employee_orientation/models/employee_orientation.py b/employee_orientation/models/employee_orientation.py index be6196bac..57fa20f82 100644 --- a/employee_orientation/models/employee_orientation.py +++ b/employee_orientation/models/employee_orientation.py @@ -28,21 +28,20 @@ class Orientation(models.Model): _inherit = 'mail.thread' name = fields.Char(string='Employee Orientation', readonly=True, default=lambda self: _('New')) - employee_name = fields.Many2one('hr.employee', string='Employee', size=32, required=True) - department = fields.Many2one('hr.department', string='Department', related='employee_name.department_id', - required=True) + employee_id = fields.Many2one('hr.employee', string='Employee', required=True) + department_id = fields.Many2one('hr.department', string='Department', related='employee_id.department_id', + required=True) date = fields.Datetime(string="Date") - # date = fields.Datetime.to_string(dateText) - responsible_user = fields.Many2one('res.users', string='Responsible User') - employee_company = fields.Many2one('res.company', string='Company', required=True, - default=lambda self: self.env.user.company_id) - parent_id = fields.Many2one('hr.employee', string='Manager', related='employee_name.parent_id') - job_id = fields.Many2one('hr.job', string='Job Title', related='employee_name.job_id', - domain="[('department_id', '=', department)]") + responsible_user_id = fields.Many2one('res.users', string='Responsible User') + employee_company_id = fields.Many2one('res.company', string='Company', required=True, + default=lambda self: self.env.user.company_id) + parent_id = fields.Many2one('hr.employee', string='Manager', related='employee_id.parent_id') + job_id = fields.Many2one('hr.job', string='Job Title', related='employee_id.job_id', + domain="[('department_id', '=', department_id)]") orientation_id = fields.Many2one('orientation.checklist', string='Orientation Checklist', - domain="[('checklist_department','=', department)]", required=True) - note_id = fields.Text('Description') - orientation_request = fields.One2many('orientation.request', 'request_orientation', string='Orientation Request') + domain="[('checklist_department_id','=', department_id)]", required=True) + note = fields.Text('Description') + orientation_request_ids = fields.One2many('orientation.request', 'request_orientation_id', string='Orientation Request') state = fields.Selection([ ('draft', 'Draft'), ('confirm', 'Confirmed'), @@ -52,23 +51,23 @@ class Orientation(models.Model): def confirm_orientation(self): self.write({'state': 'confirm'}) - for values in self.orientation_id.checklist_line_id: + for values in self.orientation_id.checklist_line_ids: self.env['orientation.request'].create({ 'request_name': values.line_name, - 'request_orientation': self.id, - 'partner_id': values.responsible_user.id, + 'request_orientation_id': self.id, + 'partner_id': values.responsible_user_id.id, 'request_date': self.date, - 'employee_id': self.employee_name.id, + 'employee_id': self.employee_id.id, }) def cancel_orientation(self): - for request in self.orientation_request: + for request in self.orientation_request_ids: request.state = 'cancel' self.write({'state': 'cancel'}) def complete_orientation(self): force_complete = False - for request in self.orientation_request: + for request in self.orientation_request_ids: if request.state == 'new': force_complete = True if force_complete: diff --git a/employee_orientation/models/employee_training.py b/employee_orientation/models/employee_training.py index 34105b699..6a423ee59 100644 --- a/employee_orientation/models/employee_training.py +++ b/employee_orientation/models/employee_training.py @@ -38,9 +38,9 @@ class EmployeeTraining(models.Model): _inherit = 'mail.thread' program_name = fields.Char(string='Training Program', required=True) - program_department = fields.Many2one('hr.department', string='Department', required=True) - program_convener = fields.Many2one('res.users', string='Responsible User', size=32, required=True) - training_id = fields.One2many('hr.employee', string='Employee Details', compute="employee_details") + program_department_id = fields.Many2one('hr.department', string='Department', required=True) + program_convener_id = fields.Many2one('res.users', string='Responsible User', size=32, required=True) + training_ids = fields.One2many('hr.employee', string='Employee Details', compute="employee_details") note_id = fields.Text('Description') date_from = fields.Datetime(string="Date From") date_to = fields.Datetime(string="Date To") @@ -56,10 +56,10 @@ class EmployeeTraining(models.Model): ('print', 'Print'), ], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='new') - @api.onchange('program_department') + @api.depends('program_department_id') def employee_details(self): - datas = self.env['hr.employee'].search([('department_id', '=', self.program_department.id)]) - self.training_id = datas + datas = self.env['hr.employee'].search([('department_id', '=', self.program_department_id.id)]) + self.training_ids = datas def print_event(self): self.ensure_one() @@ -70,14 +70,14 @@ class EmployeeTraining(models.Model): hours = difference.hours minutes = difference.minutes data = { - 'dept_id': self.program_department.id, + 'dept_id': self.program_department_id.id, 'program_name': self.program_name, 'company_name': self.company_id.name, 'date_to': started_date, 'duration': duration, 'hours': hours, 'minutes': minutes, - 'program_convener': self.program_convener.name, + 'program_convener': self.program_convener_id.name, } return self.env.ref('employee_orientation.print_pack_certificates').report_action(self, data=data) diff --git a/employee_orientation/models/orientation_checklist.py b/employee_orientation/models/orientation_checklist.py index cc7ba4be0..0fe0ea7ef 100644 --- a/employee_orientation/models/orientation_checklist.py +++ b/employee_orientation/models/orientation_checklist.py @@ -30,10 +30,10 @@ class OrientationChecklist(models.Model): _inherit = 'mail.thread' checklist_name = fields.Char(string='Name', required=True) - checklist_department = fields.Many2one('hr.department', string='Department', required=True) + checklist_department_id = fields.Many2one('hr.department', string='Department', required=True) active = fields.Boolean(string='Active', default=True, help="Set active to false to hide the Orientation Checklist without removing it.") - checklist_line_id = fields.Many2many('checklist.line', 'checklist_line_rel', String="Checklist") + checklist_line_ids = fields.Many2many('checklist.line', 'checklist_line_rel', String="Checklist") diff --git a/employee_orientation/models/orientation_checklist_line.py b/employee_orientation/models/orientation_checklist_line.py index 8ac5de189..e61319ce9 100644 --- a/employee_orientation/models/orientation_checklist_line.py +++ b/employee_orientation/models/orientation_checklist_line.py @@ -28,4 +28,4 @@ class ChecklistLine(models.Model): _rec_name = 'line_name' line_name = fields.Char(string='Name', required=True) - responsible_user = fields.Many2one('res.users', string='Responsible User', required=True) + responsible_user_id = fields.Many2one('res.users', string='Responsible User', required=True) diff --git a/employee_orientation/models/orientation_checklist_request.py b/employee_orientation/models/orientation_checklist_request.py index bdcb3b9d6..ea706f5e9 100644 --- a/employee_orientation/models/orientation_checklist_request.py +++ b/employee_orientation/models/orientation_checklist_request.py @@ -31,15 +31,15 @@ class OrientationChecklistRequest(models.Model): _inherit = 'mail.thread' request_name = fields.Char(string='Name') - request_orientation = fields.Many2one('employee.orientation', string='Employee Orientation') - employee_company = fields.Many2one('res.company', string='Company', required=True, - default=lambda self: self.env.user.company_id) + request_orientation_id = fields.Many2one('employee.orientation', string='Employee Orientation') + employee_company_id = fields.Many2one('res.company', string='Company', required=True, + default=lambda self: self.env.user.company_id) partner_id = fields.Many2one('res.users', string='Responsible User') request_date = fields.Date(string="Date") employee_id = fields.Many2one('hr.employee', string='Employee') request_expected_date = fields.Date(string="Expected Date") attachment_id_1 = fields.Many2many('ir.attachment', 'orientation_rel_1', string="Attachment") - note_id = fields.Text('Description') + note = fields.Text('Description') user_id = fields.Many2one('res.users', string='users', default=lambda self: self.env.user) company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env.user.company_id) @@ -54,6 +54,7 @@ class OrientationChecklistRequest(models.Model): ir_model_data = self.env['ir.model.data'] try: template_id = ir_model_data._xmlid_lookup('employee_orientation.orientation_request_mailer')[2] + print(template_id) except ValueError: template_id = False try: @@ -61,6 +62,7 @@ class OrientationChecklistRequest(models.Model): except ValueError: compose_form_id = False ctx = dict(self.env.context or {}) + print(template_id) ctx.update({ 'default_model': 'orientation.request', 'default_res_id': self.ids[0], diff --git a/employee_orientation/security/ir.model.access.csv b/employee_orientation/security/ir.model.access.csv index 6f736f265..b94468166 100644 --- a/employee_orientation/security/ir.model.access.csv +++ b/employee_orientation/security/ir.model.access.csv @@ -6,3 +6,5 @@ access_manager_employee_orientation_request,orientation.checklist,model_orientat access_user_employee_training,employee.training,model_employee_training,hr.group_hr_user,1,1,1,1 access_manager_employee_training,employee.training,model_employee_training,base.group_user,1,1,0,0 access_manager_orientation_request,orientation.request,model_orientation_request,base.group_user,1,1,0,0 +access_orientation_complete,orientation.complete,model_orientation_force_complete,hr.group_hr_user,1,1,1,1 + diff --git a/employee_orientation/views/employee_orientation.xml b/employee_orientation/views/employee_orientation.xml index 3454fe54c..1844246a9 100644 --- a/employee_orientation/views/employee_orientation.xml +++ b/employee_orientation/views/employee_orientation.xml @@ -6,9 +6,9 @@ employee.orientation - - - + + + @@ -33,18 +33,18 @@ - - + + - + - + - + @@ -54,8 +54,8 @@
- - + + @@ -66,7 +66,7 @@ - + @@ -82,13 +82,9 @@ employee.orientation - - + + - - - - diff --git a/employee_orientation/views/employee_training.xml b/employee_orientation/views/employee_training.xml index a91685810..774ef5bea 100644 --- a/employee_orientation/views/employee_training.xml +++ b/employee_orientation/views/employee_training.xml @@ -7,8 +7,8 @@ - - + + @@ -29,21 +29,20 @@ - + - + - - + @@ -22,15 +22,15 @@ - + - + - + @@ -50,12 +50,8 @@ - + - - - - diff --git a/employee_orientation/views/orientation_checklist_line.xml b/employee_orientation/views/orientation_checklist_line.xml index 754fd25c8..4aaa78e70 100644 --- a/employee_orientation/views/orientation_checklist_line.xml +++ b/employee_orientation/views/orientation_checklist_line.xml @@ -8,7 +8,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -34,12 +34,8 @@ - + - - - - diff --git a/employee_orientation/views/orientation_checklists_request.xml b/employee_orientation/views/orientation_checklists_request.xml index 75b3af155..63545526e 100644 --- a/employee_orientation/views/orientation_checklists_request.xml +++ b/employee_orientation/views/orientation_checklists_request.xml @@ -7,7 +7,7 @@ - + @@ -27,19 +27,19 @@ - + - + - + @@ -57,10 +57,6 @@ - - - - diff --git a/employee_orientation/views/orientation_request_mail_template.xml b/employee_orientation/views/orientation_request_mail_template.xml index bb1e5da3d..bcb9645d4 100644 --- a/employee_orientation/views/orientation_request_mail_template.xml +++ b/employee_orientation/views/orientation_request_mail_template.xml @@ -3,8 +3,8 @@ Employee Orientation Request - {{(object.user_id.email or object.company_id.email)}} - {{(object.partner_id.email)}} + {{(object.user_id.login or object.company_id.email)}} + {{(object.partner_id.work_email)}} Employee Orientation Request @@ -71,20 +71,21 @@ Employee Training program {{(object.user_id.email or object.company_id.email)}} - {{(object.program_convener.email)}} + {{(object.program_convener_id.login)}} Employee Training Request

- Hello , + Hello + ,

You are requested to conduct Training program for - + department from diff --git a/employee_orientation/wizard/orientation_complete.py b/employee_orientation/wizard/orientation_complete.py index 5c4fff6ae..d6f60cc3a 100644 --- a/employee_orientation/wizard/orientation_complete.py +++ b/employee_orientation/wizard/orientation_complete.py @@ -34,7 +34,7 @@ class OrientationForceComplete(models.TransientModel): def pending_lines(self): pending = [] - for data in self.orientation_id.orientation_request: + for data in self.orientation_id.orientation_request_ids: if data.state == 'new': pending.append(data.id) self.update({'orientation_lines': pending})