Merge pull request #45 from expsa/migration-modules

hr_custom_contaract
This commit is contained in:
ahmed-nouri051 2025-10-09 11:46:44 +02:00 committed by GitHub
commit 085db46f6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 7583 additions and 0 deletions

View File

@ -0,0 +1 @@
from . import models

View File

@ -0,0 +1,24 @@
{
"name": "HR Contract Custom",
"version": "18.0.1.0.0",
"category": "Odex25-HR/Odex25-HR",
"depends": [
"hr_contract",
"hr_base"
],
"data": [
"security/ir.model.access.csv",
"security/ir_rules.xml",
"data/ir_sequence.xml",
"data/ir_cron.xml",
"views/contract_view.xml",
"views/hr_re_contract_view.xml",
"views/hr_contract_extension_view.xml",
"views/hr_employee_view.xml",
"report/employee_contract_report_template.xml",
"report/employee_dependents_report_template.xml",
"report/payroll_template.xml",
"report/probationary_evaluation.xml",
"data/mail_template.xml",
],
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="contracts_mail_reminder" model="ir.cron">
<field name="name">Employee contract Period Expiration</field>
<field name="model_id" ref="model_hr_contract" />
<field name="state">code</field>
<field name="code">model.contract_mail_reminder()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<!-- <field name="numbercall">-1</field>-->
</record>
</odoo>

View File

@ -0,0 +1,11 @@
<odoo>
<data>
<!--contract sequence-->
<record id="contract_sequence" model="ir.sequence">
<field name="name">contract_sequence_name</field>
<field name="code">hr.contract</field>
<field name="prefix">Contract/</field>
<field name="padding">5</field>
</record>
</data>
</odoo>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" ?>
<odoo>
<data noupdate="1">
<record id="email_template_contract_period_expiration_reminder" model="mail.template">
<field name="name">Contract Period Expiration Reminder</field>
<field name="subject">Contract- ${object.name} Expired End Period On ${object.date_end}</field>
<!--field name="email_to">${user.company_id.email|safe}</field-->
<field name="email_to">${object.employee_id.parent_id.user_id.partner_id.email}</field>
<field name="email_cc">${user.company_id.hr_email|safe}</field>
<field name="model_id" ref="hr_contract_custom.model_hr_contract"/>
<field name="auto_delete" eval="True"/>
<field name="body_html">
<![CDATA[
<p>Dear,</p>
<br/>
<p> The Contract of ${object.employee_id.name} is going to expire on ${object.date_end}.
Please renew the contract or end it before expiry date According the notice period.
<br/>
<br/>
<p>Best regards,</p>
]]>
</field>
</record>
<record id="email_template_contract_trial_period_expiration_reminder" model="mail.template">
<field name="name">Contract Trial Period Expiration Reminder</field>
<field name="subject">Contract- ${object.name} Expired Trial Period On ${object.trial_date_end}</field>
<!--field name="email_to">${user.company_id.email|safe}</field-->
<field name="email_to">${object.employee_id.parent_id.user_id.partner_id.email}</field>
<field name="email_cc">${user.company_id.hr_email|safe}</field>
<field name="model_id" ref="hr_contract_custom.model_hr_contract"/>
<field name="auto_delete" eval="True"/>
<field name="body_html">
<![CDATA[
<p>Dear ,</p>
<br/>
<p> The Contract trial period of ${object.employee_id.name} is going to expire on${object.trial_date_end}.
Please renew the trial contract period or contracting is Done it before expiry date According the notice period..
<br/>
<br/>
<p>Best regards,</p>
]]>
</field>
</record>
</data>
</odoo>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from . import hr_contract
from . import hr_employee
from . import hr_re_contract
from . import hr_contract_extension

View File

@ -0,0 +1,746 @@
# -*- coding: utf-8 -*-
import datetime
from datetime import datetime as dt
from datetime import timedelta
from dateutil import relativedelta
from hijri_converter import convert
# from googletrans import Translator
from odoo import models, fields, api, _, exceptions
# translator = Translator()
# Contract
class Contract(models.Model):
_inherit = 'hr.contract'
name = fields.Char(related="employee_id.emp_no", readonly=True, string='Employee Number')
state = fields.Selection(selection=[('draft', _('Draft')),
('employeed_aproval', _('Employeed Approval')),
('hr_head_approval', _('HR Head Approval')),
('program_directory', _('Executive Approval')),
('end_contract', _('End Contract'))], default="draft", tracking=True)
active = fields.Boolean(default=True)
employee_name = fields.Char(related="employee_id.name", readonly=True)
employee_type = fields.Selection(selection=[('saudi', _('Saudi')), ('foreign', _('Foreign')),
('displaced', _('Displaced Tribes')),
('external', _('Outsource1')), ('external2', _('Outsource2'))],
default='saudi',
tracking=True)
contract_status = fields.Selection(selection=[('single', _('single contract')),
('marriage', _('marriage contract'))], default='single',
tracking=True)
contract_duration = fields.Selection(selection=[('3_months', _('3 Months')),
('6_months', _('6 Months')),
('9_months', _('9 Months')),
('12_months', _('12 Months')),
('24_months', _('24 Months')), ('36_months', _('36 Months')),
('none', _('None'))], default='12_months')
experience_year = fields.Integer()
has_end_service_benefit = fields.Boolean(string='Has end service benefits')
# fields on salary information page
suspended = fields.Boolean(string='Suspended')
social_insurance = fields.Boolean(string='Social Insurance')
salary = fields.Float(string='Base Salary', tracking=True)
# fields of information page
wage = fields.Float()
advatages = fields.Text()
trial_date_start = fields.Date(tracking=True)
trial_date_end = fields.Date(tracking=True)
date_start = fields.Date(tracking=True)
date_end = fields.Date(tracking=True)
note = fields.Text()
# fields of dependent page
employee_code = fields.Char()
allow_mbl = fields.Boolean(string='Allow Mobile Allowance')
sign_bonous = fields.Boolean(string='Sign on Bounus')
loan_allow = fields.Boolean(string='Allow Loan Allowance')
air_allow = fields.Boolean(string='Air Allowance')
adults = fields.Integer(string='Adult(s)')
# children = fields.Integer()
infants = fields.Integer()
package = fields.Float()
gosi = fields.Boolean(string='GOSI')
# vehicle_attendance = fields.Integer(string='Vehicle Attendance')
# system_attendance = fields.Integer(string='System Attendance')
# line_manager_attendance = fields.Integer(string='Line Manager Attendance')
# expense_claim = fields.Float(string='Expense Claim')
# hr_visa_ticket = fields.Float(string='HR Visa/Ticket')
# other_allowances = fields.Float(string='Other Allowances')
# advance_salary = fields.Float(string='Advance AGT Salary')
hr_expense = fields.Float(string='Hr Expense')
cash_sales = fields.Float(string='Cash Sales')
traffic_fine = fields.Float(string='Traffic Fine')
bk_balance = fields.Float(string='Bank Balance')
other_deductions = fields.Float(string='Other Deductions')
fn = fields.Char(string="First Name")
mn = fields.Char("Middle Name")
ln = fields.Char(string="Last Name")
dn = fields.Char(string="Display Name")
e_date = fields.Date(string="Effective Date")
status = fields.Selection(selection=[('bachelor', 'Bachelor'), ('family', 'family')], string='Status')
hra = fields.Char("HRA")
t_allow = fields.Float(string="Transport Allowance")
f_allow = fields.Float(string="Food Allowance")
f_ot = fields.Float(string="Fixed OT")
departure = fields.Char(string="Departure Air Port")
destination = fields.Char(string="Destination Air Port")
medical = fields.Selection(selection=[('yes', 'Yes'), ('no', 'No')], string='Medical')
c_accommodation = fields.Selection(selection=[(
'yes', 'Yes'),
('no', 'No')], string='Company Accommodation')
c_vehicle = fields.Selection(selection=[(
'yes', 'Yes'),
('no', 'No')], string='Company Vehicle')
c_vacation = fields.Selection(selection=[(
'12', '12 Months'),
('18', '18 Months'),
('24', '24 Months')], string='Contractual Vacation')
nod = fields.Selection(selection=[(
'12', '12 Months'),
('18', '18 Months'),
('24', '24 Months')], string='Number of days')
probation = fields.Selection(selection=[(
'3', '3 Months'),
('6', '6 Months')], string='Probation')
dependent = fields.Selection(selection=[(
'1', '1+1 '),
('2', '1+2 '),
('3', '1+3 '),
('all', 'All ')], string='Dependent')
incentive = fields.Selection(selection=[(
'yes', 'Yes'),
('no', 'No')], string='Incentive')
monthly_salary = fields.Float(string='Monthly Salary', compute='_compute_monthly_salary')
saudi_emp_type = fields.Selection([('saudi-contract', _('Saudi Contracting')),
('saudi-non', _('Saudi Non-Contracting'))], _('Saudi Employee Type'),
default='saudi-contract')
contract_type = fields.Selection([('local', _('Local')), ('international', _('International'))], _('Contract Type'))
contract_description = fields.Selection([('locum', _('Temporary')), ('permanent', _('Permanent'))],
_('Contract Description'), default='permanent')
house_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('House Allowance Type'), default='none')
house_allowance = fields.Float(_('House Allowance'))
salary_insurnce = fields.Float(string='Salary Insurnce')
overtime_eligible = fields.Selection([('yes', _('Yes')), ('no', _('No'))], _('Overtime Eligibility'), default='no')
overtime_eligible_float = fields.Float(_('Overtime Eligibility Amount'))
exit_and_return = fields.Selection([('yes', _('Yes')), ('no', _('No'))], _('Exit and Return'), default='no')
exit_and_return_amount = fields.Float(_('Exit and Return Amount'), default=200)
air_ticket_eligible = fields.Selection([('yes', _('Yes')), ('no', _('No'))],
_('Air Ticket Eligible'), default='no')
annual_leave = fields.Selection([('yes', 'Yes'), ('no', 'No')], string='Annual Leave', default="no")
annual_leave_days = fields.Float(string='Annual Leave In Days')
transport_allowance_type = fields.Selection(
[('none', _('None')), ('perc', _('Percentage')), ('num', _('Number')), ('company', 'By Company')],
_('Transportation Allowance Type'), default='none')
transport_allowance = fields.Float(_('Transportation Allowance'))
transport_allowance_temp = fields.Float(string='Transportation Allowance', compute='_get_amount')
field_allowance_type = fields.Selection(
[('none', _('None')), ('perc', _('Percentage')), ('num', _('Number')), ('company', 'By Company')],
_('Field Allowance Type'), default='none')
field_allowance = fields.Float(_('Field Allowance'))
field_allowance_temp = fields.Float(string='Field Allowance', compute='_get_amount')
special_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Special Allowance Type'), default='none')
special_allowance = fields.Float(_('Special Allowance'))
special_allowance_temp = fields.Float(_('Special Allowance'), compute='_get_amount')
other_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Other Allowances Type'), default='none')
other_allowance = fields.Float(_('Other Allowances'))
other_allowance_temp = fields.Float(_('Other Allowances'), compute='_get_amount')
travel_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Travel Allowance Type'), default='none')
travel_allowance = fields.Float(_('Travel Allowance'))
travel_allowance_temp = fields.Float(_('Travel Allowance'), compute='_get_amount')
education_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Education Allowance Type'), default='none')
education_allowance = fields.Float(_('Education Allowance'))
education_allowance_temp = fields.Float(_('Education Allowance'), compute='_get_amount')
food_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Food Allowance Type'), default='none')
food_allowance2 = fields.Float(_('Food Allowance'))
food_allowance2_temp = fields.Float(_('Food Allowance'), compute='_get_amount')
security_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Security Allowance Type'), default='none')
security_allowance = fields.Float(_('Security Allowance'))
security_allowance_temp = fields.Float(_('Security Allowance'), compute='_get_amount')
communication_allowance_type = fields.Selection(
[('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Communication Allowance Type'), default='none')
communication_allowance = fields.Float(_('Communication Allowance'))
communication_allowance_temp = fields.Float(_('Communication Allowance'), compute='_get_amount')
retire_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Retire Allowance Type'), default='none')
retire_allowance = fields.Float(_('Retirement Allowance'))
infect_allowance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Infection Allowance Type'), default='none')
infect_allowance = fields.Float(_('Infection Allowance'))
supervision_allowance_type = fields.Selection(
[('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Supervision Allowance Type'), default='none')
supervision_allowance = fields.Float(_('Supervision Allowance'))
insurance_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Insurance Type'), default='none')
insurance = fields.Float(_('Insurance'))
other_deduction_type = fields.Selection([('none', _('None')), ('perc', _('Percentage')), ('num', _('Number'))],
_('Other Deductions Type'), default='none')
other_deduction = fields.Float(_('Other Deductions'))
gosi_deduction = fields.Float(compute="_calculate_gosi", string='Gosi (Employee Percentage)')
gosi_employer_deduction = fields.Float(compute="_calculate_gosi", string='Gosi (Employer Percentage)')
total_gosi = fields.Float(compute="_calculate_gosi", string='Total')
is_gosi_deducted = fields.Selection([('yes', _('Yes')), ('no', _('No'))], default='yes')
blood_type = fields.Selection(
[('O-', 'O'), ('O+', 'O+'), ('A-', 'A'), ('A+', 'A+'), ('B-', 'B'), ('B+', 'B+'), ('AB-', 'AB'),
('AB+', 'AB+')], 'Blood Type')
religion = fields.Selection([('muslim', _('Muslim')), ('christian', _('Christian')), ('other', _('Other'))],
_('Religion'))
gender = fields.Selection([('male', _('Male')), ('female', _('Female'))],
_('Gender'))
birth_place = fields.Char(_('Birth Place'))
point_of_hire = fields.Char(_('Point of hire'))
city = fields.Char(_('City Hired From'))
country = fields.Char(_('Country Hired From'))
contact_address = fields.Char(_('Contact address'), size=512)
date_of_birth = fields.Date(_('Date Of Birth'))
marital = fields.Selection(
[('single', _('Single')), ('married', _('Married')), ('widower', _('Widower')), ('divorced', _('Divorced'))],
_('Marital Status'), default='single')
mobile_no = fields.Char(_('Mobile No'))
p_o_box_no = fields.Char(_('P. O. Box'))
zip_code = fields.Char(_('Zip Code'))
saudi_id_iqama = fields.Char(_('Saudi ID / Identity No.'))
saudi_id_iqama_date = fields.Date(_('Saudi ID / Identity Issue Date'))
saudi_id_iqama_expiry = fields.Date(_('Saudi ID / Identity Expiry Date'))
passport_number = fields.Char(_('Passport number'))
passport_issue_date = fields.Date(_('Passport Issue Date'))
passport_expiry_date = fields.Date(_('Passport Expiry Date'))
passport_issue_place = fields.Char(_('Passport Issue Place'))
saudi_com_number = fields.Char(_('Saudi Commission Number'))
saudi_com_date = fields.Date(_('Saudi Commission Issue Date'))
saudi_com_expiry_date = fields.Date(_('Saudi Commission Expiry Date'))
bls_date = fields.Date(_('BLS Date'))
acls_date = fields.Date(_('ACLS Date'))
insurance_date = fields.Date(_('Insurance Date'))
specialty = fields.Char(_('Specialty'))
category = fields.Char(_('Category'))
effective_from = fields.Date(_('Effective From'))
to_contact = fields.Text(_('To contact in case of Emergency'))
emp_type = fields.Selection([('saudi', _('Holiday1')),
('other', _('Holiday2')),
('displaced', _('Holiday3')),
('external', _('Holiday4')),
('external2', _('Other'))], _('Annual Leave Entitlement'), tracking=True)
appraisal = fields.Boolean(_('Appraisal'))
re_contract = fields.Boolean(_('re contract'))
contract_draft = fields.Boolean(_('Contract Draft'))
breakdown_allowance = fields.Float(compute="_cal_allowance", string='Breakdown Allowance')
car_allowance = fields.Float(_('Car Allowance'))
ticket_allowance = fields.Float(_('Ticket Allowance'))
medical_ins_allowance = fields.Float(_('Medical Insurance Allowance'))
medical_ins_issue_date = fields.Date(_('Medical Insurance Issue Date'))
medical_ins_exp_date = fields.Date(_('Medical Insurance Expiry Date'))
join_date = fields.Date(_('Join Date'))
driving_lic_issue_date = fields.Date(_('Driving License Issue Date'))
driving_lic_exp_date = fields.Date(_('Driving License Expiry Date'))
driving_lic_issue_place = fields.Char(_('Driving License Issue Place'))
dependants_ticket_amount = fields.Float(string='Dependants Ticket Amount', compute='_get_dependants_ticket_amount')
air_ticket_amount = fields.Float(string='Air Ticket Amount')
air_ticket_number = fields.Integer(string='Air Ticket No.')
total_air_ticket_amount = fields.Float(string='Total Air Ticket Amount', compute='_get_total_ticket_amount')
trial_duration = fields.Float(string='Trail Duration', compute='_compute_contract_duration')
contract_duration_cal = fields.Float(string='Contract Duration', compute='_compute_contract_duration')
# Relational fields
job_id = fields.Many2one(related="employee_id.job_id", readonly=True, tracking=True)
working_hours = fields.Many2one(related='employee_id.resource_calendar_id')
analytic_account_id = fields.Many2one(comodel_name='account.analytic.account')
journal_id = fields.Many2one(comodel_name='account.journal')
vac_des = fields.Many2one(comodel_name='hr.vacation.dest', string='Vacation Destination')
employee_dependent_ids = fields.One2many(comodel_name='hr.employee.dependent', inverse_name='contract_id')
employee_dependant = fields.One2many('hr.employee.dependent', 'contract_id', _('Employee Dependants'))
children_allowance = fields.One2many('hr.children.allowance', 'contract_id', _('Children Allowance'))
nationality = fields.Many2one('res.country', related='employee_id.country_id', readonly=True)
type_id = fields.Many2one(related='employee_id.employee_type_id', string="Contractor Type", tracking=True)
contractor_type = fields.Many2one(related='employee_id.employee_type_id', string="Contractor Type", required=False, tracking=True, store=True)
employee_id = fields.Many2one('hr.employee')
department_id = fields.Many2one('hr.department', _('Department Name'), related='employee_id.department_id',
readonly=True)
hiring_date = fields.Date(related='employee_id.first_hiring_date', string="Hiring Date", readonly=True)
all_exper_year = fields.Integer(compute='_compute_all_experience', store=True)
all_exper_month = fields.Integer(compute='_compute_all_experience', store=True)
all_exper_day = fields.Integer(compute='_compute_all_experience', store=True)
previous_contract_id = fields.Many2one('hr.contract', store=True, string='Previous Contract',
help='The Previous Contract Of The Employee')
######################### consultant #####################new /:19/10
consultants = fields.Boolean(default=False)
consultant_salary = fields.Float(string='Consultant Salary')
consultant_hour = fields.Float(string='Consultant Hour')
max_consultant_hour = fields.Float(string='Max Consultant Hour')
salary_status = fields.Selection([('in', _('IN')), ('out', _('OUT'))],
_('Salary Status'))
recruited_talent = fields.Selection([('billable', _('Billable')), ('un_billable', _('Un Billable'))],
_('Recruited Talent'))
class_contract = fields.Selection([('employees', _('Employees')), ('collect_money', _('Collect Money')),
('endowments', _('Endowments')),('researchers', _('Researchers'))],
_('Classification Contracts'), tracking=True)
period_ticket = fields.Integer()
dependant_count = fields.Integer(compute='_get_employee_dependant_count', store=True)
has_transportation = fields.Boolean(string='Has Transportation?', default=True)
has_housing = fields.Boolean(string='Has Housing?', default=True)
check_nationality = fields.Boolean(related='employee_id.check_nationality', store=True, string="Saudi?")
last_salary_gosi = fields.Float(string='Last Salary Gosi', help='The Last Salary Gosi After The Age 50 Years.')
def _get_employee_dependant_count(self):
for rec in self:
rec.dependant_count = len(
self.env['hr.employee.dependent'].search([('contract_id', '=', rec.id)]))
@api.depends('employee_id')
def _compute_all_experience(self):
for item in self:
if item.employee_id:
item.all_exper_year = item.employee_id.experience_year + item.employee_id.service_year
item.all_exper_month = item.employee_id.experience_month + item.employee_id.service_month
item.all_exper_day = item.employee_id.experience_day + item.employee_id.service_day
if item.all_exper_month > 11:
item.all_exper_year = item.all_exper_year + 1
item.all_exper_month = item.all_exper_month - 12
if item.all_exper_day > 30:
item.all_exper_month = item.all_exper_month + 1
item.all_exper_day = item.all_exper_day - 30
@api.onchange('contractor_type')
def onchange_contractor_type(self):
if self.contractor_type:
self.type_id = self.contractor_type
self.consultants = self.contractor_type.consultants
self.employee_id.employee_type_id = self.contractor_type
@api.onchange('date_start', 'hiring_date')
def get_trial_date_field(self):
for rec in self:
# rec.trial_date_start = False
# rec.trial_date_end = False
if rec.hiring_date and rec.date_start:
date_start = datetime.datetime.strptime(str(rec.hiring_date), '%Y-%m-%d')
rec.trial_date_start = rec.hiring_date
rec.trial_date_end = date_start + relativedelta.relativedelta(months=3)
elif rec.date_start and not rec.hiring_date:
date_start = datetime.datetime.strptime(str(rec.date_start), '%Y-%m-%d')
rec.trial_date_start = rec.date_start
rec.trial_date_end = date_start + relativedelta.relativedelta(months=3)
@api.onchange('employee_id')
def _emp_type_employee(self):
for item in self:
previous_contract = self.search([('employee_id', '=', item.employee_id.id),
('active', '=', True), ], limit=1)
if previous_contract:
raise exceptions.UserError(_('Sorry, Can Not Create More than One contract for an Employeet %s') %
item.employee_id.name)
if item.employee_id:
#if item.employee_id.check_nationality:
# item.emp_type = 'saudi'
#else:
# item.emp_type = 'other'
if item.employee_id.marital == 'single':
item.contract_status = 'single'
else:
item.contract_status = 'marriage'
item.job_id = item.employee_id.job_id
item.department_id = item.employee_id.department_id
item.employee_code = item.employee_id.employee_code
item.fn = item.employee_id.fn
item.mn = item.employee_id.mn
item.ln = item.employee_id.ln
item.dn = item.employee_id.name
'''@api.onchange('emp_type')
def chick_saudi_percentage(self):
for item in self:
Saudization_percen = item.env.user.company_id.saudi_percentage
if Saudization_percen > 0:
saudi = len(item.search([('active', '=', True), ('emp_type', 'in', ('saudi', 'displaced')),
('state', '=', 'program_directory')]).ids)
all_emp = len(item.search([('active', '=', True), ('state', '!=', 'end_contract')]).ids) + 1
saudi_percen = (saudi / all_emp) * 100
if saudi_percen > Saudization_percen and item.emp_type in ('saudi', 'displaced'):
raise exceptions.Warning(
_('The Saudization percentage should not exceed Percentage %s') % Saudization_percen)
none_saudi = len(item.search(
[('active', '=', True), ('emp_type', '=', 'other'), ('state', '=', 'program_directory')]).ids)
none_Saudization_percen = (100 - Saudization_percen)
none_percen = (none_saudi / all_emp) * 100
if none_percen > none_Saudization_percen and item.emp_type == 'other':
raise exceptions.Warning(
_('The None Saudization percentage should not exceed Percentage %s') % none_Saudization_percen)'''
def change_current_date_hijri(self, date):
date = datetime.datetime.strptime(str(date), '%Y-%m-%d')
year = date.year
day = date.day
month = date.month
hijri_date = convert.Gregorian(year, month, day).to_hijri()
return hijri_date
def translate_to_eng(self, text):
if text:
eng_text = text
ln = translator.detect(text)
if ln.lang != 'en':
eng_text = translator.translate(text, dest='en')
return eng_text
else:
return ' '
###############>>send email end contract and trial peroid<<<##########
@api.model
def contract_mail_reminder(self):
now = dt.now() + timedelta(days=1)
date_now = now.date()
match = self.search([('state', '!=', 'end_contract'),
('contract_duration', 'not in',( '3_months','6_months'))])
# trial_days_send_email=5
cont_end_reminder = self.env.user.company_id.contract_end_reminder
cont_trial_reminder = self.env.user.company_id.contract_trial_reminder
for i in match:
if i.date_end:
exp_date = fields.Date.from_string(i.date_end) - timedelta(days=cont_end_reminder)
if date_now >= exp_date:
self.env.ref('hr_contract_custom.email_template_contract_period_expiration_reminder', False).send_mail(i.id)
if i.trial_date_end:
exp_date = fields.Date.from_string(i.trial_date_end)
exp_date1 = fields.Date.from_string(i.trial_date_end) - timedelta(days=cont_trial_reminder)
# if date_now >= exp_date :
if exp_date >= date_now and date_now >= exp_date1:
self.env.ref('hr_contract_custom.email_template_contract_trial_period_expiration_reminder', False).send_mail(i.id)
##########################################################################
@api.onchange('contract_duration', 'date_start')
def get_contract_end_date(self):
if self.date_start and self.contract_description == 'locum':
date_start = datetime.datetime.strptime(str(self.date_start), '%Y-%m-%d')
if self.contract_duration == '3_months':
self.date_end = date_start + relativedelta.relativedelta(months=3) - timedelta(days=1)
elif self.contract_duration == '6_months':
self.date_end = date_start + relativedelta.relativedelta(months=6) - timedelta(days=1)
elif self.contract_duration == '9_months':
self.date_end = date_start + relativedelta.relativedelta(months=9) - timedelta(days=1)
elif self.contract_duration == '12_months':
self.date_end = date_start + relativedelta.relativedelta(months=12) - timedelta(days=1)
elif self.contract_duration == '24_months':
self.date_end = date_start + relativedelta.relativedelta(months=24) - timedelta(days=1)
elif self.contract_duration == '36_months':
self.date_end = date_start + relativedelta.relativedelta(months=36) - timedelta(days=1)
else:
self.date_end = False
# get salary amount form salary degree
@api.onchange('salary_degree')
def onchange_salary_degree(self):
if self.salary_degree:
self.salary = self.salary_degree.base_salary
# Get Salary Insurnce from Salary amount
@api.onchange('salary')
def onchange_base_salary_insurance(self):
if self.salary:
self.salary_insurnce = self.salary
# update to control on date constrains
@api.onchange('trial_date_start', 'trial_date_end', 'date_start', 'date_end')
def onchange_dates(self):
if self.trial_date_start:
if self.trial_date_end:
if self.date_start:
if self.date_end:
start_date_1 = dt.strptime(str(self.date_start), "%Y-%m-%d")
end_date_1 = dt.strptime(str(self.date_end), "%Y-%m-%d")
trial_start_date_1 = dt.strptime(str(self.trial_date_start), "%Y-%m-%d")
trial_end_date_1 = dt.strptime(str(self.trial_date_end), "%Y-%m-%d")
if trial_end_date_1 < trial_start_date_1:
raise exceptions.Warning(_('trial End Date must be greater than Trial Start date'))
if end_date_1 < start_date_1:
raise exceptions.Warning(_('End date must be greater than Start date'))
@api.onchange('contract_description')
def _contract_duration_change_state(self):
if self.contract_description == 'permanent':
self.contract_duration = 'none'
self.date_end = ''
@api.depends('wage', 'house_allowance', 'transport_allowance', 'communication_allowance')
def _compute_monthly_salary(self):
for rec in self:
rec.monthly_salary = rec.wage + rec.house_allowance_temp + rec.transport_allowance_temp + \
rec.communication_allowance_temp + rec.field_allowance_temp + \
rec.special_allowance_temp + rec.other_allowance_temp
@api.depends()
def _cal_allowance(self):
allowance = 0.0
if self.employee_id.country_id.code == 'SA':
allowance = self.salary * 1 / 100
self.breakdown_allowance = allowance
@api.depends()
def _calculate_gosi(self):
saudi_gosi = self.env.user.company_id.saudi_gosi
company_gosi = self.env.user.company_id.company_gosi
none_saudi_gosi = self.env.user.company_id.none_saudi_gosi
max_saudi_gosi = self.env.user.company_id.max_amount_saudi_gosi
max_company_gosi = self.env.user.company_id.max_amount_company_gosi
Sanad_saudi_gosi = self.env.user.company_id.Sanad_saudi_gosi
Sanad_company_gosi = self.env.user.company_id.Sanad_company_gosi
for record in self:
#if (record.emp_type == 'saudi' or record.emp_type == 'displaced') and record.is_gosi_deducted == "yes":
record.employee_id._compute_employee_age()
sanad_age = record.salary_scale.retirement_age
emp_age = record.employee_id.employee_age
if record.check_nationality==True and record.is_gosi_deducted == "yes":
if emp_age >= sanad_age and sanad_age > 0 :
employee_gosi = (record.salary_insurnce + record.house_allowance_temp) * (saudi_gosi - Sanad_saudi_gosi) / 100
employer_gosi = (record.salary_insurnce + record.house_allowance_temp) * (company_gosi - Sanad_company_gosi)/ 100
else:
employee_gosi = (record.salary_insurnce + record.house_allowance_temp) * saudi_gosi / 100
employer_gosi = (record.salary_insurnce + record.house_allowance_temp) * company_gosi / 100
if employee_gosi <= max_saudi_gosi:
record.gosi_deduction = employee_gosi
else:
record.gosi_deduction = max_saudi_gosi
if employer_gosi <= max_company_gosi:
record.gosi_employer_deduction = employer_gosi
else:
record.gosi_employer_deduction = max_company_gosi
record.total_gosi = record.gosi_deduction + record.gosi_employer_deduction
#elif (record.emp_type == 'saudi' or record.emp_type == 'displaced') and record.is_gosi_deducted == "no":
elif record.check_nationality==True and record.is_gosi_deducted == "no":
if emp_age >= sanad_age and sanad_age > 0 :
employee_gosi = (record.salary_insurnce + record.house_allowance_temp) * (saudi_gosi - Sanad_saudi_gosi) / 100
employer_gosi = (record.salary_insurnce + record.house_allowance_temp) * (company_gosi - Sanad_company_gosi) / 100
else:
employee_gosi = (record.salary_insurnce + record.house_allowance_temp) * saudi_gosi / 100
employer_gosi = (record.salary_insurnce + record.house_allowance_temp) * company_gosi / 100
if employee_gosi <= max_saudi_gosi:
employee_gosi = employee_gosi
else:
employee_gosi = max_saudi_gosi
if employer_gosi <= max_company_gosi:
employer_gosi = employer_gosi
else:
employer_gosi = max_company_gosi
record.gosi_deduction = 0.0
record.gosi_employer_deduction = employee_gosi + employer_gosi
record.total_gosi = employee_gosi + employer_gosi
else:
# pass
employer_gosi = (record.salary_insurnce + record.house_allowance_temp) * none_saudi_gosi / 100
record.gosi_deduction = 0.0
record.gosi_employer_deduction = employer_gosi
record.total_gosi = employer_gosi
#if (record.emp_type == 'saudi' or record.emp_type == 'displaced') and record.saudi_emp_type == 'saudi-non':
if record.check_nationality==True and record.saudi_emp_type == 'saudi-non':
record.gosi_deduction = 0.0
record.gosi_employer_deduction = 0.0
record.total_gosi = 0.0
@api.depends('date_start', 'date_end', 'trial_date_start', 'trial_date_end')
def _compute_contract_duration(self):
for item in self:
item.contract_duration_cal = 0
item.trial_duration = 0
if item.date_start and item.date_end:
date_start = datetime.datetime.strptime(str(item.date_start), '%Y-%m-%d').date()
date_end = datetime.datetime.strptime(str(item.date_end), '%Y-%m-%d').date()
item.contract_duration_cal = relativedelta.relativedelta(date_end, date_start).years
if item.trial_date_start and item.trial_date_end:
date_start = datetime.datetime.strptime(str(item.trial_date_start), '%Y-%m-%d').date()
date_end = datetime.datetime.strptime(str(item.trial_date_end), '%Y-%m-%d').date()
item.trial_duration = relativedelta.relativedelta(date_end, date_start).months
if item.trial_duration > 6:
raise exceptions.Warning(_('The period of trail duration must be not more than 6 months'))
'''@api.onchange('date_start')
def _compute_trial_period(self):
if self.date_start and self.date_end:
date_start = datetime.datetime.strptime(str(self.date_start), '%Y-%m-%d').date()
self.trial_date_start = self.date_start
self.trial_date_end = date_start + relativedelta.relativedelta(months=3) - timedelta(days=1)'''
@api.depends('air_ticket_amount')
def _get_total_ticket_amount(self):
self.total_air_ticket_amount = self.air_ticket_amount * self.air_ticket_number
@api.onchange('employee_id')
def _onchange_employee_id(self):
if self.employee_id:
self.job_id = self.employee_id.job_id
self.department_id = self.employee_id.department_id
self.employee_code = self.employee_id.employee_code
self.fn = self.employee_id.fn
self.mn = self.employee_id.mn
self.ln = self.employee_id.ln
self.dn = self.employee_id.name
@api.model
def create(self, vals):
contracts = super(Contract, self).create(vals)
contracts.employee_id.contract_id = contracts.id
return contracts
def draft_state(self):
self.state = "draft"
def employeed_aproval(self):
#self.chick_saudi_percentage()
self.state = "employeed_aproval"
def hr_head_approval(self):
#self.chick_saudi_percentage()
self.state = "hr_head_approval"
def end_contract_state(self):
if self.date_end == False:
raise exceptions.Warning(_('The contract End Date Must Be Entered'))
else:
self.state = "end_contract"
def program_directory(self):
#self.chick_saudi_percentage()
self.employee_id.contract_id = self.id
hiring_date = self.employee_id.first_hiring_date
effective = self.env['employee.effective.form'].search([('contract_id', '=', self.id)])
if not effective and not hiring_date:
self.env['employee.effective.form'].create({
'employee_id': self.employee_id.id,
'contract_id': self.id,
'department_id': self.department_id.id,
'contract_start': self.date_start,
'effective_form_date': self.date_start,
'state': 'draft'})
self.state = "program_directory"
def unlink(self):
for i in self:
if i.state != 'draft':
raise exceptions.Warning(_('You can not delete record in state not in draft'))
# if i.hiring_date:
# raise exceptions.Warning(_('You can not delete record has Hiring date'))
return super(Contract, self).unlink()
@api.onchange('working_hours')
def _onchange_working_hours(self):
if self.employee_id.contract_id.id == self._origin.id:
self.env['resource.resource'].browse([self.employee_id.resource_id.id]).write(
{'calendar_id': self.working_hours.id})
# Smart Button to access effective form
def action_view_effective_frm(self):
effective_id = self.env['employee.effective.form'].search([('employee_id', '=', self.employee_id.id)])
return {
'name': _('Employee Effective Form'),
'domain': [('id', '=', effective_id.id)],
'view_mode': 'tree,form',
'res_model': 'employee.effective.form',
'view_id': False,
'type': 'ir.actions.act_window',
}
class VacationDest(models.Model):
_name = 'hr.vacation.dest'
_rec_name = 'name'
name = fields.Char(required=True)
class EmployeeChildAllowance(models.Model):
_name = 'hr.children.allowance'
name = fields.Char(_('Children Name'))
age = fields.Integer(_('Age'))
fees = fields.Float(_('Educational Fees'))
remarks = fields.Text(_('Remarks'))
# Relational fields
contract_id = fields.Many2one('hr.contract', _('Contract'))
class ContractType(models.Model):
_name = "hr.contract.type"
_description = "Contract Type"
_order = "sequence, id"
name = fields.Char(string="Contract Type", required=True)
sequence = fields.Integer(help="Gives the sequence when displaying a list of Contract.", default=10)
salary_type = fields.Selection([("amount", _("Amount")), ("scale", _("Scale"))], string="Salary Type")
code = fields.Char(string='Code')
consultants = fields.Boolean(default=False, string='Consultants')
country_id = fields.Many2one("res.country", string="Country")
company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.company)

View File

@ -0,0 +1,150 @@
# -*- coding: utf-8 -*-
import datetime
from dateutil import relativedelta
from odoo import api, fields, models, _, exceptions
class ContractExtension(models.Model):
_name = 'hr.contract.extension'
_inherit = ['mail.thread', 'mail.activity.mixin']
_rec_name = 'employee_id'
employee_id = fields.Many2one('hr.employee', string="Employee", required=True)
employee_no = fields.Char(related='employee_id.emp_no', readonly=True,string='Employee Number', store=True)
contract_id = fields.Many2one(related='employee_id.contract_id', store=True, string="Contract")
department_id = fields.Many2one(related='employee_id.department_id', store=True, string="Department")
type = fields.Selection(selection=[('extension', 'Extension'), ('end', 'Contract End'), ('confirm', 'Confirm')],
required=True, string="Type", tracking=True)
state = fields.Selection(selection=[('draft', 'Draft'), ('confirm', 'wait Direct Manager'),
('emp_confirm', 'wait Employee'),
('direct_manager', 'Wait HR Approve'), ('hr_approve', 'Approved'),
('refused', 'Refused')], required=True, string="State", default='draft',
tracking=True)
date_from = fields.Date()
date_to = fields.Date()
old_date_from = fields.Date(compute='get_relation_field', store=True, string="Trial start")
old_date_to = fields.Date(compute='get_relation_field', store=True, string="Trial end")
contract_date_end = fields.Date(compute='get_relation_field', store=True, string="Contract Date end")
end_date = fields.Date()
comments = fields.Text(string="Comments")
company_id = fields.Many2one(related='employee_id.company_id', string="Company")
@api.onchange('employee_id')
def get_relation_field(self):
for rec in self:
rec.old_date_from = rec.contract_id.trial_date_start
rec.old_date_to = rec.contract_id.trial_date_end
rec.contract_date_end = rec.contract_id.date_end
rec.end_date = rec.contract_id.trial_date_end
rec.date_from = False
rec.date_to = False
if rec.old_date_to:
date_start = datetime.datetime.strptime(str(rec.old_date_to), '%Y-%m-%d')
rec.date_from = rec.old_date_to
rec.date_to = date_start + relativedelta.relativedelta(months=3)
@api.constrains('employee_id')
def once_request(self):
for i in self:
employee_id = self.env['hr.contract.extension'].search(
[('id', '!=', i.id), ('employee_id', '=', i.employee_id.id),
('state', 'not in', ('draft', 'refused'))])
for rec in employee_id:
if rec.type == 'extension' and i.type == 'extension':
raise exceptions.Warning(_('Sorry, Not possible to request Extension Form more than once'))
if rec.type == 'confirm' and i.type == 'confirm':
raise exceptions.Warning(_('Sorry, Not possible to request Confirm Form more than once'))
if rec.type == 'end' and i.type == 'end':
raise exceptions.Warning(_('Sorry, Not possible to request Termination Form more than once'))
if rec.type == 'confirm' and (i.type == 'end' or i.type == 'extension'):
raise exceptions.Warning(_('Sorry, Not possible End Or Extension request After Confirm'))
if rec.type == 'end' and (i.type == 'confirm' or i.type == 'extension'):
raise exceptions.Warning(_('Sorry, Not possible Confirm Or Extension request After End'))
if not i.contract_id:
raise exceptions.Warning(_('Sorry, Not possible to request Extension with Not Contract'))
@api.constrains('date_from', 'date_to')
def date_constrin(self):
for item in self:
if item.old_date_to and item.date_from:
if item.old_date_to > item.date_from:
raise exceptions.Warning(_('Extension Date Form Must be Greater than Old Date To'))
if item.date_to and item.date_from:
if item.date_from >= item.date_to:
raise exceptions.Warning(_('Date Form Must be Less Than Date To'))
date_start = datetime.datetime.strptime(str(item.date_from), '%Y-%m-%d').date()
date_end = datetime.datetime.strptime(str(item.date_to), '%Y-%m-%d').date()
trial_duration = relativedelta.relativedelta(date_end, date_start).months
if trial_duration > 3:
raise exceptions.Warning(_('The period of Extension trail duration must be not more than 3 months'))
def confirm(self):
for rec in self:
rec.once_request()
rec.state = 'confirm'
def direct_manager(self):
for rec in self:
rec.once_request()
if rec.type != 'extension':
rec.state = 'direct_manager'
else:
rec.state = 'emp_confirm'
def emp_confirm(self):
for rec in self:
rec.once_request()
if rec.employee_id.user_id.id == rec.env.uid:
rec.state = 'direct_manager'
else:
raise exceptions.Warning(_('Sorry, For Employee %s Confirm Only !') % (rec.employee_id.name))
def hr_approve(self):
for rec in self:
rec.once_request()
if rec.type == 'extension':
rec.contract_id.sudo().write({
#'trial_date_start': rec.date_from,
'trial_date_end': rec.date_to
})
elif rec.type == 'end':
rec.contract_id.sudo().write({
# 'state':'end_contract',
'date_end': rec.end_date
})
else:
rec.contract_id.sudo().write({
'state': 'program_directory', })
rec.state = 'hr_approve'
def refused(self):
for rec in self:
if rec.type != 'extension' or rec.state != 'emp_confirm':
rec.state = "refused"
else:
rec.state = 'confirm'
def draft_state(self):
for item in self:
if item.type == 'extension':
item.contract_id.sudo().write({
#'trial_date_start': item.old_date_from,
'trial_date_end': item.old_date_to
})
if item.type == 'end':
item.contract_id.sudo().write({'date_end': item.contract_date_end})
item.state = "draft"
def unlink(self):
for i in self:
if i.state != 'draft':
raise exceptions.Warning(_('You can not delete record in state not in draft'))
return super(ContractExtension, self).unlink()

View File

@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
from num2words import num2words
from datetime import datetime, timedelta
from odoo import api, fields, models,_
class HrEmployee(models.Model):
_inherit = "hr.employee"
base_salary = fields.Float(compute="compute_base_salary")
salary_in_words = fields.Char(compute="get_salary_amount")
payslip_lines = fields.One2many(comodel_name="hr.payslip.line", compute="compute_base_salary")
employee_dependant = fields.One2many(related='contract_id.employee_dependant',readonly=False, tracking=True)
employee_type_id = fields.Many2one('hr.contract.type', string="Employee Type", ondelete='cascade', tracking=True)
@api.depends("base_salary")
def get_salary_amount(self):
for item in self:
item.salary_in_words = num2words(item.base_salary, lang=self.env.user.lang)
def compute_base_salary(self):
for item in self:
last_day_of_prev_month = datetime.now().date().replace(day=1) - timedelta(days=1)
start_day_of_prev_month = datetime.now().date().replace(day=1) - timedelta(days=last_day_of_prev_month.day)
payroll = item.env["hr.payslip"].search(
[
("employee_id", "=", item.name),
("date_from", "<=", datetime.now().date()),
("date_to", ">=", datetime.now().date()),
("contract_id", "=", item.contract_id.id),
],
limit=1,
)
if not payroll:
payroll = item.env["hr.payslip"].search(
[
("employee_id", "=", item.name),
("date_from", "<=", start_day_of_prev_month),
("date_to", ">=", last_day_of_prev_month),
("contract_id", "=", item.contract_id.id),
],limit=1,
)
item.base_salary = payroll.total_allowances
item.payslip_lines = payroll.allowance_ids.filtered(
lambda r: r.salary_rule_id.rules_type in ("salary", "house")
).sorted(lambda b: b.name)

View File

@ -0,0 +1,199 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, _, exceptions, api
import datetime
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
class hr_extend(models.Model):
_name = 'hr.re.contract'
_rec_name = 'employee_id'
_inherit = ['mail.thread', 'mail.activity.mixin']
state = fields.Selection(string='State', selection=[
('draft', 'Draft'),
('submitted', 'Submitted'),
('direct_manager', 'Direct Manager'),
('hr_manager', 'HR Manager'),
('done', 'Re-Contract'),
('refuse', 'Refuse'),
], default='draft', tracking=True)
company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.user.company_id)
employee_id = fields.Many2one('hr.employee', string='Employee', required=True)
date = fields.Date(default=fields.Date.context_today, string="Date Request")
effective_date = fields.Date()
job_id = fields.Many2one('hr.job', string='Job Position', compute='_get_employee_data', store=True)
department_id = fields.Many2one('hr.department', string='Department', compute='_get_employee_data', store=True)
hire_date = fields.Date(string='Hire Date', compute='_get_employee_data', store=True)
contract_id = fields.Many2one('hr.contract', compute='_get_employee_data', store=True, string='Current Contract',
help='Latest contract of the employee')
new_salary = fields.Float()
start_date = fields.Date(string='Current Contract Start Date', compute='_get_employee_data', store=True)
new_contract_start_date = fields.Date()
new_contract_end_date = fields.Date()
eoc_date = fields.Date(string='Current Contract End Date', compute='_get_employee_data', store=True)
increase_salary = fields.Selection([('no', 'NO'), ('yes', 'YES')], string='Increase Salary?', default='no')
last_renewal = fields.Boolean(readonly=True, string='Last Renewal?', default=True)
contract_type = fields.Selection([('temporary', _('Temporary')), ('permanent', _('Permanent'))],
_('Contract Type'), default='temporary', tracking=True)
iqama_end_date = fields.Date(related="employee_id.iqama_number.expiry_date",string='Identity End Date', readonly=True)
# employee_type = fields.Selection(related='employee_id.contract_id.contract_description', store=True)
def action_refuse(self):
for item in self:
if item.state == 'done':
contracts = self.env['hr.contract'].search([('employee_id', '=', self.employee_id.id)],
order='id DESC')[:2]
item.contract_id.write({
'salary': item.contract_id.salary_degree.base_salary,
'salary_scale': item.contract_id.salary_scale.id,
'salary_level': item.contract_id.salary_level.id,
'salary_group': item.contract_id.salary_group.id,
'salary_degree': item.contract_id.salary_degree.id, })
self.state = "refuse"
def action_submit(self):
self._get_employee_data()
self.state = 'submitted'
def action_direct_manager(self):
# if self.employee_id.parent_id and self._uid != self.employee_id.parent_id.user_id.id:
# raise exceptions.Warning(_('This is Not Your Role beacuse Your Direct Manager'))
self._get_employee_data()
self._check_contract()
self.state = "direct_manager"
def action_hr_manager(self):
self._get_employee_data()
self.state = "hr_manager"
def action_done(self):
self._check_contract()
today = datetime.now().date()
str_today = today.strftime('%Y-%m-%d')
# if str_today != self.effective_date:
# raise exceptions.Warning(_('You can not re-contract employee because effective date is not today'))
last_record = self.env['hr.re.contract'].search(
[('id', '!=', self.id), ('employee_id', '=', self.employee_id.id),
('state', '=', 'done'), ('last_renewal', '=', True)], order='id desc', limit=1)
default = {
'job_id': self.job_id.id,
'employee_id': self.employee_id.id,
'department_id': self.department_id.id,
# 'date_start': self.new_contract_start_date,
'date_end': self.new_contract_end_date,
'name': 'Re-Contract' + self.employee_id.name,
'state': 'program_directory',
}
if self.increase_salary == 'yes':
default.update({'wage': self.new_salary_degree.base_salary,
'salary_scale': self.new_salary_scale.id,
'salary_level': self.new_salary_level.id,
# 'experience_year': self.experience_year,
'salary_group': self.new_salary_group.id,
'salary_degree': self.new_salary_degree.id,
})
else:
default.update({'wage': self.contract_id.salary_degree.base_salary,
'salary_scale': self.contract_id.salary_scale.id,
'salary_level': self.contract_id.salary_level.id,
'experience_year': self.contract_id.experience_year,
'salary_group': self.contract_id.salary_group.id,
'salary_degree': self.contract_id.salary_degree.id,
})
c_id = self.contract_id.copy(default=default)
for line in self.contract_id.employee_dependant:
line.contract_id = c_id.id
for line in self.contract_id.advantages:
line.contract_advantage_id = c_id.id
self.contract_id.write({'active': False})
if last_record:
last_record.last_renewal = False
if self.contract_type == 'permanent':
c_id.contract_description = 'permanent'
# Employee back to service
self.employee_id.state = 'open'
self.contract_id.state = 'program_directory'
self.state = "done"
def unlink(self):
for i in self:
if i.state != 'draft':
raise exceptions.Warning(_('You can not delete record in state not in draft'))
return super(hr_extend, self).unlink()
@api.onchange('employee_id', 'new_contract_start_date', 'contract_type')
def onchange_new_contract_start_date(self):
for rec in self:
if rec.eoc_date:
rec.new_contract_start_date = False
rec.new_contract_end_date = False
date_start = datetime.strptime(str(rec.eoc_date), '%Y-%m-%d')
date_start += relativedelta(days=1)
rec.new_contract_start_date = date_start
# rec.new_contract_end_date = date_start + relativedelta(years=3)
if not rec.eoc_date and rec.employee_id:
raise exceptions.Warning(_('You can not renewal contract is open Date'))
if rec.new_contract_start_date:
start_date = datetime.strptime(str(rec.new_contract_start_date), DEFAULT_SERVER_DATE_FORMAT).date()
end_date = start_date + relativedelta(years=1)
end_date -= relativedelta(days=1)
rec.new_contract_end_date = end_date
if rec.contract_type == 'permanent':
rec.new_contract_end_date = False
def _check_contract(self):
old_start_date = datetime.strptime(str(self.contract_id.date_start), DEFAULT_SERVER_DATE_FORMAT).date()
# old_end_date = datetime.strptime(self.contract_id.date_end, DEFAULT_SERVER_DATE_FORMAT).date()
new_start_date = datetime.strptime(str(self.new_contract_start_date), DEFAULT_SERVER_DATE_FORMAT).date()
if self.contract_id.date_end:
old_end_date = datetime.strptime(str(self.contract_id.date_end), DEFAULT_SERVER_DATE_FORMAT).date()
if new_start_date <= old_end_date:
raise exceptions.Warning(_('New Contract must have start date after the end date of old contract'))
elif old_start_date <= new_start_date <= old_end_date:
raise exceptions.Warning(_('New Contract must have start date after the end date of old contract'))
if self.new_contract_end_date:
new_end_date = datetime.strptime(str(self.new_contract_end_date), DEFAULT_SERVER_DATE_FORMAT).date()
if new_start_date >= new_end_date:
raise exceptions.Warning(_('New Contract start date must be before the end date'))
return True
def action_set_to_draft(self):
if self.state == 'done':
last_record = self.env['hr.re.contract'].search(
[('id', '!=', self.id), ('employee_id', '=', self.employee_id.id),
('state', '=', 'done'), ('last_renewal', '=', False)], order='id desc', limit=1)
if self.last_renewal == False:
raise exceptions.Warning(_('The record Cannot be Set To Draft Because It Is Not Last Renewal Record'))
for line in self.employee_id.contract_id.advantages:
line.contract_advantage_id = self.contract_id.id
for line in self.employee_id.contract_id.employee_dependant:
line.contract_id = self.contract_id.id
contracts = self.env['hr.contract'].search([('employee_id', '=', self.employee_id.id)], order='id DESC')[:2]
if self.contract_id:
self.contract_id.write({'active': True})
contracts.draft_state()
contracts.unlink()
if last_record:
last_record.last_renewal = True
self.state = "draft"

View File

@ -0,0 +1,851 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="custom_external_layout_standard">
<div class="header">
<div class="row">
<table style="width:100%;border: 1px solid gray;height:100px">
<tr style=" border: 1px solid gray">
<td style=" border: 1px solid gray;width:50%">
<img
t-if="company.logo"
t-att-src="'data:image/png;base64,%s' % to_text(company.logo)"
style="max-height:100px;width:70%"
/>
</td>
<td style=" border: 1px solid gray;width:50%;padding:5px">
<h4>
<center> </center>
</h4>
</td>
</tr>
</table>
</div>
</div>
<div class="article o_report_layout_standard">
<t t-raw="0" />
</div>
</template>
<template id="custom_external_layout">
<!-- Multicompany -->
<t t-if="not o and doc">
<t t-set="o" t-value="doc" />
</t>
<t t-if="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id.sudo()" />
</t>
<t t-if="not o or not 'company_id' in o">
<t t-set="company" t-value="res_company" />
</t>
<t t-call="hr_contract_custom.custom_external_layout_standard"><t t-raw="0" /></t>
</template>
<template id="employee_contract_report_template">
<t t-call="web.html_container">
<t t-call="hr_contract_custom.custom_external_layout">
<style type="text/css">
@font-face {
font-family: "ae_AlMohanad";
src: local("ae_AlMohanad"), local("ae_AlMohanad"),
url("/hr_contract_custom/static/fonts/ae_AlMohanad.ttf") format("truetype");
}
* {
font-family: ae_AlMohanad;
}
</style>
<div class="page" style="font-size:13pt">
<t t-foreach="docs" t-as="o">
<table style="width:100%;border: 1px solid gray">
<ol type="1">
<tr>
<td style="width:50%;border-left: 1px solid gray">
عقـــــــد عمل
</td>
<td style="direction:ltr;width:50%">
EMPLOYMENT Contract
</td>
</tr>
<tr>
<td style="width:50%;border-left: 1px solid gray">
تم بعون الله إبرام هذا العقد، في هذا التاريخ
<span t-esc="o.change_current_date_hijri(o.date_start)"/>
هـ، الموافق
<span t-esc="o.date_start"/>
بيــــــن كل من:
</td>
<td style="direction:ltr">
This contract is made and entered into this
<span t-esc="o.change_current_date_hijri(o.date_start)"/>
H, corresponding to
<span t-esc="o.date_start"/>
G by and between:
</td>
</tr>
<tr>
<td style="width:50%;border-left: 1px solid gray">
1. شركة
<span t-esc="o.company_id.name"/>
وهي شركة سعودية قائمة مؤسسة بموجب أنظمة المملكة العربية السعودية ومركزها
الرئيسي الرياض، المملكة العربية السعودية وعنوانها البريدي ص. ب (
<span t-esc="o.company_id.po_no"/>) الرياض (12334). (ويشار إليها في هذا العقد بـ "صاحب العمل")،
</td>
<td style="direction:ltr">
1.<span t-esc="o.translate_to_eng(o.company_id.name)"/>,
a Saudi company existing under the laws of the Kingdom of Saudi Arabia and
having its principal place of business in Riyadh, its postal address is P.O.
Box<span
t-esc="o.company_id.po_no"
/>, Riyadh 12334, (hereinafter referred to as the “Employer”).
</td>
</tr>
<tr>
<td style="width:50%;border-left: 1px solid gray">
2. السيد /
<span t-esc="o.employee_id.name"/>
،
<span t-esc="o.nationality.name"/>
الجنسية بموجب هوية رقم :
<span t-esc="o.employee_id.passport_id.passport_id"/>
(ويشار إليه في هذا العقد بـ"الموظف").
</td>
<td style="direction:ltr">
2. Mr.<span t-esc="o.employee_id.english_name"/>,
<span t-esc="o.translate_to_eng(o.nationality.name)"/>
nationality, holding ID No
<span t-esc="o.employee_id.passport_id.passport_id"/>
(Hereinafter referred to as the “Employee”).
</td>
</tr>
<tr>
<td style="width:50%;border-left: 1px solid gray">
تمهيد:
</td>
<td style="direction:ltr">
Preamble:
</td>
</tr>
<tr>
<td style="width:50%;border-left: 1px solid gray">
بناءً على الرغبة المشتركة لطرفي هذا العقد، وهما بكامل الأهلية المعتبرة شرعاً
ونظاماً للتعاقد مع بعضهما كصاحب عمل وموظف ، فقد اتفق الطرفان على الشروط
والأحكام التالية:
</td>
<td style="direction:ltr">
Upon their mutual interest being in their full legal capacities to contract
with each other as employer and employee, The parties hereto agree to the
terms and conditions stipulated herein as follows:
</td>
</tr>
<tr>
<td style="width:50%;border-left: 1px solid gray">
<li>
( 1 )يعتبر التمهيد المذكور أعلاه جزءاً لا يتجزأ من هذا العقد.
</li>
</td>
<td style="direction:ltr">
(1)The above-mentioned preamble is considered as integral part of this
contract.
</td>
</tr>
<tr>
<td style="width:50%;border-left: 1px solid gray;border-bottom:1px solid gray">
(2) التعيين
<br/>
يعمل الموظف على وظيفة
<span
t-esc="o.job_id.name"
/>
أو أي عمل آخر يسند اليه يتناسب مع مؤهلاته العلمية وخبراته العملية وبحسب ما
تفتضيه مصلحة العمل بشرط ألا يتعارض مع الوصف الوظيفي للوظيفة يكون مقر عمل
الموظف في مدينة الرياض أو في أي مكان آخر تحدده الشركة داخل المملكة العربية
السعودية أو خارجها إذا ما دعت الحاجة إلى ذلك طبقاً لنظام العمل والسياسات
التي تضعها الشركة مع مراعاة الاحكام التالية:
لا يكون نقل الموظف من مكان عمله الأصلي إلى مكان آخر يقتضي تغيير محل إقامته
إلا بموافقة الموظف كتابة.
يجوز للشركة في حالات الضرورة التي قد تفتضيها ظروف عارضة ولمدة لا تزيد عن
ثلاثين يوماً في السنة، تكليف الموظف ان يعمل في مكان مختلف عن المكان الأصلي
دون موافقته وتتحمل الشركة تكاليف انتقال الموظف وإقامته خلال تلك المدة.
ان يعمل في مكان مختلف عن المكان الأصلي دون موافقته وتتحمل الشركة تكاليف
انتقال الموظف وإقامته خلال تلك المدة.
</td>
<td style="direction:ltr;border-bottom: 1px solid gray">
2) Appointment
<br/>
The Employer hereby appoint the Employee to work as
<span
t-esc="o.translate_to_eng(o.job_id.name)"
/>
Position, or any work assigned to him/ her so long the Employee has all
credentials and experiences to carry out this work. The location of the job
shall be Riyadh or any other locations decided by the company in accordance
with labour law and internal procedures, provided these conditions are met
Written acceptance by the employee must be obtained if the company decide to
transfer the employee to a different location, under urgent circumstances
only, the employer may order the employee to relocate to a different
location provided these conditions are satisfied:The relocation duration
shall not exceed 30 days, the employer shall compensate the employee or the
employer incur all the cost with respect to housing and transportation as a
result of the relocation.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-top: 1px solid gray"
>
(3) الراتب الشهري
<br/>
(ا) الراتب الشهري الأساسي للموظف هو (<span
t-esc="o.salary"
/>) ريال سعودي شاملاً كافة أيام الشهر بما فيها عطلات نهاية الأسبوع والعطل
الرسمية.
<br/>
(ب) يُدفع راتب الموظف الأساسي الشهري، إضافة إلى أي بدلات أو مدفوعات أخرى،
ناقصاً أية اقتطاعات مستحقة عليه، على أساس شهري في آخر كل شهر (حسب التقويم
الميلادي).
</td>
<td
style="direction:ltr;border-top: 1px solid gray"
>
3.Monthly Salary
<br/>
(a) The Employee's basic monthly salary, which includes each and every day
of the month, including the Weekend, and holidays, is SR (<span
t-esc="o.salary"
/>).
<br/>
(b) The Employee's monthly salary plus any other allowances or payments
minus any deductions shall be paid monthly at the end of each month (in
accordance with the Gregorian calendar).
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(4) البدلات
<br/>
يستحق الموظف البدلات الإضافية التالية:
<br/>
(أ) السكن
<br/>
يحق للموظف الحصول على بدل سكن مقداره (3) ثلاث رواتب أساسية سنوياً، تقسم على
12 شهراَ وتدفع في آخر كل شهر.
<br/>
(ب) المواصلات
<br/>
يحق للموظف الحصول على بدل مواصلات بمقدار (10%) عشرة بالمائة من الراتب
الأساسي تدفع في آخر كل شهر.
</td>
<td style="direction:ltr;">
(4) Allowances
<br/>
The Employee is eligible for the additional allowances specified below:
<br/>
(a) Housing Allowance
<br/>
The Employee shall be entitled to receive a housing allowance of (3) Three
basic Salary per annum, divided to 12 months and payable at the end of each
months.
<br/>
(b) Transportation
<br/>
The Employee shall be entitled to receive a car allowance of (10%) ten
percent from the basic Salary, payable at the end of each month.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-bottom: 1px solid gray"
>
(5) موقع العمل
<br/>
سيكون موقع عمل الموظف في مدينة الرياض، بالمملكة العربية السعودية.
</td>
<td
style="direction:ltr;border-bottom: 1px solid gray"
>
(5) Work Location
<br/>
The Employee will be employed in the city of Riyadh21, Saudi Arabia.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-top: 1px solid gray"
>
(6) مدة العقد
<br/>
مدة هذا العقد سنة واحدة ميلادية، ويبدأ اعتبارا من تاريخ<span
t-esc="o.date_start"
/>، مع مراعاة النصوص الواردة في هذا العقد بخصوص الإنهاء، ويعتبر الموظف تحت
التجربة لمدة ثلاث أشهر من تاريخ مباشرته للعمل بموجب هذا العقد. ويجوز باتفاق
مكتوب بين الطرفين تمديد فترة التجربة بشرط إلا يزيد أجمالي فترة التجربة عن
مائة وثمانين يوماً، ولا تدخل في حساب فترة التجربة إجازة عيدي الفطر والاضحى
والإجازة المرضية. ويحق للطرفين خلالها إنهاء هذا العقد دون الحاجة إلى توجيه
اشعار مسبق ودون أن يترتب للطرف الثاني تعويض أو مكافأة نهاية الخدمة وذلك
وفقاً لنظام العمل ويتوجب على أحد الطرفين إشعار الطرف الآخر كتابيا في حالة
عدم رغبته في تجديد العقد وإلا يعدّ العقد قد تجدد تلقائياً لمدة مماثلة، وفي
حال تجدد العقد ثلاث مرات متتالية او بلغت مده العقد الأصلي مع التجديد أربع
سنوات ايهما اقل تحول العقد الى عقد غير محدد المدة.
</td>
<td
style="direction:ltr;border-top: 1px solid gray"
>
(6) Period of Employment
<br/>
The duration of this contract is a one year, The start date is from
<span
t-esc="o.date_start"
/>
G, subject to provisions regarding the termination of employment contained
in this contract, The Employee shall, however, be on probation for the first
three (3) Gregorian months of employment.
The probation period might be extended for no longer than 180 days excluding
all official holydays and sick leave provided the extension of the probation
period is written and agreed upon by both parties.
A party shall notify the other in writing indicating the desire to terminate
this contract, if terminated during the probation period the employee is not
entitled to end of service reward nor any kind of rewards in accordance with
Saudi labor law. If there is no termination during the probation period and
the contract continues in effect the contract will be automatically renewed
for the same term unless, either party notify the other if the intention not
to renew the contract. Renewing the contract for three consecutive times or
if the duration of the original contact including the renewal is 4years
which duration is lesser, the contract will be deemed a nonspecific
contract.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-bottom: 1px solid gray"
>
(7) ساعات العمل
<br/>
يبلغ عدد ساعات العمل الفعلي في أسبوع العمل الواحد أربعين (40) ساعة موزعة على
خمسة أيام عمل بواقع ثماني (8) ساعات لكل يوم عمل ولا يدخل فيها وقت التنقل من
وإلى موقع العمل. وفي شهر رمضان المبارك تكون ساعات العمل الأسبوعية للموظف
المسلم ثلاثين (30) ساعة بواقع ست (6) ساعات في اليوم.
</td>
<td
style="direction:ltr;border-bottom: 1px solid gray"
>
(7) Work Hours
<br/>
The number of hours actually worked in a work week shall normally be forty
(40) and the number of hours worked in each work day shall normally be eight
(8), exclusive of traveling time to and from work. If the Employee is a
Muslim, the working hour during the month of Ramadan shall normally be
thirty (30) hours and the work day shall normally be six (6) hours.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-top: 1px solid gray"
>
(8) العمل الإضافي
<br/>
يمكن أن يُطلب من الموظف العمل لساعات إضافية. ويعوض الموظف عن ساعات العمل
الإضافية وفقا لنظام العمل السعودي وسياسات صاحب العمل الداخلية، ولا يتم تعويض
الموظف عن العمل الإضافي إلا إذا كان ذلك العمل الإضافي قد تم بموافقة كتابية
ومسبقة من رئيس الموظف ووفقاً للوائح صاحب العمل.
</td>
<td
style="direction:ltr;border-top: 1px solid gray"
>
(8) Overtime
<br/>
The Employee may be required to work overtime. The Employee will be
compensated for overtime in accordance with the Saudi Labor Law and the
Employers internal policy. The Employee shall not be able to claim overtime
unless such overtime work were authorized beforehand by his supervisor and
shall be in accordance with the Employers guidelines in this regards.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(9) العطل الرسمية
<br/>
يحق للموظف التمتع خلال السنة بالعطل الرسمية المعتمدة وفقاً لنظام العمل
السعودي. وإذا طلب منه أن يعمل خلال أيام العطل الرسمية، فإنه يستحق تعويضا عن
كل ساعة عمل فعلية وفقا لنظام العمل السعودي.
</td>
<td style="direction:ltr;">
(9) Holidays
<br/>
The Employee will be entitled to days off for public holidays in accordance
with the Saudi Labor Law. If the Employee is required to work on a holiday,
he shall be entitled to payment for every hour actually worked on such
holiday in accordance with the Saudi Labor Law.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(10) الإجازة السنوية
<br/>
بالإضافة إلى العطل الرسمية العامة والإجازات الأخرى المدفوعة الأجر بموجب نظام
العمل السعودي، يستحق الموظف إجازة مدتها (30) ثلاثون يوماً عن كل سنة من
الخدمة في المملكة العربية السعودية على أن يحدد صاحب العمل موعدها بما يتناسب
مع ظروف العمل.
</td>
<td style="direction:ltr">
(10) Annual Vacation
<br/>
In addition to public holidays and other paid leave requires by the Saudi
Labor law, the Employee will be eligible for a vacation consisting of 30
days per year of employment in Saudi Arabia. The Employer shall have the
right to specify the starting date of the Employees annual vacation as
dictated by work requirements.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(11) الإجازة المرضية
<br/>
يدفع الأجرعن الإجازة المرضية وفقاً لنظام العمل السعودي شرط أن تكون الحاجة
للعلاج الطبي و/أو الاستشفاء مثبتة كتابة من مستشفى معتمد.
</td>
<td style="direction:ltr">
(11) Sick Leave
<br/>
Sick leave will be paid in accordance with the provisions of the Saudi
Arabian Labor Law, provided that the need for medical treatment and/or
hospitalization is confirmed in writing by an approved hospital.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-bottom: 1px solid gray"
>
(12) التأمينات الاجتماعية
<br/>
يقتطع صاحب العمل من الراتب الشهري للموظف مبلغ النسبة المطلوبة من الموظف
لاشتراكه في نظام التأمينات الاجتماعية طبقا للوائح والأنظمة المعتمدة لدى
المؤسسة العامة للتأمينات الاجتماعية، بينما يدفع صاحب العمل نسبة الاشتراك
المطلوبة منه وفقا للوائح والأنظمة المعتمدة لدى المؤسسة العامة للتأمينات
الاجتماعية.
</td>
<td
style="direction:ltr;border-bottom: 1px solid gray"
>
(12) Social Insurance
<br/>
The Employer shall pay directly to the General Organization for Social
Insurance ("GOSI") an amount equal to the contribution which is required to
be made by an employer in accordance with the rules and regulations of GOSI.
The Employer will withhold contributions due by the Employee from the
Employee's salary only to the extent that the Employer is required or
permitted to do so pursuant to the rules and regulations of GOSI.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-top: 1px solid gray"
>
(13) التأمين الطبي
<br/>
يوفر صاحب العمل للموظف تأمينا طبياً طبقاً للنظام المعمول به في المملكة
العربية السعودية ووفقا للسياسات التي يقررها صاحب العمل بين الحين والآخر.
</td>
<td
style="direction:ltr;border-top: 1px solid gray"
>
(13) Medical Insurance
<br/>
The Employee will be eligible to participate in medical insurance and
benefit plans in accordance with the practice in Saudi Arabia and in
accordance with the policies the Employer has in place from time to time.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(14) الأنظمة والتعليمات
<br/>
يتعهد الموظف بأن يتقيد بما يصدره صاحب العمل من سياسات وتوجيهات وتعليمات
وبكافة الأنظمة والأعراف المعمول بها في المملكة العربية السعودية. ولن يكون
صاحب العمل مسؤولاً عن أية عقوبات أو غرامات أو مطالبات نظامية يتعرض لها
الموظف نتيجةً لمخالفته أياً من هذه الأنظمة.
</td>
<td style="direction:ltr;">
(14) Laws and Instructions
<br/>
The Employee undertakes to comply with all policies, directives and
instructions issued by the Employer and with the laws, regulations and
customs of the Kingdom of Saudi Arabia. The Employer shall have no
responsibility for any penalties or liabilities incurred by the Employee due
the Employee's violation of such laws, regulations and customs.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(15) صحة المعلومات
<br/>
يحق لصاحب العمل أن يتأكد من صحة المعلومات وسلامتها الواردة في طلب التوظيف
والشهادات المقدمة من الموظف وفي حالة ثبوت أيّ احتيال أو تزوير أو غش فيها
فانه يحق للصاحب العمل إنهاء هذا العقد دون إشعار أو تعويض أو مكافأة وتحميله
مسئولية وتكاليف أيّ خسائر يتعرض لها صاحب العمل جراء ذلك إضافة إلى أيّ جزاءات
أو ملاحقات / مخالفات نظاميه قد تنتج عن ذلك.
</td>
<td style="direction:ltr;">
(15) Truth of Information
<br/>
The Employer shall have the right to verify about the correctness and truth
of information stated in the employment application and certificates
furnished by the Employee. The Employer shall have the right at any time to
terminate the contract without notice or compensation and the Employee will
bear any responsibility, losses or expenses if it has been proved that the
employment was based on cheating, misrepresentation or fraud.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(16) العمل لدى الغير والإضرابات
<br/>
بقبوله العمل بموجب هذا العقد، فإن الموظف يتعهد بأنه لن يمارس أيّ عمل أو
وظيفة أخرى لدى أيّ شخص أو جهة أخرى غير صاحب العمل، ولن يشارك، لأيّ سبب كان،
في أيّ إضراب عن العمل أو أية نزاعات عمالية أو صناعية أو سياسية أو اجتماعية،
أو في أيّ إجراء أو عمل قد يؤدي إلى توقف عمله أو انقطاعه.
</td>
<td style="direction:ltr;">
(16) Other Employment and Strikes
<br/>
In accepting employment hereunder, the Employee, undertakes that he will not
engage in any other business or employment and that he will not for any
reason whatsoever engage in any strikes or other labor disputes or take part
in any industrial, political or social dispute or action involving the
cessation or withdrawal of the Employees labor.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-bottom: 1px solid gray"
>
(17) المسائل الأخرى
<br/>
كل أمر لم يرد بشأنه نص صريح على سبيل التحديد في هذا العقد يطبق عليه سياسات
ولوائح صاحب العمل الداخلية ونظام العمل السعودي ويشمل ذلك جميع التعديلات
واللوائح والقرارات والتعاميم التي أصدرت أو يتم إصدارها في المستقبل.
</td>
<td
style="direction:ltr;border-bottom: 1px solid gray"
>
(17) Other Matters
<br/>
Any stipulations, which are not specifically mentioned in this contract,
will be subject to the internal policies and procedures of the Employer and
the Saudi Labor Law. This includes all the amendments, rules, decisions and
circulars, being entered in the future.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-top: 1px solid gray"
>
(18) المراسلات والإخطارات
<br/>
يحق لصاحب العمل أن يسلم جميع الإشعارات والاخطارات إلى
الموظف مباشرة باليد أثناء فترة عمله لديه أو على عنوانه (داخل المملكة) أو إلى
بريده الاليكتروني أو بوضعها على لوحة الإعلانات بمقر عمل صاحب العمل حيث يعمل
الموظف، ويعتبر هذا التسليم بمثابة إقرار باستلام تلك الإشعارات والاخطارات في
التاريخ المذكور في الإشعار وتعتبر هذه الإشعارات كأنما سلمت باليد.
</td>
<td
style="direction:ltr;border-top: 1px solid gray"
>
(18) Correspondences and Notifications
<br/>
The Employer will have the right to hand over all the notifications, or
information to the Employee directly by hand during his work or by sending
it to the Employees address in Saudi Arabia, or to advertise it on the
notice board in the Employers headquarters where the Employee works. This
delivery shall be deemed to be duly given on the date of notification and as
if it has been handed over by hand.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-bottom: 1px solid gray"
>
(19) السريـة والملكية الفكرية
<br/>
مع عدم الاخلال بما ورد في المادة (83)، يوافق الموظف على أن أيّة دراسات أو
معلومات أو بيانات أو أي مستندات يحصل عليها جراء عمله تعتبر ملكاً لصاحب العمل
وكذلك أي براءات اختراع أو أبحاث أو حقوق طبع ونشر تتعلق بنشاط صاحب العمل
يعتبر حقا خالصا له.
</td>
<td
style="direction:ltr;border-bottom: 1px solid gray"
>
(19) Confidentiality and Intellectual Property
<br/>
Without prejudice to Article (83) the Employee agrees and undertakes that
all the studies, information, statements and any other documents the
employee obtains during his work are considered the sole properties of the
Employee. Also all the research, inventions or copy rights related to the
companys activities are considered sole properties of the company.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-top: 1px solid gray"
>
(20) إنهاء العقد
<br/>
بما لا يتعارض مع ورد في المواد (74) (77) او (80) من نظام العمل السعودي عن
حالات الإنهاء وفسخ العقد.
<br/>
(1) يحق لأيّ من الطرفين إنهاء هذا العقد إذا كان غير محدد المدة بناء على سبب
مشروع يجب بيانه بموجب إشعار يوجه الى الطرف الاخر كتابه قبل الانهاء بمدة ستون
(60) يوما. إذا قرر صاحب العمل أن الموظف لم يعد يصلح للقيام بعمله أو أنه زائد
عن حاجة العمل.
<br/>
(2) يجوز لصاحب العمل أن ينهي خدمة الموظف فوراً وبدون فترة إنذار أو بدل فترة
إنذار، وبدون أي حق للموظف بأية تعويضات، وذلك في أي وقت أثناء فترة التجربة أو
في أي من الحالات و/أو المخالفات التي نص عليها نظام العمل السعودي.
<br/>
(ج) تحسب مكافأة نهاية الخدمة على أساس الراتب الأساسي مضافا إليه بدلا السكن
والنقل فقط، ولا تدخل أي بدلات أو عمولات أو أي منافع أخرى في احتساب المكافأة.
</td>
<td
style="direction:ltr;border-top: 1px solid gray"
>
(20) Termination
<br/>
Without prejudice to Article(74) (77) (80) of Saudi labor law in relation to
termination
<br/>
(a) Either party has the right to terminate a nonspecific contract provided
an appropriate reason is given and sixty (60) days notice written is
rendered to the other party. If the Employer decided that the Employee is no
longer suitable for the job or the position is being eliminated.
<br/>
(b) The Employer has the right to dismiss the Employee forthwith, without
notice or pay in lieu of such notice and without any right on the part of
the Employee to any other benefit, at any time while the Employee is on
probation or in the event the Employee commits any of the acts and
violations articulated into the Saudi Labor Law.
<br/>
(c ) End of service benefit shall be calculated on the basis of basic salary
and housing, transportation allowances. Commissions and other benefits such
as allowances in cash or in kind or any kind of incentives are not included
in the end of service benefit calculation.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-bottom: 1px solid gray"
>
(21) وحده العقد
<br/>
يشكل هذا العقد الاتفاق الكامل بين الطرفين فيما يخص توظيف الموظف من قبل صاحب
العمل في المملكة العربية السعودية. ويلغي هذا العقد ويحل محل جميع الاتفاقيات
والتفاهمات السابقة والحالية، كتابية كانت أم شفهية.
</td>
<td
style="direction:ltr;border-bottom: 1px solid gray"
>
(21) Entire Contract
<br/>
This contract constitutes the entire contract between the parties with
respect to the Employee's employment by the Employer in the Kingdom of Saudi
Arabia and supersedes and render null and void all prior or contemporaneous
contract or understandings, whether oral or written.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray;border-top: 1px solid gray"
>
(22) التنازل واستقلالية النصوص
<br/>
إن عدم قيام أيّ من الطرفين في أيّ وقت بفرض تنفيذ أيّ من فقرات هذا العقد أو
لم يطالب الطرف الآخر بتنفيذ أيّ من فقراته، فإن ذلك لا يجب أن يفسر بأيّ حال
من الأحوال على أنه تنازل عن تلك الفقرة أو على أنه يؤثر على صلاحية هذا العقد
أو على حق أيّ من الطرفين في فرض تنفيذ كل فقرة من فقرات العقد وفقا لشروطه
وأحكامه. وإذا أصبح أيّ شرط من شروط هذا العقد أو جزء منه باطلاً، فإن ذلك لن
يبطل الشروط الأخرى أو الجزء المتبقي من الشرط المعني. ويظل هذا العقد في جميع
هذه الحالات سارياً ومرتب لكل اثاره النظامية.
</td>
<td
style="direction:ltr;border-top: 1px solid gray"
>
22)
Waiver and Severability
<br/>
The failure of either party to enforce at any time any of the provisions of
this contract or to require at any time performance by the other party of
any of the provisions hereof, shall in no way be construed to be a waiver of
the provisions or to affect the validity of this contract or the right of
either party thereafter to enforce each and every provision in accordance
with the terms of this contract. Invalidation of any provision of this
contract, or portion thereof, shall not invalidate any other provision or
the remainder of the relevant provision and the rest of this contract shall
in all such cases remain in full force and effect.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(23) النظام المطبق وتسوية المنازعات
<br/>
يخضع هذا العقد للأنظمة السعودية ويفسر وفقا لها، بما في ذلك ودون حصر نظام
العمل السعودي الصادر بموجب المرسوم الملكي رقم م/51 بتاريخ 23/08/1426هـ. وعلى
الطرفين أن يبذلا كل جهد ممكن لتسوية أيـّـة نزاعات تنشأ بينهما على خلفية هذا
العقد بالطرق الودية. وإذا تعذر ذلك، يحال النزاع إلى الجهة القضائية المختصة
للفصل في النزاع بشكل نهائي
</td>
<td style="direction:ltr;">
(23) Governing Law and Disputes
<br/>
This contract shall be governed by and construed in accordance with the laws
and regulations of the Kingdom of Saudi Arabia, including without limitation
the Labor Law issued under Royal Decree No. M/51 dated 23/08/1426H. The
parties will make every effort to settle disputes amicably, but if the
parties are unable to reach an amicable settlement, the dispute will be
referred to and decided by the relevant and appropriate judicial body.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(24) اللغة
<br/>
اللغة المعتمدة في تفسير هذا العقد هي اللغة العربية.
</td>
<td style="direction:ltr;">
(24) Language
<br/>
The Arabic text shall supersede the English text in interpreting this
contract.
</td>
</tr>
<tr>
<td
style="width:50%;border-left: 1px solid gray"
>
(25) نسخ العقد
<br/>
حرر هذا العقد من نسختين أصليتين يحتفظ كل طرف بنسخة أصلية واحدة بعد التوقيع
عليها من قبل الطرفين.
</td>
<td style="direction:ltr;">
(25) Copies of the contract
<br/>
This contract has been written into two copies in which each party will have
one copy after being signed by both parties.
</td>
</tr>
</ol>
</table>
<table style="width:100%;border: 1px solid gray">
<tr>
<td>
صاحب العمل:
<span t-esc="o.company_id.name"/>
</td>
<td style="direction:ltr;">
The Employer:
<span
t-esc="o.translate_to_eng(o.company_id.name)"
/>
</td>
</tr>
<tr>
<td>
يمثله:
</td>
<td style="direction:ltr;">
Authorized Representative:
</td>
</tr>
<tr>
<td>
الصفة: الرئيس التنفيذي
</td>
<td style="direction:ltr;">
Title:
</td>
</tr>
<tr>
<td>
التــــوقيع:
</td>
<td style="direction:ltr;">
Signature:
</td>
</tr>
<tr>
<td>
الموظف:
</td>
<td style="direction:ltr;">
The Employee:
</td>
</tr>
<tr>
<td>
التــــوقيع:
</td>
<td style="direction:ltr;">
Signature:
</td>
</tr>
</table>
<style>
i{
padding:10px;
padding-right:0px;
}
td{
padding: 5px 5px 5px 5px;
}
</style>
</t>
</div>
</t>
</t>
</template>
<record id="employee_contract_action_report" model="ir.actions.report">
<field name="model">hr.contract</field>
<field name="name">Contract Form</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">hr_contract_custom.employee_contract_report_template</field>
<field name="binding_model_id" ref="hr_contract.model_hr_contract"/>
<field name="binding_type">report</field>
</record>
<record id="paperformat_contract_report" model="report.paperformat">
<field name="name">European A4 Transactions</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="orientation">Portrait</field>
<field name="margin_top">35</field>
<field name="margin_bottom">5</field>
<field name="margin_left">5</field>
<field name="margin_right">5</field>
<field name="header_line" eval="False" />
<field name="header_spacing">35</field>
<field name="dpi">90</field>
</record>
<record id="employee_contract_action_report" model="ir.actions.report">
<field name="paperformat_id" ref="paperformat_contract_report" />
</record>
</data>
</odoo>

View File

@ -0,0 +1,324 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<!--template for contract-->
<template id="dependents_contract_report_temp">
<t t-call="web.html_container">
<t t-call="hr_base.custom_external_layout_d">
<style type="text/css">
@font-face {
font-family: "ae_AlMohanad";
src: local("ae_AlMohanad"), local("ae_AlMohanad"),
url("/hr_base/static/fonts/ae_AlMohanad.ttf") format("truetype");
}
* {
font-family: ae_AlMohanad;
}
</style>
<div class="page" style="font-size:19pt">
<t t-foreach="docs" t-as="o">
<br />
<table style="width:100%;border-bottom: 1px solid gray">
<tr>
<td style="font-weight:bold;width:50%">
نأمل منكم تعبئة النموذج الخاص بكم موضحا فيه تواريخ الميلاد باليوم و الشهر و السنة بالميلادي (إذا أمكن) وإعادته لنا بعد التوقيع عليه، ولكم جزيل الشكر.
</td>
<td
style="text-align: left;;font-weight:bold;width:50%"
>
Please complete this form indicate the Date, Month, Year in Gregorian (If possible) and return it back to our department after your signature. </td>
</tr>
<tr
style="border-top: 1px solid white;border-left: 1px solid white;padding: 1px;"
>
<td style="color:white">.</td>
<td style="color:white">.</td>
<td style="color:white">.</td>
<td style="color:white">.</td>
</tr>
<br />
</table>
<br />
<br />
<table
class="table table-condensed"
style="width:100%;text-align:center;border: 1px solid gray"
>
<tr>
<td style="border: 1px solid gray">
أسم الموظف الثلاثي بالإنجليزي
<br />
name
</td>
<td style="border: 1px solid gray">
رقم بطاقة الأحوال / الهوية
<br />
Saudi ID/ Identity No.
</td>
<td style="border: 1px solid gray">
الجنسية
<br />
Nationality
</td>
<td style="border: 1px solid gray">
تاريخ الميلاد (بالميلادي)
<br />
D.O.B (Gregorian)
</td>
</tr>
<tr>
<td style="border: 1px solid gray">
<t t-esc="o.employee_id.english_name" />
</td>
<td style="border: 1px solid gray">
<t
t-if="o.employee_id.country_id.name == 'Saudi Arabia' or o.employee_id.country_id.name == 'المملكة العربية السعودية'"
>
<span
t-field="o.employee_id.saudi_number.saudi_id"
/>
</t>
<t t-else="">
<span
t-field="o.employee_id.iqama_number.iqama_id"
/>
</t>
</td>
<td style="border: 1px solid gray">
<t t-esc="o.employee_id.country_id.name" />
</td>
<td style="border: 1px solid gray">
<t t-esc="o.employee_id.birthday" />
</td>
</tr>
</table>
<p>
المعالين:
</p>
<p>
Dependents:
</p>
<table
class="table table-condensed"
style="width:100%;text-align:center;border: 1px solid gray"
>
<thead>
<tr>
<th
style=" border: 1px solid gray; padding: 1px; font-size:0.8em;background-color: white;color: black;width:5px"
>
#
</th>
<th
style=" border: 1px solid gray; padding: 1px; font-size:0.8em;background-color: white;color: black;width:25%;text-align:center;"
>
الاسم الثلاثي بالإنجليزي
<br />
name
</th>
<th
style=" border: 1px solid gray; padding: 1px; font-size:0.8em;background-color: white;color: black;width:15%;text-align:center;"
>
الجنس
<br />
Sex
</th>
<th
style=" border: 1px solid gray; padding: 1px;font-size:0.8em;background-color: white;color: black;width:15%;text-align:center;"
>
صلة القرابة
<br />
Relation
</th>
<th
style=" border: 1px solid gray; padding: 1px;font-size:0.8em;background-color: white;color: black;width:15%;text-align:center;"
>
تاريخ الميلاد (بالميلادي)
<br />
D.O.B (Gregorian)
</th>
<th
style=" border: 1px solid gray; padding: 1px;font-size:0.8em;background-color: white;color: black;width:30%;text-align:center;"
>
رقم بطاقة الأحوال / الهوية
<br />
Saudi ID/ Identity No
</th>
</tr>
</thead>
<t t-set="i" t-value="1" />
<tbody>
<t t-foreach="o.employee_dependant" t-as="line">
<tr>
<td
style=" border: 1px solid gray;padding: 1px; width:5%;font-size:0.8em;background-color: white;color: black; text-align:center;"
>
<span t-esc="i" />
</td>
<td
style=" border: 1px solid gray;padding: 1px; width:25%;font-size:0.8em;background-color: white;color: black; text-align:center"
>
<t t-esc="line.name" />
</td>
<td
style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:15%;text-align:center"
>
<t t-esc="line.gender" />
</td>
<td
style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:15%;text-align:center"
>
<t t-esc="line.relation" />
</td>
<td
style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:15%;text-align:center"
>
<t t-esc="line.birthday" />
</td>
<td
style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:30%;text-align:center"
>
<t t-esc="line.identity_num" />
<!-- <t t-esc="line['number_of_days']"/>-->
</td>
</tr>
<t t-set="i" t-value="i+1" />
</t>
</tbody>
</table>
<br />
<table style="width:100%;border-bottom: 1px solid white">
<tr>
<td style="font-weight:bold;width:50%">
أقر بأن هذه المعلومات المذكورة في هذه الاستمارة صحيحة.
</td>
<td
style="text-align: left;;font-weight:bold;width:50%"
>
I do hereby declare that the information provided is to the best of my knowledge true and accurate.
</td>
</tr>
<tr
style="border-top: 1px solid white;border-left: 1px solid white;padding: 1px;"
>
<td style="color:white">.</td>
<td style="color:white">.</td>
<td style="color:white">.</td>
<td style="color:white">.</td>
</tr>
<br />
</table>
<table style="width:100%;">
<tr>
<td style="font-weight:bold;width:15%">
الاسم
</td>
<td
style="text-align: center;font-weight:bold;width:70%;font-size:16pt"
>
..............................................................................................................................................</td>
<td
style="text-align:left;font-weight:bold;width:15%"
>
name
</td>
</tr>
<tr>
<td style="font-weight:bold;width:15%">
التوقيع
</td>
<td
style="text-align: center;font-weight:bold;width:70%;font-size:16pt"
>
..........................................................................................................................................</td>
<td
style="text-align:left;font-weight:bold;width:15%"
>
Signature
</td>
</tr>
<tr>
<td style="font-weight:bold;width:15%">
التاريخ
</td>
<td
style="text-align: center;font-weight:bold;width:70%;font-size:16pt"
>
..............................................................................................................................................</td>
<td
style="text-align:left;font-weight:bold;width:15%"
>
Date
</td>
</tr>
<tr
style="border-top: 1px solid white;border-left: 1px solid white;padding: 1px;"
>
<td style="color:white">.</td>
<td style="color:white">.</td>
<td style="color:white">.</td>
<td style="color:white">.</td>
</tr>
<br />
</table>
<table
style="width:100%;border: 1px solid gray;border-top: 0px;border-left: 0px;border-right: 0px"
>
<tr>
<td style="width:25%;font-weight:bold;color: green">
لاستخدام إدارة الموارد البشرية
</td>
<td style="color:white">.</td>
<td style="color:white">.</td>
<td style="width:40%;font-weight:bold;color: green">
For Human Resources Department
</td>
</tr>
<tr style="border-top: 1px solid gray">
<td
style="font-weight:bold;width:25%;border: 1px solid gray;background-color:#d3d3d3;"
>
تمت مطابقة الأسماء حسب الجواز / الهوية / بطاقة الأحوال
</td>
<td
style="text-align: right;font-weight:bold;width:25%;border-top: 1px solid gray"
>
الاسم :
<br />
التاريخ :
</td>
<td
style="font-weight:bold;border: 1px solid gray;background-color:#d3d3d3;"
>
ملاحظات:
<br />
التوقيع:
</td>
<td
style="color:white;width:40%;border-left: 1px solid gray"
>.</td>
</tr>
<br />
</table>
</t>
</div>
</t>
</t>
</template>
<record id="dependents_contract_action_report" model="ir.actions.report">
<field name="model">hr.contract</field>
<field name="name">Dependents Report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">hr_contract_custom.dependents_contract_report_temp</field>
<field name="binding_model_id" ref="hr_contract.model_hr_contract"/>
<field name="binding_type">report</field>
</record>
<record id="dependents_contract_action_report" model="ir.actions.report">
<field name="paperformat_id" ref="hr_base.paperformat_dependents_employee_report"/>
</record>
</data>
</odoo>

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="custom_external_layout_salary_payroll">
<div class="header">
<div class="row">
<div class="col-xs-3 mb4">
<img
t-if="company.logo"
t-att-src="'data:image/png;base64,%s' % to_text(company.logo)"
style="max-height: 45px;"
/>
</div>
<div
class="col-xs-9 text-right"
style="margin-top:22px;"
t-field="company.report_header"
name="moto"
/>
</div>
<div
t-if="company.logo or company.report_header"
class="row zero_min_height"
>
<div class="col-xs-12">
<div style="border-bottom: 1px solid black;" />
</div>
</div>
<div class="row">
<div style="text-align:left" name="company_address">
<span
t-field="company.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'
style="border-bottom: 1px solid black; display:inline-block;"
/>
</div>
</div>
<div class="article o_report_layout_standard">
<t t-raw="0" />
</div>
</div>
<div class="footer">
</div>
</template>
<template id="custom_external_layout_pay">
<t t-if="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id" />
</t>
<t t-if="not o or not 'company_id' in o">
<t t-set="company" t-value="res_company" />
</t>
<div class="article">
<t t-call="hr_base.custom_external_layout_salary_payroll" />
<t t-raw="0" />
</div>
</template>
<template id="salary_letter_report_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="hr_base.custom_external_layout_pay">
<div class="page" style="font-family: 'Arial';direction:rtl">
<div class="row">
<span style="font-size: 20px;margin-right: 8%;">
التاريخ :
</span>
<span
style="font-size: 18px;"
t-esc="o.change_current_date_hijri()"
/>
<br />
<span style="font-size: 20px;margin-right: 8%;">
الموافق :
</span>
<span
style="font-size: 18px;"
t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"
/>
</div>
<br />
<div class="row">
<span style="font-size: 20px;margin-right: 8%;">
<strong>
الســـادة /
-------------------------------------------------------------------------
المـحـتـرمـيـن
</strong>
</span>
</div>
<br />
<div class="row">
<p style="font-size: 20px;margin-right: 11%;">
تفيد شركة
<span t-field="o.company_id" />
<strong>
بأن الســيــد/ة
<span t-field="o.name" />
</strong>
-
<span t-field="o.country_id" />
الجـنـسـيـة
,
بـموجـب الهـويـة رقـم
<t
t-if="o.country_id.name == 'Saudi Arabia' or o.country_id.name == 'المملكة العربية السعودية'"
>
<span t-field="o.saudi_number.saudi_id" />
</t>
<t t-else="">
<span t-field="o.iqama_number.iqama_id" />
</t>
أحـد مـنـسـوبـي الشـركـة ، والذي يـحـمـل الرقـم
<span t-field="o.emp_no" />
ويعـمـل علـى وظـيـفـة
<br />
<span t-field="o.job_id" />
اعـتـبـارا من
<t t-if="o.first_hiring_date">
<span
t-esc="datetime.datetime.strptime(str(o.first_hiring_date), '%Y-%m-%d').date()"
/>
</t>
.
و يتقاضى المذكور راتـبـا اجمالي مقداره
<br />
(
<span t-field="o.base_salary" />
) ريــال فقط
<span t-field="o.salary_in_words" />
ريال لاغير. و قد أعطي هذا الخطاب بناء على طلبـه دون ادني مسئولية على الشـركة.
<!--table class="table table-bordered"
style="width:40%;border: 2px solid #DADADA;margin-right: 40%;">
<t t-set="i" t-value="1"/>
<tr t-foreach="o.payslip_lines" t-as="pay">
<td style="width:5%;border: 1px solid #DADADA;">
<span style="font-size: 18px;" t-esc="i"/>
<t t-set="i" t-value="i+1"/>
</td>
<td style="width:20%;border: 1px solid #DADADA;">
<span style="font-size: 18px;" t-field="pay.name"/>
</td>
<td style="width:20%;border: 1px solid #DADADA;">
<span style="font-size: 18px;" t-field="pay.total">
</span>
<strong>ريـــال</strong>
</td>
</tr>
</table>
<span style="font-size: 20px;margin-right: 8%;">
و قد أعطي هذا الخطاب بناء على طلبـه دون ادني مسئولية على الشـركة .
</span-->
</p>
<br />
<br />
<br />
<br />
<div class="text-center">
<span style="font-size: 22px;">
<strong
>شاكرين تعاونكم .. و لكم تحياتي ،،،،،،،</strong>
</span>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
<record id="payroll_report" model="ir.actions.report">
<field name="name">Salary Letter</field>
<field name="model">hr.employee</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">hr_contract_custom.salary_letter_report_template</field>
<field name="report_file">hr_contract_custom.salary_letter_report_template</field>
<field name="print_report_name">'Salary Letter for - %s' % (object.name)"</field>
<field name="groups_id" eval="[(4, ref('hr.group_hr_user'))]"/>
<field name="binding_model_id" eval="False"/>
</record>
</odoo>

View File

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="probationary_evaluation_report">
<t t-call="web.html_container">
<t t-call="hr_base.hr_layout" t-translation="off">
<t t-foreach="docs" t-as="o">
<style>
table td tr {
white-space: nowrap;
border : 1px solid black;
}
</style>
<div class="page" style="font-family: 'Times New Roman';direction:rtl;">
<br/>
<br/>
<div class="row">
<h3 style="text-align: center;">
<strong>
عرض وظيفي
</strong>
</h3>
</div>
<br/>
<table class="table table-condensed table-bordered" style="border: 1px solid black;">
<tr style="background-color:#204a87;">
<td style="color:white;height:40px;text-align:center; vertical-align: middle;"
colspan="8">
<span>
<center>
<strong>نموذج تقييم فترة التجربة
Probationary Evaluation Period Form
</strong>
</center>
</span>
</td>
</tr>
<tr>
<td style="text-align:right;background-color:#f3f3f2" colspan="1">
<strong>التاريخ</strong>
</td>
<td style="width:100px ;text-align:center" colspan="2">
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/>
</td>
<td style="text-align:left;background-color:#f3f3f2" colspan="1">
<strong>Date</strong>
</td>
<td style="float:right;background-color:#f3f3f2" colspan="1">
<strong>الرقم الوظيفي</strong>
</td>
<td style="width:100px ;text-align:center" colspan="2">
<span t-field="o.employee_id.emp_no"/>
</td>
<td style="text-align:left;background-color:#f3f3f2" colspan="2">: Employee No</td>
</tr>
<tr>
<td style="text-align:right;background-color:#f3f3f2" colspan="1">
<strong>اسم الموظف</strong>
</td>
<td style="width:100px ;text-align:center" colspan="2">
<span t-field="o.employee_id.name"/>
</td>
<td style="text-align:left;background-color:#f3f3f2" colspan="1">
<strong>Employee Name</strong>
</td>
<td style="text-align:right;background-color:#f3f3f2" colspan="1">
<strong>المسمى الوظيفي</strong>
</td>
<td style="width:100px ;text-align:center" colspan="2">
<span t-field="o.employee_id.job_id.name"/>
</td>
<td style="width:100px;text-align:left;background-color:#f3f3f2" colspan="2">Position
</td>
</tr>
<tr>
<td style="text-align:right;background-color:#f3f3f2" colspan="1">
<strong>الإدارة</strong>
</td>
<td style="width:100px ;text-align:center" colspan="2">
<span t-field="o.department_id"/>
</td>
<td style="text-align:left;background-color:#f3f3f2" colspan="1">
<strong>Dept</strong>
</td>
<td style="text-align:right;background-color:#f3f3f2" colspan="1">
<strong>تاريخ التعيين</strong>
</td>
<td style="width:100px ;text-align:center" colspan="2">
<span t-field="o.contract_id.date_start"/>
</td>
<td style="width:100px;text-align:left;background-color:#f3f3f2" colspan="2">Joining
Date
</td>
</tr>
</table>
<br/>
<br/>
<table class="table table-condensed table-bordered" style="border: 1px solid black;">
<tr style="background-color:#204a87;">
<td style="color:white;height:40px;text-align: center; vertical-align: middle;"
colspan="8">
<span>
<center>
<strong>تاريخ انتهاء فترة التجربة End date for trial period</strong>
</center>
</span>
</td>
</tr>
<tr>
<td style="width:100px;height:40px;" colspan="8">
<span>
<center>
<span t-field="o.old_date_to"/>
</center>
</span>
</td>
</tr>
<tr style="background-color:#204a87;">
<td style="color:white;height:40px;text-align: center; vertical-align: middle;"
colspan="8">
<span>
<center>
<strong style="color:white;">المرئيات Feedback</strong>
</center>
</span>
</td>
</tr>
<tr>
<td style="height:70px;text-align: center; vertical-align: middle;" colspan="2">
<div style="float:left">Pass</div>
<div style="float:right">يبقى</div>
</td>
<td style="height:70px;text-align: center; vertical-align: middle;" colspan="3">
<div style="float:left">Extended</div>
<div style="float:right">تمديد فترة التجربة</div>
</td>
<td style="height:70px;text-align:center; vertical-align: middle;" colspan="3">
<div style="float:left">Fail</div>
<div style="float:right">غير مناسب و تنتهي فترة خدمته</div>
</td>
</tr>
<tr style="background-color:#204a87;">
<td style="color:white;height:40px;text-align:center;vertical-align: middle;"
colspan="8">
<span>
<center>
<strong style="color:white;">الملاحظات Remark</strong>
</center>
</span>
</td>
</tr>
<tr>
<td style="height:100px;width:100px" colspan="8">
<span t-field="o.comments"/>
</td>
</tr>
</table>
<table class="table table-condensed table-bordered" style="border: 1px solid black;">
<tr style="background-color:#204a87;;">
<td style="color:white;height:40px;" colspan="8">
<span>
<center>
<strong>التوقيع Signature</strong>
</center>
</span>
</td>
</tr>
<tr>
<td style="width:100px;" colspan="8">
<div style="float:left">
<strong>Direct Manager</strong>
<span t-field="o.employee_id.parent_id"/>
</div>
<div style="float:right">
<strong>المدير المباشر</strong>
</div>
</td>
</tr>
<tr>
<td style="width:100px;" colspan="8">
<div style="float:left">
<strong>Agreed</strong>
</div>
<div style="float:right">
<strong>الموافقة</strong>
</div>
</td>
</tr>
<tr>
<td style="width:100px;" colspan="8">
<div style="float:left">
<strong>Approval</strong>
</div>
<div style="float:right">
<strong>الإعتماد</strong>
</div>
</td>
</tr>
</table>
<table class="table table-borderless" dir="rtl">
<tr>
<td style="text-align:right;border:0;">
<h4 style="text-align:right">الإجراءات:</h4>
<p style="text-align:right">1- يكون الموظف المستجد تحت التجربة لفترة تسعين يوماً
ميلادياً .
</p>
<p style="text-align:right">2- خلال فترة التجربة يجب تقديم خطة عمل لتحديد أداء
الموظف خلال فترة التجربة، وذلك من قبل إدارته .
</p>
<p style="text-align:right">3- في حالة عدم تعبئة النموذج أعلاه يعتبر الموظف قد اجتاز
فترة التجربة بنجاح.
</p>
</td>
</tr>
</table>
</div>
</t>
</t>
</t>
</template>
<record id="probationary_evaluation_report_act" model="ir.actions.report">
<field name="model">hr.contract.extension</field>
<field name="name">Probationary Evaluation Period Form</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">hr_contract_custom.probationary_evaluation_report</field>
<field name="report_file">hr_contract_custom.probationary_evaluation_report</field>
<field name="binding_model_id" ref="hr_contract_custom.model_hr_contract_extension"/>
<field name="binding_type">report</field>
<field name="groups_id" eval="[(4, ref('hr.group_hr_user'))]"/>
</record>
</odoo>

View File

@ -0,0 +1,12 @@
id,name,model_id:id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_hr_contract_executive,hr.contract.executive,model_hr_contract,hr_base.group_executive_manager,1,1,0,0
access_hr_contract_user_employee,hr_contract_employee,model_hr_contract,base.group_user,1,1,0,0
access_hr_contract_officer,hr_contract_officer,model_hr_contract,hr.group_hr_user,1,1,0,0
access_hr_contract_type_manager,hr.contract.type.manager,model_hr_contract_type,hr.group_hr_manager,1,1,1,1
access_hr_contract_type_user,hr.contract.type.user,model_hr_contract_type,hr.group_hr_user,1,0,0,0
access_contract_extension_user,access_contract_extension_user,model_hr_contract_extension,hr.group_hr_user,1,1,1,1
access_contract_extension_dp_manager,access_contract_extension_dp_manager,model_hr_contract_extension,hr_base.group_department_manager,1,1,1,0
access_contract_extension_emp,access_contract_extension_emp,model_hr_contract_extension,base.group_user,1,1,0,0
access_hr_re_contract_user,hr.re.contract.user,model_hr_re_contract,hr.group_hr_user,1,1,1,0
access_hr_children_allowance_user,access_hr_children_allowance_user,model_hr_children_allowance,hr.group_hr_user,1,1,1,0
access_hr_vacation_dest_user,access_hr_vacation_dest_user,model_hr_vacation_dest,hr.group_hr_user,1,1,1,0
1 id name model_id:id group_id/id perm_read perm_write perm_create perm_unlink
2 access_hr_contract_executive hr.contract.executive model_hr_contract hr_base.group_executive_manager 1 1 0 0
3 access_hr_contract_user_employee hr_contract_employee model_hr_contract base.group_user 1 1 0 0
4 access_hr_contract_officer hr_contract_officer model_hr_contract hr.group_hr_user 1 1 0 0
5 access_hr_contract_type_manager hr.contract.type.manager model_hr_contract_type hr.group_hr_manager 1 1 1 1
6 access_hr_contract_type_user hr.contract.type.user model_hr_contract_type hr.group_hr_user 1 0 0 0
7 access_contract_extension_user access_contract_extension_user model_hr_contract_extension hr.group_hr_user 1 1 1 1
8 access_contract_extension_dp_manager access_contract_extension_dp_manager model_hr_contract_extension hr_base.group_department_manager 1 1 1 0
9 access_contract_extension_emp access_contract_extension_emp model_hr_contract_extension base.group_user 1 1 0 0
10 access_hr_re_contract_user hr.re.contract.user model_hr_re_contract hr.group_hr_user 1 1 1 0
11 access_hr_children_allowance_user access_hr_children_allowance_user model_hr_children_allowance hr.group_hr_user 1 1 1 0
12 access_hr_vacation_dest_user access_hr_vacation_dest_user model_hr_vacation_dest hr.group_hr_user 1 1 1 0

View File

@ -0,0 +1,100 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<data>
<!-- Add you code here -->
<record id="hr_re_contract_manager_rule" model="ir.rule">
<field name="name">Manager: views tickets requests of its subordinates
</field>
<field name="model_id" ref="model_hr_re_contract" />
<field name="domain_force">['|',('department_id.manager_id.user_id','=', user.id),
('department_id.parent_id.manager_id.user_id','=', user.id)]
</field>
<field name="groups"
eval="[(4, ref('hr_base.group_department_manager')),(4, ref('hr_base.group_division_manager'))]" />
</record>
<record id="hr_re_contract_all_rule" model="ir.rule">
<field name="name">Manager: views tickets requests of all employee
</field>
<field name="model_id" ref="model_hr_re_contract" />
<field name="domain_force">[(1 ,'=', 1)]</field>
<field name="groups"
eval="[(3, ref('hr_base.group_account_manager')),
(4, ref('hr_base.group_executive_manager')),
(4, ref('hr_base.group_general_manager')),
(4, ref('hr.group_hr_user'))]" />
</record>
<record id="hr_re_contract_comp_rule" model="ir.rule">
<field name="name">hr re contract company rule</field>
<field name="model_id" ref="model_hr_re_contract" />
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in',
company_ids)]</field>
</record>
<record id="hr_contract_type_comp_rule" model="ir.rule">
<field name="name">Contract Type company rule</field>
<field name="model_id" ref="model_hr_contract_type" />
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in',
company_ids)]</field>
</record>
<!-- Contract -->
<record id="employee_contract_rule_only" model="ir.rule">
<field name="name"> Employee: views his Contract Only</field>
<field name="model_id" ref="model_hr_contract" />
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]" />
</record>
<record id="employee_contract_all_rule" model="ir.rule">
<field name="name"> HR: views all employee Contract </field>
<field name="model_id" ref="model_hr_contract" />
<field name="domain_force">[(1 ,'=', 1)]</field>
<field name="groups"
eval="[(4, ref('hr.group_hr_manager')),
(4, ref('hr.group_hr_user')),
(4, ref('hr_base.group_general_manager')),]" />
</record>
<!--hr_contract_extension-->
<record id="employee_extension_rule_only" model="ir.rule">
<field name="name"> Employee: views his extension Only</field>
<field name="model_id" ref="model_hr_contract_extension" />
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]" />
</record>
<record id="contract_extension_manager_rule" model="ir.rule">
<field name="name">Manager: views extension requests of its subordinates
</field>
<field name="model_id" ref="model_hr_contract_extension" />
<field name="domain_force">['|',('department_id.manager_id.user_id','=',
[user.id]),
('department_id.parent_id.manager_id.user_id','=', [user.id])]
</field>
<field name="groups"
eval="[(4, ref('hr_base.group_department_manager')),(4, ref('hr_base.group_division_manager'))]" />
</record>
<record id="contract_extension_all_rule" model="ir.rule">
<field name="name">Manager: views extension requests of all employee
</field>
<field name="model_id" ref="model_hr_contract_extension" />
<field name="domain_force">[(1 ,'=', 1)]</field>
<field name="groups"
eval="[(4, ref('hr_base.group_executive_manager')),
(4, ref('hr_base.group_general_manager')),
(4, ref('hr.group_hr_user'))]" />
</record>
<record id="contract_extension_comp_rule" model="ir.rule">
<field name="name">extension contract company rule</field>
<field name="model_id" ref="model_hr_contract_extension" />
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in',
company_ids)]</field>
</record>
</data>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -0,0 +1,22 @@
@media (min-width: 768px) {
.rtl .navbar-right {
float: left !important;
}
.rtl .navbar-right .dropdown .dropdown-menu {
right: auto !important;
left: 0 !important;
}
.rtl .navbar-left {
float: right !important;
}
.rtl .navbar-left .dropdown .dropdown-menu {
left: auto !important;
right: 0 !important;
}
.navbar-nav.navbar-right:last-child {
margin-left: auto;
}
.rtl .pull-left {
float: right !important;
}
}

View File

@ -0,0 +1,419 @@
<?xml version="1.0"?>
<odoo>
<data>
<record id="hr_contract_form_view" model="ir.ui.view">
<field name="name">hr.contract.form.inherit</field>
<field name="model">hr.contract</field>
<field name="priority" eval="16" />
<field name="inherit_id" ref="hr_contract.hr_contract_view_form" />
<field name="arch" type="xml">
<xpath expr="//div" position="before">
<!-- Create effective from directly from contract -->
<div class="oe_button_box" name="button_box">
<button class="btn-primary" name="action_view_effective_frm"
string="Effective Form" widget="statinfo" icon="fa-book" type="object" />
</div>
</xpath>
<header position="replace">
<header>
<button name="program_directory" string="program Director"
class="oe_highlight" type="object"
invisible="state != 'employeed_aproval'" groups="hr.group_hr_manager" />
<!-- states="employeed_aproval"
groups="hr_base.group_executive_manager"/>-->
<!-- <button name="hr_head_approval" string="HR Head Approval"
class="oe_highlight"-->
<!-- type="object" states="employeed_aproval"
groups="hr.group_hr_manager"/>-->
<button name="employeed_aproval" string="Employee Approval"
class="oe_highlight"
type="object" invisible="state != 'draft'" groups="hr.group_hr_user" />
<button name="end_contract_state" string="End Contract" class="oe_highlight"
type="object" invisible="state != 'program_directory'"
groups="hr.group_hr_manager" />
<button name="draft_state" string="Set To Draft" class="oe_highlight"
type="object" invisible="state == 'draft'"
groups="hr.group_hr_user" />
<field name="state" widget="statusbar"
statusbar_visible="draft,employeed_aproval,program_directory,end_contract" />
</header>
<!--
statusbar_visible="draft,employeed_aproval,hr_head_approval,program_directory,end_contract"/>-->
<!-- -->
</header>
<field name="employee_id" position="replace" />
<field name="name" position="after">
<field name="employee_id" domain="[('active','=',True)]"
nolabel="1" required="1" placeholder="Choose Employee Number" />
</field>
<field name="job_id" position="replace">
<field name="check_nationality" invisible="1" force_save="1" />
<field name="active" readonly="state != 'draft'" />
<field name="contract_draft" invisible="1" />
<field name="employee_name" required="1" readonly="1" />
<field name="emp_type" required="1"
readonly="state != 'draft'" />
<field name="saudi_emp_type"
required="check_nationality == True"
invisible="check_nationality == False" readonly="state != 'draft'" />
<field name="is_gosi_deducted" string="Is gosi?"
invisible="saudi_emp_type != 'saudi-contract'"
required="saudi_emp_type == 'saudi-contract'" readonly="state != 'draft'" />
<field name="job_id" domain="[('department_id','=',department_id)]" required="1"
readonly="1" />
<field name="nationality" readonly="1" string="Nationality " />
<field name="check_nationality" string="Saudi?" force_save="1" />
<field name="previous_contract_id" readonly="1" string="Previous Contract" />
<field name="period_ticket" string="Period Ticket"
invisible="check_nationality == True" />
</field>
<xpath expr="//group[@name='top_info_left']" position="replace">
<group name="duration_group">
<field name="contract_duration_cal" invisible="1" />
<field name="trial_duration" invisible="1" />
<field name="contract_type" invisible="1" />
<field name="contract_status" string="contract description" required="1"
readonly="state != 'draft'" />
<field name="contract_description" string="contract type"
required="contract_draft == False" readonly="state != 'draft'" />
<field name="contract_duration"
required="(contract_draft == False) and (contract_description != 'permanent')"
invisible="contract_description == 'permanent'"
readonly="state != 'draft'" />
<field name="hiring_date" string="Hiring Date" />
<field name="date_start" readonly="state != 'draft'" />
<field name="date_end" string="End Date"
required="contract_description != 'permanent'"
readonly="(state == 'employeed_aproval') or (state == 'hr_head_approval') or (state == 'end_contract')" />
<field name="contractor_type" readonly="state != 'draft'" />
<!--field
name="salary_status" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="recruited_talent" attrs="{'readonly':[('state','!=','draft')]}"/-->
<field name="class_contract" readonly="state != 'draft'"
required="1" />
</group>
</xpath>
<xpath expr="//page[@name='information']/group[@name='salary_info']"
position="replace">
<group name="salary_info" groups="hr.group_hr_user">
<group name="salary" invisible="consultants == True">
<field name="salary" required="1"
readonly="state != 'draft'" />
<field name="salary_insurnce"
readonly="state != 'draft'" />
<field name="ticket_allowance"
readonly="state != 'draft'" />
<field name="last_salary_gosi"
readonly="state != 'draft'" />
<field name="has_housing" readonly="state != 'draft'" />
<field name="has_transportation"
readonly="state != 'draft'" />
<!--field
name="suspended" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="social_insurance" attrs="{'readonly':[('state','!=','draft')]}"/-->
</group>
<group name="consultants Salary"
invisible="consultants == False">
<field name="consultants" invisible="1" />
<field name="consultant_salary" required="1"
readonly="state != 'draft'"
/>
<field name="consultant_hour"
readonly="state != 'draft'"
/>
<field name="max_consultant_hour"
readonly="state != 'draft'"
/>
</group>
</group>
</xpath>
<xpath expr="//field[@name='department_id']" position="attributes">
<attribute name="readonly">True</attribute>
</xpath>
<xpath expr="//page[1]" position="after">
<page string="Work Permit" invisible="1">
<group>
<group>
<field name="visa_no" />
<!-- <field name="visa_expire" />-->
<field name="permit_no" />
<field name="passport_number" readonly="1" />
<field name="passport_issue_date" />
<field name="passport_expiry_date" />
<field name="passport_issue_place" />
</group>
<group>
<field name="saudi_id_iqama" />
<field name="saudi_id_iqama_date" />
<field name="saudi_id_iqama_expiry" />
<field name="saudi_com_number" />
<field name="saudi_com_date" />
<field name="saudi_com_expiry_date" />
<field name="bls_date" />
<field name="acls_date" />
<field name="insurance_date" />
<field name="specialty" />
<field name="category" />
<field name="breakdown_allowance" />
</group>
</group>
</page>
</xpath>
<xpath expr="//page[1]" position="after">
<page string="Insurance" invisible="consultants == True">
<group string="Insurance" name="Insurance" groups="hr.group_hr_user">
<group>
<field name="gosi_deduction"
string="Percentage of employee insurance"
readonly="state != 'draft'" />
<field name="gosi_employer_deduction"
string="Percentage of company insurance"
readonly="state != 'draft'" />
<field name="total_gosi" string="Total Insurance"
readonly="state != 'draft'" />
</group>
</group>
</page>
<page string="Dependents and Family"
readonly="state != 'draft'">
<sheet>
<field name="employee_dependant"
readonly="state != 'draft'">
<list string="Employee Dependants">
<field name="name" required="1" />
<!--<field
name="age" required="1" />-->
<field name="gender" required="1" />
<field name="relation" required="1" />
<field name="passport_no" required="1" />
<field name="nationality" string="Nationality" required="1" />
<field name="birthday" string="BirthDay" required="1" />
<field name="has_ticket" />
<field name="has_Insurance" />
<field name="attachment" string="Attachment"
widget="many2many_binary" class="oe_inline" />
<field name="contract_id" invisible="1" />
</list>
<form string="Create Employee Dependants">
<group>
<group>
<field name="name" required="1" />
<field name="birthday" required="1" />
<field name="relation" required="1" />
<field name="has_ticket" required="1" />
<field name="passport_no" />
<field name="passport_expire_date" />
<field name="identity_num" required="1" />
</group>
<group col="2">
<!-- <field name="age" required="1" />-->
<field name="gender" required="1" />
<field name="nationality" required="1" />
<field name="passport_issue_date" />
<field name="has_Insurance" />
<field name="degree_medical_insu"
invisible="has_Insurance == False" />
<field name="medical_insurance_num"
invisible="has_Insurance == False" />
<field name="attachment" string="Attachment"
widget="many2many_binary" class="oe_inline" />
</group>
</group>
<group>
<field name="remarks" />
</group>
</form>
</field>
</sheet>
</page>
<page string="Personal Information" invisible="1">
<group>
<group>
<field name="blood_type" />
<field name="point_of_hire" />
<field name="contact_address" />
<field name="mobile_no" />
<field name="p_o_box_no" />
<field name="driving_lic_issue_date" />
<field name="driving_lic_exp_date" />
<field name="driving_lic_issue_place" />
</group>
<group>
<field name="religion" />
<field name="gender" />
<field name="marital" />
<field name="date_of_birth" />
<field name="birth_place" />
<field name="zip_code" />
<field name="to_contact" />
</group>
</group>
</page>
</xpath>
<xpath expr="//field[@name='struct_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='struct_id']" position="attributes">
<attribute name="required">0</attribute>
</xpath>
<xpath expr="//field[@name='structure_type_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='schedule_pay']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group" position="after">
<group>
<group string="Salary Scale" name="salary_scale_group">
<label for="all_exper_year" string="Total All Experience" />
<div>
<field name="all_exper_year" readonly="1" force_save="1"
class="oe_inline" />Years <field name="all_exper_month"
readonly="1" force_save="1" class="oe_inline" />Months <field
name="all_exper_day" readonly="1" force_save="1"
class="oe_inline" />Days </div>
</group>
<group name="duration_group" string="Duration">
<label for="trial_date_start" string="Trial Period Duration" />
<div>
<field name="trial_date_start" class="oe_inline"
readonly="state != 'draft'" /> - <field
name="trial_date_end" class="oe_inline"
readonly="state != 'draft'" />
</div>
<field name="trial_duration" string="Trial Duration" />
<field name="working_hours"
readonly="state != 'draft'" />
<field name="join_date" invisible="1" />
</group>
</group>
</xpath>
<!--readonly
fields in state draft-->
<field name="name" position="attributes">
<attribute name="readonly">1</attribute>
</field>
<field name="employee_id" position="attributes">
<attribute name="readonly">state != 'draft'</attribute>
</field>
<field name="structure_type_id" position="attributes">
<attribute name="readonly">state != 'draft'</attribute>
</field>
<field name="company_id" position="attributes">
<attribute name="readonly">state != 'draft'</attribute>
</field>
</field>
</record>
<!-- view_employee_inherit_tree -->
<record id="hr_contract_view_tree_inherit" model="ir.ui.view">
<field name="name">hr.contract.inherit.tree</field>
<field name="model">hr.contract</field>
<field name="inherit_id" ref="hr_contract.hr_contract_view_tree" />
<field name="arch" type="xml">
<list position="replace">
<list
decoration-danger="state == 'end_contract'"
decoration-info="state == 'draft'"
string="Contracts"
>
<field name="name" />
<field name="employee_id" />
<field name="department_id" />
<field name="job_id" />
<field name="type_id" invisible="1" />
<field name="emp_type" />
<field name="resource_calendar_id" invisible="1" />
<field name="date_start" />
<field name="date_end" />
<field name="salary" invisible="1" />
<field name="message_needaction" invisible="1" />
<field name="state" />
</list>
</list>
</field>
</record>
<record id="hr_contract_type_view_search" model="ir.ui.view">
<field name="name">hr.contract.type.search</field>
<field name="model">hr.contract.type</field>
<field name="arch" type="xml">
<search string="Search Contract Type">
<field name="name" string="Contract Type" />
<field name="sequence" string="Sequence" />
</search>
</field>
</record>
<record id="hr_contract_type_view_form" model="ir.ui.view">
<field name="name">hr.contract.type.form</field>
<field name="model">hr.contract.type</field>
<field name="arch" type="xml">
<form string="Contract Type">
<group col="4">
<field name="name" />
<field name="salary_type" />
<field name="code" />
<field name="consultants" />
<field name="company_id" groups="base.group_multi_company" readonly="1" />
</group>
</form>
</field>
</record>
<record id="action_hr_contract_type" model="ir.actions.act_window">
<field name="name">Contract Types</field>
<field name="res_model">hr.contract.type</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="hr_contract_type_view_search" />
</record>
<!-- contract_view_kanban_inherit -->
<record id="hr_contract_view_kanban_inherit" model="ir.ui.view">
<field name="inherit_id" ref="hr_contract.hr_contract_view_kanban" />
<field name="model">hr.contract</field>
<field name="arch" type="xml">
<xpath expr="//kanban" position="attributes">
<attribute name="records_draggable">false</attribute>
</xpath>
<xpath expr="//field[@name='name']" position="after">
<div class="text-muted o_kanban_record_subtitle">
<field name="employee_id" />
</div>
<div class="text-muted o_kanban_record_subtitle">
<field name="date_start" />
</div>
</xpath>
</field>
</record>
<menuitem
id="hr_menu_contract_type"
action="action_hr_contract_type"
parent="hr.menu_human_resources_configuration"
sequence="3"
groups="hr.group_hr_user" />
</data>
</odoo>

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="contract_form_view" model="ir.ui.view">
<field name="name">Contract.Extension</field>
<field name="model">hr.contract.extension</field>
<field name="arch" type="xml">
<form string="Contract Extension">
<header>
<button name="confirm" string="Confirm" class="oe_highlight" type="object"
invisible="state != 'draft'" groups="hr.group_hr_user" />
<!--##########
Employee Confirm ###############-->
<button string="Employee Confirm" name="emp_confirm" type="object"
class="oe_highlight" groups="base.group_user"
invisible="state != 'emp_confirm' or type != 'extension'" />
<button name="refused" string="Refused" class="oe_highlight" type="object"
groups="base.group_user"
invisible="state != 'emp_confirm' or type != 'extension'" />
<!--####################
End ###################-->
<button name="direct_manager" string="Direct Manager" class="oe_highlight"
type="object" invisible="state != 'confirm'"
groups="hr_base.group_division_manager" />
<button name="refused" string="Refused" class="oe_highlight" type="object"
invisible="state != 'confirm'" groups="hr_base.group_division_manager" />
<button name="hr_approve" string="HR Approve" class="oe_highlight"
type="object" invisible="state != 'direct_manager'"
groups="hr.group_hr_user" />
<button name="refused" string="Refused" class="oe_highlight" type="object"
invisible="state != 'direct_manager'" groups="hr.group_hr_user" />
<button name="draft_state" string="Re-Draft" class="oe_highlight"
type="object" invisible="state not in ('refused', 'hr_approve')"
groups="hr.group_hr_user"
confirm="Are you sure to Reset To Draft This Record?" />
<field name="state" widget="statusbar" />
</header>
<sheet>
<div class="oe_title">
<label for="employee_id" class="oe_edit_only" />
<h1>
<field name="employee_id" readonly="state != 'draft'"
domain="[('state','=','open')]" />
</h1>
</div>
<group col="4" string="Employee Information">
<field name="company_id" groups="base.group_multi_company" readonly="1" />
<field name="contract_id" required="1" readonly="1" force_save="1" />
<field name="department_id" readonly="1" force_save="1" />
<field name="old_date_from" readonly="1" force_save="1" />
<field name="old_date_to" readonly="1" force_save="1" />
<field name="type" required="1"
readonly="state not in ('draft', 'confirm')" />
<field name="end_date" string="End Date"
readonly="state not in ('draft', 'confirm')"
invisible="type != 'end'" required="type == 'end'" />
</group>
<group col="4" string="Extension Information"
invisible="type != 'extension'">
<field name="date_from" readonly="state not in ('draft', 'confirm')"
required="type == 'extension'" />
<field name="date_to" readonly="state not in ('draft', 'confirm')"
required="type == 'extension'" />
</group>
<group string="Comments">
<field name="comments" readonly="state not in ('draft', 'confirm')"
required="1" />
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>
<record id="contract_tree_view" model="ir.ui.view">
<field name="name">Contract.Extension.Tree</field>
<field name="model">hr.contract.extension</field>
<field name="arch" type="xml">
<list decoration-danger="state == 'refused'" decoration-info="state == 'draft'"
string="Contract Extension">
<field name="employee_no" string="Employee Number" />
<field name="employee_id" />
<field name="department_id" />
<field name="type" />
<field name="state" string="State" />
</list>
</field>
</record>
<record id="contract_search_view" model="ir.ui.view">
<field name="name">Contract.Extension.search</field>
<field name="model">hr.contract.extension</field>
<field name="arch" type="xml">
<search>
<field name="employee_id" />
<field name="employee_no" />
<field name="department_id" />
<field name="type" />
<field name="state" />
<group expand="0" string="Group By">
<filter name="group_employee" string="Employee" domain="[]"
context="{'group_by': 'employee_id'}" />
<filter name="group_department" string="Department" domain="[]"
context="{'group_by': 'department_id'}" />
</group>
</search>
</field>
</record>
<record id="extension_action_view" model="ir.actions.act_window">
<field name="name">Contract Extension</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.contract.extension</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
<!-- Add Text Here -->
</p>
</field>
</record>
<menuitem id="contract_extension_menu" name="Contract Extension" parent="hr.menu_hr_main"
action="extension_action_view"
sequence="3" />
</data>
</odoo>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="hr_employee_form_view_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='contract_id']" position="before">
<field name="employee_type_id" string="Employee Type" required="1"
readonly="state != 'draft'" />
</xpath>
<xpath expr="//notebook//page[@name='hr_settings']" position="before">
<page string="Dependents and Family" readonly="state != 'draft'">
<field name="employee_dependant" readonly="state != 'draft'">
<list string="Employee Dependants">
<field name="name" required="1" />
<!-- <field name="age" required="1" />-->
<field name="gender" required="1" />
<field name="relation" required="1" />
<field name="passport_no" required="1" />
<field name="nationality" string="Nationality" required="1" />
<field name="birthday" string="BirthDay" required="1" />
<field name="has_ticket" />
<field name="has_Insurance" />
<field name="attachment" string="Attachment" widget="many2many_binary"
class="oe_inline" />
<field name="contract_id" invisible="1" />
</list>
<form string="Create Employee Dependants">
<group>
<group>
<field name="name" required="1" />
<field name="birthday" required="1" />
<field name="relation" required="1" />
<field name="has_ticket" required="1" />
<field name="passport_no" />
<field name="passport_expire_date" />
<field name="identity_num" required="1" />
</group>
<group col="2">
<!-- <field name="age" required="1" />-->
<field name="gender" required="1" />
<field name="nationality" required="1" />
<field name="passport_issue_date" />
<field name="has_Insurance" />
<field name="degree_medical_insu"
invisible="has_Insurance == False" />
<field name="medical_insurance_num"
invisible="has_Insurance == False" />
<field name="attachment" string="Attachment"
widget="many2many_binary" class="oe_inline" />
</group>
</group>
<group>
<field name="remarks" />
</group>
</form>
</field>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Top menu item -->
<record id="open_view_re_contracting_form" model="ir.actions.act_window">
<field name="name">Re-Contracting</field>
<field name="res_model">hr.re.contract</field>
<field name="view_mode">list,form</field>
</record>
<record id="view_re-contracting_form" model="ir.ui.view">
<field name="name">re-contracting</field>
<field name="model">hr.re.contract</field>
<field name="arch" type="xml">
<form string="Contracting">
<header>
<button name="action_submit" string="Submit" type="object"
class="oe_highlight" groups="hr.group_hr_user"
invisible="state != 'draft'" />
<button name="action_direct_manager" string="Direct Manager" type="object"
class="oe_highlight" groups="hr_base.group_division_manager"
invisible="state != 'submitted'" />
<button name="action_refuse" string="Refuse" type="object"
class="oe_highlight" groups="hr_base.group_division_manager"
invisible="state != 'submitted'" />
<button name="action_hr_manager" string="HR Manager" type="object"
class="oe_highlight" groups="hr.group_hr_manager"
invisible="state != 'direct_manager'" />
<button name="action_refuse" string="Refuse" type="object"
class="oe_highlight" groups="hr.group_hr_manager"
invisible="state != 'direct_manager'" />
<button name="action_done" string="Re-Contract" type="object"
class="oe_highlight" groups="hr.group_hr_manager"
invisible="state != 'hr_manager'" />
<button name="action_refuse" string="Refuse" type="object"
class="oe_highlight" groups="hr.group_hr_manager"
invisible="state != 'hr_manager'" />
<button name="action_set_to_draft" string="Set To Draft" type="object"
class="oe_highlight" groups="hr.group_hr_manager"
confirm="Are you sure to Reset To Draft This Record?"
invisible="state not in ('refuse','done')" />
<field name="state" widget="statusbar" />
</header>
<sheet>
<div class="oe_title">
<label for="employee_id" class="oe_inline" />
<h2>
<field name="employee_id" domain="[('active','=',True)]"
required="1"
class="oe_inline" readonly="state != 'draft'" />
</h2>
</div>
<group>
<group>
<field name="date" readonly="state != 'draft'"
string="Date Request" required="1" />
<field name="job_id" readonly="1" />
<field name="department_id" readonly="1" />
<field name="hire_date" readonly="1" />
<field name="contract_id"
options="{'no_create': True, 'no_create_edit':True,'no_open': True}"
readonly="1" />
<field name="start_date" readonly="1" />
<field name="eoc_date" readonly="1" />
<field name="iqama_end_date" readonly="1" />
<field name="company_id" groups="base.group_multi_company"
readonly="1" />
</group>
<group>
<field name="last_renewal" string="Last Renewal?" />
<field name="contract_type" required="1" string="Contract Type"
readonly="state not in ('draft','submitted','direct_manager')" />
<field name="effective_date"
required="state in ('submitted','direct_manager')"
readonly="state not in ('draft','submitted','direct_manager')" />
<field name="new_contract_start_date"
string="New Contract Start Date"
required="state in ('submitted','direct_manager')"
readonly="state not in ('draft','submitted','direct_manager')" />
<field name="new_contract_end_date" string="New Contract End Date"
required="(state in ('submitted','direct_manager')) and (contract_type == 'temporary')"
readonly="state not in ('draft','submitted','direct_manager')" />
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_re-contracting_tree">
<field name="name">re-contracting</field>
<field name="model">hr.re.contract</field>
<field name="arch" type="xml">
<list decoration-success="state=='done'" decoration-info="state == 'draft'"
string="Contracting">
<field name="employee_id" />
<field name="date" />
<field name="effective_date" />
<field name="state" string="State" />
</list>
</field>
</record>
<menuitem parent="hr.menu_hr_root" name="Re-Contract" id="hr_employee_re_contract_menu"
sequence="12" />
<menuitem parent="hr_employee_re_contract_menu" id="hr_employee_re_contract_menu_sub"
name="Contract"
action="open_view_re_contracting_form" />
</data>
</odoo>