Employees family, education, and other fields added

This commit is contained in:
Pranay 2025-03-12 17:44:06 +05:30
parent 106171103a
commit 56179c5d18
12 changed files with 388 additions and 14 deletions

View File

@ -16,15 +16,16 @@
# for the full list
'category': 'Human Resources/Employees',
'version': '0.1',
'license': 'LGPL-3',
# any module necessary for this one to work correctly
'depends': ['base','hr'],
'depends': ['base','hr','account','mail','hr_skills'],
# always loaded
'data': [
'security/security.xml',
'security/ir.model.access.csv',
'views/hr_employee.xml',
'views/bank_details.xml',
'wizards/work_location_wizard.xml'
],
}

View File

@ -1,2 +1,7 @@
from . import hr_employee
from . import work_location_history
from . import education_history
from . import employer_history
# from . import hr_employee_attachments
from . import family_details
from . import bank_details

View File

@ -0,0 +1,12 @@
from odoo import api, fields, models
class Bank(models.Model):
_inherit = 'res.bank'
branch = fields.Char(string='Branch')
class PartnerBank(models.Model):
_inherit='res.partner.bank'
full_name = fields.Char(string="Full Name(as per bank)")

View File

@ -0,0 +1,24 @@
from odoo import models, fields
class EducationHistory(models.Model):
_name = "education.history"
_description = "Education Details"
_rec_name = "name"
name = fields.Char(string="Specialization", required=True)
university = fields.Char(string="University/Institute", required=True)
start_year = fields.Integer(string="Start Year", required=True)
end_year = fields.Integer(string="End Year", required=True)
marks_or_grade = fields.Char(string="Marks/Grade", required=True)
education_type = fields.Selection([
('10', '10th'),
('inter', 'Inter'),
('graduation', 'Graduation'),
('post_graduation', 'Post Graduation'),
('additional', 'Additional Qualification'),
], string="Education Type", required=True)
employee_id = fields.Many2one('hr.employee')

View File

@ -0,0 +1,12 @@
from odoo import models, fields
class EmployerHistory(models.Model):
_name = 'employer.history'
_description = 'Employee Work History'
company_name = fields.Char(string='Company Name', required=True)
designation = fields.Char(string='Designation', required=True)
date_of_joining = fields.Date(string='Date of Joining', required=True)
last_working_day = fields.Date(string='Last Working Day')
ctc = fields.Char(string='CTC')
employee_id = fields.Many2one('hr.employee')

View File

@ -0,0 +1,23 @@
from odoo import models, fields
class FamilyDetails(models.Model):
_name = "family.details"
_description = "Family Details"
_rec_name = "name"
name = fields.Char(string="Full Name", required=True)
contact_no = fields.Char(string="Contact No")
dob = fields.Date(string="Date of Birth")
location = fields.Char(string="Location")
relation_type = fields.Selection([
('father', 'Father'),
('mother', 'Mother'),
('spouse', 'Spouse'),
('kid1', 'Kid 1'),
('kid2', 'Kid 2'),
], string="Relation Type", required=True)
employee_id = fields.Many2one('hr.employee')

View File

@ -20,6 +20,18 @@ class HrEmployeeBase(models.AbstractModel):
emp_type = fields.Many2one('hr.contract.type', "Employee Type", tracking=True)
blood_group = fields.Selection([
('A+', 'A+'),
('A-', 'A-'),
('B+', 'B+'),
('B-', 'B-'),
('O+', 'O+'),
('O-', 'O-'),
('AB+', 'AB+'),
('AB-', 'AB-'),
], string="Blood Group")
@api.constrains('identification_id')
def _check_identification_id(self):
@ -84,3 +96,31 @@ class HrEmployeeBase(models.AbstractModel):
total_months = record.previous_exp % 12
record.total_exp = f"{total_years} years {total_months} months 0 days"
class HrEmployee(models.Model):
_inherit = 'hr.employee'
education_history = fields.One2many('education.history','employee_id', string='Education Details')
employer_history = fields.One2many('employer.history','employee_id', string='Education Details')
family_details = fields.One2many('family.details','employee_id',string='Family Details')
permanent_street = fields.Char(string="permanent Street", groups="hr.group_hr_user")
permanent_street2 = fields.Char(string="permanent Street2", groups="hr.group_hr_user")
permanent_city = fields.Char(string="permanent City", groups="hr.group_hr_user")
permanent_state_id = fields.Many2one(
"res.country.state", string="permanent State",
domain="[('country_id', '=?', private_country_id)]",
groups="hr.group_hr_user")
permanent_zip = fields.Char(string="permanent Zip", groups="hr.group_hr_user")
permanent_country_id = fields.Many2one("res.country", string="permanent Country", groups="hr.group_hr_user")
marriage_anniversary_date = fields.Date(string='Anniversary Date', tracking=True)
passport_start_date = fields.Date(string='Passport Issued Date')
passport_end_date = fields.Date(string='Passport End Date')
passport_issued_location = fields.Char(string='Passport Issued Location')
previous_company_pf_no = fields.Char(string='Previous Company PF No')
previous_company_uan_no = fields.Char(string='Previous Company UAN No')

View File

@ -0,0 +1,10 @@
from odoo import models, fields
class HrEmployeeAttachment(models.Model):
_name = 'hr.employee.attachment'
_description = 'Attachments for Work History and Education Details'
name = fields.Char(string='Attachment Name', required=True)
file = fields.Binary(string='File', required=True)
employer_history_id = fields.Many2one('employer.history', string='Employer History')
education_history_id = fields.Many2one('education.history', string='Education History')

View File

@ -1,3 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_emp_work_location_history,emp.work.location.history,model_emp_work_location_history,base.group_user,1,1,1,1
access_work_location_wizard,work.location.wizard,model_work_location_wizard,base.group_user,1,1,1,1
access_education_history,education.history,model_education_history,base.group_user,1,1,1,1
access_employer_history,employer.history,model_employer_history,base.group_user,1,1,1,1
access_family_details,family.details,model_family_details,base.group_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_emp_work_location_history emp.work.location.history model_emp_work_location_history base.group_user 1 1 1 1
3 access_work_location_wizard work.location.wizard model_work_location_wizard base.group_user 1 1 1 1
4 access_education_history education.history model_education_history base.group_user 1 1 1 1
5 access_employer_history employer.history model_employer_history base.group_user 1 1 1 1
6 access_family_details family.details model_family_details base.group_user 1 1 1 1
7

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="view_res_bank_form_inherit" model="ir.ui.view">
<field name="name">base_view_res_bank_form_inherit</field>
<field name="model">res.bank</field>
<field name="inherit_id" ref="base.view_res_bank_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='bic']" position="after">
<field name="branch"/>
</xpath>
</field>
</record>
<record id="view_partner_bank_form_inherit_account_inherit" model="ir.ui.view">
<field name="name">view_partner_bank_form_inherit_account_inherit</field>
<field name="model">res.partner.bank</field>
<field name="inherit_id" ref="account.view_partner_bank_form_inherit_account"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='acc_number']" position="after">
<field name="full_name"/>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Form View -->
<record id="view_education_details_form" model="ir.ui.view">
<field name="name">education.details.form</field>
<field name="model">education.details</field>
<field name="arch" type="xml">
<form string="Education Details">
<sheet>
<group>
<group>
<field name="education_type"/>
<field name="name"/>
<field name="university"/>
</group>
<group>
<field name="start_year"/>
<field name="end_year"/>
<field name="marks_or_grade"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<!-- list/List View -->
<record id="view_education_details_list" model="ir.ui.view">
<field name="name">education.details.list</field>
<field name="model">education.details</field>
<field name="arch" type="xml">
<list string="Education Details">
<field name="education_type"/>
<field name="name"/>
<field name="university"/>
<field name="start_year"/>
<field name="end_year"/>
<field name="marks_or_grade"/>
</list>
</field>
</record>
<!-- Action -->
<record id="action_education_details" model="ir.actions.act_window">
<field name="name">Education Details</field>
<field name="res_model">education.details</field>
<field name="view_mode">list,form</field>
</record>
<!-- Menu Items -->
<!-- <menuitem-->
<!-- id="hr_employee_education_details"-->
<!-- name="Education Details"-->
<!-- action="hr_resume_type_action"-->
<!-- parent="hr_skills.menu_human_resources_configuration_resume"-->
<!-- sequence="3"-->
<!-- groups="base.group_no_one"/>-->
</odoo>

View File

@ -1,11 +1,138 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="hr_skills_hr_employee_view_form_inherit" model="ir.ui.view">
<field name="name">hr.employee.skills.form.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr_skills.hr_employee_view_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='skills_resume']" position="inside">
<div>
<div>
<separator string="Employer History"/>
<!-- This field uses a custom list view rendered by the 'resume_one2many' widget.
Adding fields in the list arch below makes them accessible to the widget
-->
<field mode="list" nolabel="1" name="employer_history">
<list string="Employer Details">
<field name="company_name"/>
<field name="designation"/>
<field name="date_of_joining"/>
<field name="last_working_day"/>
<field name="ctc"/>
<field name="employee_id" column_invisible="1"/>
</list>
<form string="Employer Details">
<sheet>
<group>
<group>
<field name="company_name"/>
<field name="designation"/>
</group>
<group>
<field name="date_of_joining"/>
<field name="last_working_day"/>
<field name="ctc"/>
<field name="employee_id" invisible="1"/>
</group>
</group>
</sheet>
</form>
</field>
</div>
<div>
<separator string="Education History"/>
<field mode="list" nolabel="1" name="education_history"
class="mt-2">
<list string="Education Details">
<field name="education_type"/>
<field name="name"/>
<field name="university"/>
<field name="start_year"/>
<field name="end_year"/>
<field name="marks_or_grade"/>
<field name="employee_id" column_invisible="1"/>
</list>
<form string="Education Details">
<sheet>
<group>
<group>
<field name="education_type"/>
<field name="name"/>
<field name="university"/>
</group>
<group>
<field name="start_year"/>
<field name="end_year"/>
<field name="marks_or_grade"/>
<field name="employee_id" invisible="1"/>
</group>
</group>
</sheet>
</form>
</field>
</div>
</div>
</xpath>
</field>
</record>
<record id="view_employee_form_inherit" model="ir.ui.view">
<field name="name">hr.employee.form.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='passport_id']" position="after">
<field name="passport_start_date"/>
<field name="passport_end_date"/>
<field name="passport_issued_location"/>
</xpath>
<xpath expr="//field[@name='marital']" position="after">
<field name="marriage_anniversary_date" invisible="marital != 'married'"/>
</xpath>
<xpath expr="//page[@name='personal_information']/group" position="inside">
<h5>Family Details</h5>
<field name="family_details">
<list editable="bottom">
<field name="relation_type"/>
<field name="name"/>
<field name="contact_no"/>
<field name="dob"/>
<field name="location"/>
</list>
</field>
<br/>
<br/>
<h5>Education Details</h5>
<field name="education_history">
<list string="Education Details">
<field name="education_type"/>
<field name="name"/>
<field name="university"/>
<field name="start_year"/>
<field name="end_year"/>
<field name="marks_or_grade"/>
<field name="employee_id" column_invisible="1"/>
</list>
</field>
<br/>
<br/>
<h5>Employer History</h5>
<field name="employer_history">
<list string="Employer Details">
<field name="company_name"/>
<field name="designation"/>
<field name="date_of_joining"/>
<field name="last_working_day"/>
<field name="ctc"/>
<field name="employee_id" column_invisible="1"/>
</list>
</field>
</xpath>
<xpath expr="//field[@name='employee_type']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
@ -26,14 +153,16 @@
<field name="pan_no"/>
</xpath>
<xpath expr="//header" position="inside">
<button name="open_work_location_wizard" type="object" string="Update Work Location" class="btn-primary" groups="hr.group_hr_manager"/>
<button name="open_work_location_wizard" type="object" string="Update Work Location"
class="btn-primary" groups="hr.group_hr_manager"/>
</xpath>
<xpath expr="//notebook" position="inside">
<page name="work_location_history_page" string="Work Location History" groups="hr.group_hr_manager">
<field name="work_loc_history">
<list editable="bottom">
<field name="employee_id" column_invisible="1"/>
<field name="work_location_type" options="{'no_quick_create': True, 'no_create_edit': True, 'no_open': True}"/>
<field name="work_location_type"
options="{'no_quick_create': True, 'no_create_edit': True, 'no_open': True}"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="note"/>
@ -41,6 +170,31 @@
</field>
</page>
</xpath>
<xpath expr="//field[@name='private_car_plate']" position="after">
<field name="blood_group"/>
</xpath>
<xpath expr="//field[@name='private_email']" position="before">
<label for="permanent_street" string="Permanent Address"/>
<div class="o_address_format">
<field name="permanent_street" placeholder="Street..." class="o_address_street"/>
<field name="permanent_street2" placeholder="Street 2..." class="o_address_street"/>
<field name="permanent_city" placeholder="City" class="o_address_city"/>
<field name="permanent_state_id" class="o_address_state" placeholder="State"
options="{'no_open': True, 'no_quick_create': True}"
context="{'default_country_id': private_country_id}"/>
<field name="permanent_zip" placeholder="ZIP" class="o_address_zip"/>
<field name="permanent_country_id" placeholder="Country" class="o_address_country"
options="{&quot;no_open&quot;: True, &quot;no_create&quot;: True}"/>
</div>
</xpath>
<xpath expr="//page[@name='hr_settings']" position="inside">
<group>
<group string="PF Details" name="pf_details">
<field name="previous_company_pf_no"/>
<field name="previous_company_uan_no"/>
</group>
</group>
</xpath>
</field>
</record>
@ -55,22 +209,24 @@
<xpath expr="//field[@name='work_location_id']" position="after">
<field name="doj"/>
</xpath>
<!-- <xpath expr="//field[@name='identification_id']" position="attributes">-->
<!-- <attribute name="string">AADHAR No</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='identification_id']" position="after">-->
<!-- <field name="pan_no"/>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='identification_id']" position="attributes">-->
<!-- <attribute name="string">AADHAR No</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='identification_id']" position="after">-->
<!-- <field name="pan_no"/>-->
<!-- </xpath>-->
</field>
</record>
<record id="mail.menu_root_discuss" model="ir.ui.menu">
<field name="groups_id" eval="[(3,ref('base.group_user')),(4, ref('hr_employee_extended.group_internal_user'))]"/>
<field name="groups_id"
eval="[(3,ref('base.group_user')),(4, ref('hr_employee_extended.group_internal_user'))]"/>
</record>
<record id="hr.menu_hr_root" model="ir.ui.menu">
<field name="groups_id" eval="[(3,ref('hr.group_hr_manager')),(3,ref('hr.group_hr_user')),(3,ref('base.group_user')),(3,ref('hr_employee_extended.group_external_user')),(4, ref('hr_employee_extended.group_internal_user'))]"/>
<field name="groups_id"
eval="[(3,ref('hr.group_hr_manager')),(3,ref('hr.group_hr_user')),(3,ref('base.group_user')),(3,ref('hr_employee_extended.group_external_user')),(4, ref('hr_employee_extended.group_internal_user'))]"/>
</record>
</data>
</odoo>