diff --git a/addons_extensions/disciplinary/__init__.py b/addons_extensions/disciplinary/__init__.py
new file mode 100755
index 000000000..5305644df
--- /dev/null
+++ b/addons_extensions/disciplinary/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import models
\ No newline at end of file
diff --git a/addons_extensions/disciplinary/__manifest__.py b/addons_extensions/disciplinary/__manifest__.py
new file mode 100755
index 000000000..266297f2d
--- /dev/null
+++ b/addons_extensions/disciplinary/__manifest__.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+{
+ 'name': 'Disciplinary',
+ 'version': '1.0.0',
+ 'category': 'Apps',
+ 'summary': 'Disciplinary',
+ 'description': 'Employee Disciplinary',
+ 'sequence': '10',
+ 'author': '',
+ 'company': 'FTPROTECH',
+ 'website': 'https://www.ftprotech.in',
+ 'depends': ['mail', 'hr', 'base', 'website_hr_recruitment', 'contacts', 'point_of_sale'],
+ 'demo': [],
+ 'data': [
+ 'data/sequence.xml',
+ 'security/ir.model.access.csv',
+ 'views/disciplinary_view.xml',
+ 'views/employee_displance.xml',
+ 'views/mistake_type_views.xml',
+ 'views/incident_sub_type.xml',
+ 'views/disciplinary_complaint_type.xml',
+ ],
+ 'installable': True,
+ 'application': False,
+ 'auto_install': False,
+ 'license': 'LGPL-3',
+}
diff --git a/addons_extensions/disciplinary/data/sequence.xml b/addons_extensions/disciplinary/data/sequence.xml
new file mode 100755
index 000000000..e291002e1
--- /dev/null
+++ b/addons_extensions/disciplinary/data/sequence.xml
@@ -0,0 +1,28 @@
+
+
+
+
+ Employee Disciplinary
+ employee.disciplinary
+ IR
+ 5
+
+
+
+
+ Manage Incident
+ manage.incident
+ MI
+ 5
+
+
+
+
+ Disciplinary Sequence
+ hr.employee.sequence
+ ED
+ 5
+
+
+
+
\ No newline at end of file
diff --git a/addons_extensions/disciplinary/models/__init__.py b/addons_extensions/disciplinary/models/__init__.py
new file mode 100755
index 000000000..2a55d3a16
--- /dev/null
+++ b/addons_extensions/disciplinary/models/__init__.py
@@ -0,0 +1,2 @@
+from . import disciplinary
+from . import employee_displane
\ No newline at end of file
diff --git a/addons_extensions/disciplinary/models/disciplinary.py b/addons_extensions/disciplinary/models/disciplinary.py
new file mode 100755
index 000000000..3c78c4edd
--- /dev/null
+++ b/addons_extensions/disciplinary/models/disciplinary.py
@@ -0,0 +1,188 @@
+from datetime import datetime, date
+from odoo import fields, models, api
+
+#
+# class NameChangeHrEmployee(models.Model):
+# _inherit = "hr.employee"
+#
+# employee_name_ids1 = fields.One2many('employee.disciplinary', 'disp_name')
+# employee_self_service_line_ids = fields.One2many('manage.incident', 'emp_incident', domain=[('state', '=', 'closed')])
+#
+# def name_get(self):
+# result = []
+# for record in self:
+# if self.env.context.get('new_custom_name', False):
+# result.append((record.id, "{} - {}".format(record.name, record.identification_id)))
+# else:
+# return super(NameChangeHrEmployee, self).name_get()
+# return result
+
+
+class EmployeeDisciplinary(models.Model):
+ _name = 'employee.disciplinary'
+ _inherit = ['mail.thread', 'mail.activity.mixin']
+ _rec_name = 'incident_type'
+
+ incident_date = fields.Datetime(string='Incident Date & Time', tracking=True, default=datetime.now(), required=True)
+ incident_type = fields.Many2one('incident.employee', string='Incident Type', tracking=True, required=True)
+ incident_sub_type = fields.Many2many('incident.sub.employee', string='Incident Sub Type', tracking=True,
+ required=True)
+ incident_details = fields.Char(string='Incident Details', tracking=True, required=True)
+ seized_items = fields.Char(string='Seized Items', tracking=True)
+ incident_summary = fields.Text(string='Incident Summary', tracking=True, required=True)
+ attach = fields.Many2many('ir.attachment', string='Attachments', tracking=True)
+ emp_many_disp = fields.Many2many('hr.employee', 'new_custom_table', string='Employees Involved in the Incident',
+ tracking=True, required=True)
+ date_action = fields.Date(string='Date')
+ employee = fields.Many2one('manage.incident')
+ employee_code = fields.Many2one("hr.employee", string="Employee Name", required=True)
+ employee_name = fields.Char(related="employee_code.identification_id")
+ disp_name = fields.Many2one('hr.employee')
+
+ @api.onchange('incident_type')
+ def return_incident_sub_type(self):
+ print(self.incident_type.sub_type)
+ listed = []
+ for recs in self.incident_type.sub_type:
+ listed.append(recs.id)
+ return {'domain': {'incident_sub_type': [('id', 'in', listed)]}}
+
+ @api.constrains('incident_type')
+ def create_manage_incidents(self):
+ for rec in self:
+ print('created')
+ self.env['manage.incident'].create({
+ 'employee_disciplinary_id': rec.id,
+ })
+
+ @api.constrains('employee')
+ def holds_hr_employee(self):
+ for rec in self:
+ rec.disp_name = rec.employee.employee_code_list1
+
+
+class IncidentEmployee(models.Model):
+ _name = 'incident.employee'
+
+ name = fields.Char(string='Incident')
+ sub_type = fields.Many2many('incident.sub.employee', string='Sub type')
+
+
+class IncidentSubEmployee(models.Model):
+ _name = 'incident.sub.employee'
+
+ name = fields.Char(string='Incident Sub')
+
+class DisciplinaryMistakeType(models.Model):
+ _name = 'disciplinary.mistake.type'
+ _description = 'Disciplinary Mistake Type'
+
+ name = fields.Char(string="Mistake Type", required=True)
+
+class IncidentSubEmployee(models.Model):
+ _name = 'incident.sub.employee'
+ _description = 'Incident Sub Type'
+
+ name = fields.Char(string="Incident Sub Type", required=True)
+
+class EmployeeDisciplinaryLines(models.Model):
+ _name = 'employee.disciplinary.line'
+ _rec_name = 'hr_emp_many'
+
+ emp_many = fields.Many2one('employee.disciplinary', string='Employee Disp')
+ hr_emp_many = fields.Many2one('hr.employee', string='Employee Number')
+ hr_emp_many_name = fields.Char(related='hr_emp_many.name', string='Employee Name')
+
+
+class ManageIncident(models.Model):
+ _name = 'manage.incident'
+ _inherit = ['mail.thread', 'mail.activity.mixin']
+
+ # employee_name_ids = fields.One2many('employee.disciplinary','employee',string="Employee Name")
+ employee_disciplinary_id = fields.Many2one("employee.disciplinary", string="Employee Disp")
+ employee_code_list1 = fields.Many2many("hr.employee", string="Employees Involved in the Incident",
+ related='employee_disciplinary_id.emp_many_disp', tracking=True)
+ incident_dat = fields.Datetime(related='employee_disciplinary_id.incident_date', string='Incident Date & Time',
+ tracking=True)
+ employee_by_code = fields.Many2one(related='employee_disciplinary_id.employee_code',
+ string="Reported By Employee Name")
+ incident_sum = fields.Text(related='employee_disciplinary_id.incident_summary', string='Incident Summary',
+ tracking=True)
+ incident_typ = fields.Many2one(related='employee_disciplinary_id.incident_type', string="Incident Type",
+ tracking=True)
+ incident_sub_typ = fields.Many2many(related='employee_disciplinary_id.incident_sub_type',
+ string="Incident Sub Type", tracking=True)
+ # corrective_action_emp_id = fields.Many2one(related='employee_disciplinary_id.corrective_action_id',
+ # string="Corrective Action", tracking=True)
+ state = fields.Selection(([
+ ('pending_inquiry', 'Pending Inquiry'),
+ ('in_progress', 'In Process'),
+ ('closed', 'Closed')
+ ]), string="Status", default='pending_inquiry', tracking=True)
+ emp_incident = fields.Many2one('hr.employee')
+ employee_inquiry = fields.One2many('manage.incident.line', 'employee_inquiry_state')
+
+ def button_in_progress(self):
+ self.state = 'in_progress'
+
+ # def button_closed(self):
+ # for rec in self:
+ # rec.state = 'closed'
+
+ def button_closed(self):
+ for rec in self:
+ rec.state = 'closed'
+ update_into_employee = rec.env['hr.employee'].search([('id', '=', rec.employee_code_list1.id)])
+ records = {
+ }
+ if records:
+ update_into_employee.write(records)
+
+ print('triggered 2')
+
+
+
+
+
+
+class CorrectiveActions(models.Model):
+ _name = "corrective.actions"
+
+ name = fields.Char(string="Name")
+
+
+class ManageIncidentLine(models.Model):
+ _name = 'manage.incident.line'
+ _inherit = ['mail.thread']
+ _description = 'Manage Incident Line'
+
+ corrective_action_id = fields.Many2one('corrective.actions', string="Corrective Action", tracking=True,
+ required=True)
+ internal_panel = fields.Many2many('hr.employee', string="Internal Panel Members", tracking=True,
+ required=True)
+ external_panel = fields.Char(string="External Panel Members")
+ due_date = fields.Date(string="Due Date")
+ last_action_date = fields.Datetime(string="Last Action Date", compute='_compute_last_action_date',
+ default=date.today())
+ recommendation = fields.Char(string="Recommendation", tracking=True, required=True)
+ venue = fields.Char(string='Venue')
+ inquiry_summary = fields.Char(string='Inquiry Summary', tracking=True, required=True)
+ is_guilty = fields.Selection(([
+ ('yes', 'Yes'),
+ ('no', 'No'),
+ ]), string="Is the Employee Guilt of the Incident", default='no', tracking=True)
+ inquiry_date = fields.Datetime(string="Inquiry Date and Time", required=True)
+ employee_inquiry_state = fields.Many2one('manage.incident')
+
+ @api.depends('inquiry_date')
+ def _compute_last_action_date(self):
+ for line in self:
+ if not line.employee_inquiry_state or line == line.employee_inquiry_state.employee_inquiry[0]:
+ line.last_action_date = False
+ else:
+ previous_line = line.employee_inquiry_state.employee_inquiry.filtered(lambda l: l.inquiry_date < line.inquiry_date)
+ sorted_previous_line = previous_line.sorted(key=lambda l: l.inquiry_date, reverse=True)
+ if sorted_previous_line:
+ line.last_action_date = sorted_previous_line[0].inquiry_date
+ else:
+ line.last_action_date = False
diff --git a/addons_extensions/disciplinary/security/ir.model.access.csv b/addons_extensions/disciplinary/security/ir.model.access.csv
new file mode 100755
index 000000000..233dcb2b0
--- /dev/null
+++ b/addons_extensions/disciplinary/security/ir.model.access.csv
@@ -0,0 +1,22 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_employee_disciplinary,employee_disciplinary,model_employee_disciplinary,,1,1,1,1
+access_incident_employee,incident_employee,model_incident_employee,,1,1,1,1
+access_incident_sub_employee,incident_sub_employee,model_incident_sub_employee,,1,1,1,1
+access_employee_disciplinary_line,employee_disciplinary_line,model_employee_disciplinary_line,,1,1,1,1
+access_manage_incident,manage_incident,model_manage_incident,,1,1,1,1
+access_manage_incident_line,manage_incident_line,model_manage_incident_line,,1,1,1,1
+access_corrective_actions,corrective_actions,model_corrective_actions,,1,1,1,1
+
+access_hr_employee_disciplinary,hr.employee.disciplinary,model_hr_employee_disciplinary,,1,1,1,1
+access_hr_disciplinary_complaint_line,hr.disciplinary.complaint.line,model_hr_disciplinary_complaint_line,,1,1,1,1
+access_hr_disciplinary_action_line,hr.disciplinary.action.line,model_hr_disciplinary_action_line,,1,1,1,1
+access_disciplinary_action_type,disciplinary.action.type,model_disciplinary_action_type,,1,1,1,1
+access_disciplinary_complaint_type,disciplinary.complaint.type,model_disciplinary_complaint_type,,1,1,1,1
+access_disciplinary_mistake_type,disciplinary.mistake.type,model_disciplinary_mistake_type,,1,1,1,1
+
+
+
+
+
+
+
diff --git a/addons_extensions/disciplinary/views/disciplinary_view.xml b/addons_extensions/disciplinary/views/disciplinary_view.xml
new file mode 100755
index 000000000..08a3bfdd9
--- /dev/null
+++ b/addons_extensions/disciplinary/views/disciplinary_view.xml
@@ -0,0 +1,264 @@
+
+
+
+
+ Employee Disciplinary list
+ employee.disciplinary
+
+
+
+
+
+
+
+
+
+
+
+ Employee Disciplinary form
+ employee.disciplinary
+
+
+
+
+
+
+
+ Manage Incident list
+ manage.incident
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Manage Incident form
+ manage.incident
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ incident Employee list
+ incident.employee
+
+
+
+
+
+
+
+
+
+ incident Employee form
+ incident.employee
+
+
+
+
+
+
+
+ Incident Reporting
+ employee.disciplinary
+ list,form
+
+
+
+
+ Manage Incident
+ manage.incident
+ list,form
+
+
+
+ Incident Type
+ incident.employee
+ list,form
+
+
+
+ Employee Disciplinary
+ hr.employee.disciplinary
+ list,form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons_extensions/disciplinary/views/incident_sub_type.xml b/addons_extensions/disciplinary/views/incident_sub_type.xml
new file mode 100644
index 000000000..bd4c35cce
--- /dev/null
+++ b/addons_extensions/disciplinary/views/incident_sub_type.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ incident.sub.employee.list
+ incident.sub.employee
+
+
+
+
+
+
+
+
+
+ incident.sub.employee.form
+ incident.sub.employee
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Incident Sub Type
+ incident.sub.employee
+ list,form
+
+
+
+
+
+
+
+
+
+
diff --git a/addons_extensions/disciplinary/views/mistake_type_views.xml b/addons_extensions/disciplinary/views/mistake_type_views.xml
new file mode 100644
index 000000000..cbc9efe6c
--- /dev/null
+++ b/addons_extensions/disciplinary/views/mistake_type_views.xml
@@ -0,0 +1,42 @@
+
+
+
+
+ mistake.type.list
+ disciplinary.mistake.type
+
+
+
+
+
+
+
+
+
+ mistake.type.form
+ disciplinary.mistake.type
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mistake Type
+ disciplinary.mistake.type
+ list,form
+
+
+
+
\ No newline at end of file