hr nomination

This commit is contained in:
Esraa-Exp 2025-04-20 13:27:01 +02:00
commit 48f2b6ccb5
14 changed files with 126 additions and 36 deletions

View File

@ -7,6 +7,7 @@ from odoo.exceptions import UserError
class HrAttendanceTransactions(models.Model):
_name = 'hr.attendance.transaction'
_inherit = ['mail.thread', 'mail.activity.mixin']
_rec_name = 'employee_id'
_order = 'date DESC'

View File

@ -73,6 +73,11 @@
</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>

View File

@ -21,7 +21,9 @@ access_manager_appraisal_user,manager.appraisal.user,model_manager_appraisal,exp
access_manager_appraisal_line_all,manager.appraisal.line.all,model_manager_appraisal_line,,1,1,1,1
access_customize_appraisal_all,customize.appraisal.all,model_customize_appraisal,,1,1,1,1
access_manager_appraisal_complete_line_all,manager.appraisal.complete.line.all,model_manager_appraisal_complete_line,,1,1,1,1
access_customize_complete_appraisal_all,customize.complete.appraisal.all,model_customize_complete_appraisal,,1,1,1,1
access_customize_complete_appraisal_all,customize.complete.appraisal.all,model_customize_complete_appraisal,exp_hr_appraisal.group_appraisal_employee,1,1,1,1
access_customize_complete_appraisal_user,customize.complete.appraisal.user,model_customize_complete_appraisal,exp_hr_appraisal.group_appraisal_user,1,1,1,1
access_customize_complete_appraisal_write_only,customize.complete.appraisal.write.only,model_customize_complete_appraisal,base.group_user,0,1,0,0
access_appraisal_degree_all,appraisal.degree.all,model_appraisal_degree,,1,1,0,0
access_appraisal_degree_user,appraisal.degree.user,model_appraisal_degree,exp_hr_appraisal.group_appraisal_user,1,1,1,0
access_appraisal_setting,appraisal.setting,model_appraisal_setting,base.group_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
21 access_manager_appraisal_line_all manager.appraisal.line.all model_manager_appraisal_line 1 1 1 1
22 access_customize_appraisal_all customize.appraisal.all model_customize_appraisal 1 1 1 1
23 access_manager_appraisal_complete_line_all manager.appraisal.complete.line.all model_manager_appraisal_complete_line 1 1 1 1
24 access_customize_complete_appraisal_all customize.complete.appraisal.all model_customize_complete_appraisal exp_hr_appraisal.group_appraisal_employee 1 1 1 1
25 access_customize_complete_appraisal_user customize.complete.appraisal.user model_customize_complete_appraisal exp_hr_appraisal.group_appraisal_user 1 1 1 1
26 access_customize_complete_appraisal_write_only customize.complete.appraisal.write.only model_customize_complete_appraisal base.group_user 0 1 0 0
27 access_appraisal_degree_all appraisal.degree.all model_appraisal_degree 1 1 0 0
28 access_appraisal_degree_user appraisal.degree.user model_appraisal_degree exp_hr_appraisal.group_appraisal_user 1 1 1 0
29 access_appraisal_setting appraisal.setting model_appraisal_setting base.group_user 1 1 1 1

View File

@ -2644,7 +2644,28 @@ msgstr "في انتظار المدير المباشر"
msgid "HR Nomination"
msgstr "الترشيح بواسطة الموارد البشرية"
#. module: exp_official_mission
#: code:addons/exp_official_mission/models/hr_official_mission.py:0
#, python-format
msgid "Sorry, The Approval For The Direct Manager '%s' Only OR HR Manager!"
msgstr "للأسف، لموافقة المدير المباشر '%s' فقط او مدير الموارد البشرية !"
#. module: exp_official_mission
#: code:addons/exp_official_mission/models/hr_official_mission.py:0
msgid "Sorry, The Refuse For The Direct Manager '%s' Only OR HR Manager!"
msgstr "للأسف، لرفض المدير المباشر '%s' فقط او مدير الموارد البشرية !"
#. module: exp_official_mission
#: code:addons/exp_official_mission/models/hr_official_mission.py:0
#, python-format
msgid "Sorry, The Approval For The Department Manager %s Only OR HR Manager!"
msgstr "للأسف، لموافقة مدير الادارة '%s' فقط او مدير الموارد البشرية !"
#. module: exp_official_mission
#: code:addons/exp_official_mission/models/hr_official_mission.py:0
msgid "Sorry, The Refuse For The Department Manager %s Only OR HR Manager"
msgstr "للأسف، لرفض مدير الادارة '%s' فقط او مدير الموارد البشرية !"

View File

@ -489,12 +489,59 @@ class HrOfficialMission(models.Model):
self.employee_ids.compute_Training_cost_emp()
self.employee_ids.write({'status': 'approved'})
self.state = "direct_manager"
for rec in self:
manager = rec.sudo().employee_id.parent_id
hr_manager = rec.sudo().employee_id.company_id.hr_manager_id
if manager:
if manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.write({'state': 'direct_manager'})
else:
raise exceptions.Warning(
_("Sorry, The Approval For The Direct Manager '%s' Only OR HR Manager!")%(manager.name))
else:
rec.write({'state': 'direct_manager'})
#Refuse For The Direct Manager Only
def direct_manager_refused(self):
for rec in self:
manager = rec.sudo().employee_id.parent_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
if manager:
if manager.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.refused()
else:
raise exceptions.Warning(_("Sorry, The Refuse For The Direct Manager '%s' Only OR HR Manager!") % (manager.name))
else:
rec.refused()
def depart_manager(self):
# self.chick_employee_ids()
self.employee_ids.chick_not_overtime()
self.sudo().employee_ids.chick_not_overtime()
self.employee_ids.compute_Training_cost_emp()
self.state = "depart_manager"
for rec in self:
coach = rec.sudo().employee_id.coach_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
if coach:
if coach.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.state = 'depart_manager'
else:
raise exceptions.Warning(
_('Sorry, The Approval For The Department Manager %s Only OR HR Manager!') % (coach.name))
else:
rec.state = 'depart_manager'
#Refuse For The Department Manager Only
def dep_manager_refused(self):
self.reset_emp_work_state()
for rec in self:
coach = rec.sudo().employee_id.coach_id
hr_manager = rec.sudo().employee_id.user_id.company_id.hr_manager_id
if coach:
if coach.user_id.id == rec.env.uid or hr_manager.user_id.id == rec.env.uid:
rec.refused()
else:
raise exceptions.Warning(_('Sorry, The Refuse For The Department Manager %s Only OR HR Manager') % (coach.name))
else:
rec.refused()
def hr_aaproval(self):
# self.chick_employee_ids()

View File

@ -1,7 +1,7 @@
id,name,model_id:id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_hr_official_mission_type,access_hr_official_mission_type,model_hr_official_mission_type,base.group_user,1,0,0,0
access_hr_official_mission_type_hr,access_hr_official_mission_type_hr,model_hr_official_mission_type,hr.group_hr_user,1,1,1,1
access_hr_official_mission,access_hr_official_mission,model_hr_official_mission,,1,1,1,1
access_hr_official_mission,access_hr_official_mission,model_hr_official_mission,base.group_user,1,1,1,1
access_hr_official_mission_employee,access_hr_official_mission_employee,model_hr_official_mission_employee,,1,1,1,1
access_mission_destination,access_mission_destination,model_mission_destination,base.group_user,1,0,0,0
access_mission_destination_hr,access_mission_destination_hr,model_mission_destination,hr.group_hr_user,1,1,1,1

1 id name model_id:id group_id/id perm_read perm_write perm_create perm_unlink
2 access_hr_official_mission_type access_hr_official_mission_type model_hr_official_mission_type base.group_user 1 0 0 0
3 access_hr_official_mission_type_hr access_hr_official_mission_type_hr model_hr_official_mission_type hr.group_hr_user 1 1 1 1
4 access_hr_official_mission access_hr_official_mission model_hr_official_mission base.group_user 1 1 1 1
5 access_hr_official_mission_employee access_hr_official_mission_employee model_hr_official_mission_employee 1 1 1 1
6 access_mission_destination access_mission_destination model_mission_destination base.group_user 1 0 0 0
7 access_mission_destination_hr access_mission_destination_hr model_mission_destination hr.group_hr_user 1 1 1 1

View File

@ -27,7 +27,7 @@
<button name="direct_manager" string="Direct Manager Approve" class="oe_highlight" type="object"
states="send" groups="hr_base.group_division_manager"/>
<button name="refused" string="Refused" class="oe_highlight" type="object"
<button name="direct_manager_refused" string="Refused" class="oe_highlight" type="object"
states="send" groups="hr_base.group_division_manager"/>
<button name="approve" string="HR Approval" class="oe_highlight" type="object"

View File

@ -22,14 +22,15 @@
<header>
<button name="send" string="Submit" class="oe_highlight" type="object"
states="draft" groups="base.group_user"/>
<button name="direct_manager" string="Direct Manager Approve" class="oe_highlight" type="object"
states="send" groups="hr_base.group_division_manager"/>
<button name="refused" string="Refused" class="oe_highlight" type="object"
<button name="direct_manager_refused" string="Refused" class="oe_highlight" type="object"
states="send" groups="hr_base.group_division_manager"/>
<button name="depart_manager" string="Department Manager" class="oe_highlight" type="object"
states="direct_manager" groups="hr_base.group_department_manager"/>
<button name="refused" string="Refused" class="oe_highlight" type="object"
<button name="dep_manager_refused" string="Refused" class="oe_highlight" type="object"
states="direct_manager" groups="hr_base.group_department_manager"/>
<button name="hr_aaproval" string="HR Officer Approval" class="oe_highlight" type="object"

View File

@ -23,13 +23,12 @@
<button name="send_depart_manager" string="Submit" class="oe_highlight" type="object"
states="draft" groups="base.group_user"/>
<button name="direct_manager" string="Direct Manager Approve" class="oe_highlight" type="object"
states="send" groups="hr_base.group_division_manager"/>
<button name="refused" string="Refused" class="oe_highlight" type="object"
states="send" groups="hr_base.group_division_manager"/>
states="send" groups="hr_base.group_division_manager"/>
<button name="direct_manager_refused" string="Refused" class="oe_highlight" type="object"
<button name="depart_manager" string="Department Manager" class="oe_highlight" type="object"
states="direct_manager" groups="hr_base.group_department_manager"/>
<button name="refused" string="Refused" class="oe_highlight" type="object"
<button name="dep_manager_refused" string="Refused" class="oe_highlight" type="object"
states="direct_manager" groups="hr_base.group_department_manager"/>
<button name="hr_aaproval" string="HR Approval" class="oe_highlight" type="object"
@ -69,7 +68,7 @@
</div>
<group>
<group>
<field name="hr_nomination" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="hr_nomination" invisible="1"/>
<field name="process_type" invisible="1"/>
<field name="mission_type" string="Mission Type" required="1"
domain="[('work_state', '=', 'training'),('special_hours', '!=', True)]"

View File

@ -7,12 +7,12 @@
<menuitem name="Training Courses" id="exp_official_mission.employee_training_menu_item"
parent="hr_employee_training_main_menu" action="exp_official_mission.employee_training_action"
sequence="1"/>
sequence="1" groups="base.group_user"/>
<menuitem name="Employees Training Courses" id="hr_employee_official_mission_menu"
parent="hr_employee_training_main_menu"
action="exp_official_mission.hr_employees_training_lines_action"
sequence="2"/>
sequence="2" groups="base.group_user"/>
<menuitem name="Configurations" id="hr_official_mission_config_menu"
parent="hr_employee_training_main_menu" sequence="3"

View File

@ -8,7 +8,7 @@
'license': 'GPL-3',
'author': 'Expert Co. Ltd.',
'depends': ['base', 'hr', 'hr_base', 'hr_disciplinary_tracking', 'employee_requests', 'report_xlsx',
'exp_official_mission'],
'exp_official_mission', 'attendances'],
'data': [
'security/ir.model.access.csv',
'views/hr_department_job_wizard_view.xml',

View File

@ -136,14 +136,14 @@ class EmployeeAbsenceReport(models.AbstractModel):
li = []
attendance = self.env['hr.attendance.transaction'].sudo().search(
[('date', '>=', form['date_from']), ('date', '<=', form['date_to']),
('employee_id', 'in', employees.ids), ('approve_lateness', '=', False),
('employee_id', 'in', employees.ids), ('is_absent', '=', True),('approve_lateness', '=', False),
('public_holiday', '=', False), ('approve_personal_permission', '=', False), ('is_official', '=', False),('normal_leave', '=', False)])
for e in employees:
overall = sum(attendance.filtered(lambda r: r.employee_id == e).mapped('lateness')) + sum(
attendance.filtered(lambda r: r.employee_id == e).mapped('early_exit')) or 0
# overall = sum(attendance.filtered(lambda r: r.employee_id == e).mapped('lateness')) + sum(
# attendance.filtered(lambda r: r.employee_id == e).mapped('early_exit')) or 0
work_hour = e.resource_calendar_id.working_hours
day_price = e.contract_id.total_allowance / 30
overall_day = overall / work_hour if work_hour > 0 else 0
overall_day = len(attendance.filtered(lambda r: r.employee_id == e))
rec = {}
rec['employee'] = e.name
rec['id'] = e.emp_no

View File

@ -308,7 +308,7 @@
<menuitem
id="absence_report_menu"
name="Absence Report"
parent="main_reports_menu"
parent="attendances.parent_attendance_report_employee"
action="absence_report_actions"
/>

View File

@ -344,7 +344,11 @@ class ReportTerminationPublic(models.AbstractModel):
if rule.id == item.get('salary_rule_id') and rule.category_id.rule_type == 'deduction':
total -= item.get('amount')
salary_for_eos += total
leave_balance = 0
leave_balance_money = 0
cause_type_amount = 0
minus_five_years_amount = 0
plus_five_years_amount = 0
# Get salary rule form cause type
if first_hire_date and last_work_date and cause_type_id:
start_date = dt.strptime(str(first_hire_date), "%Y-%m-%d")
@ -387,14 +391,21 @@ class ReportTerminationPublic(models.AbstractModel):
if line.date_to <= all_duration:
if line.amount > 0:
duration_to = line.date_to - duration_to
reward_amount += total_rules * (duration_to / 12) * line.factor
termination_amount = total_rules * (duration_to / 12) * line.factor
reward_amount += termination_amount
resedual = all_duration - line.date_to
if line.date_to <= 60:
minus_five_years_amount += termination_amount
else:
plus_five_years_amount += termination_amount
else:
if line.date_to > all_duration:
reward_amount += total_rules * resedual / 12 * line.factor
break
resedual = 0
termination_amount = total_rules * resedual / 12 * line.factor
reward_amount += termination_amount
if line.date_to <= 60:
minus_five_years_amount += termination_amount
else:
plus_five_years_amount += termination_amount
break
reward_amount = reward_amount * line_amount
cause_type_amount = round(reward_amount, 2)
amount = self.compute_salary_rule(last_work_date, cause_type_amount, employee, cause_type_id.allowance_id, items,
@ -467,6 +478,8 @@ class ReportTerminationPublic(models.AbstractModel):
"total_loans": total_loans,
"net": net,
"cause_type_amount": cause_type_amount,
"minus_five_years_amount": minus_five_years_amount,
"plus_five_years_amount": plus_five_years_amount,
}
def get_duration_service(self, first_hire_date, end_date):
@ -598,6 +611,8 @@ class ReportTerminationPublic(models.AbstractModel):
total_allowance = result["total_allowance"]
total_loans = result["total_loans"]
net = result["net"]
plus_five_years_amount = result["plus_five_years_amount"]
minus_five_years_amount = result["minus_five_years_amount"]
cause_type_amount = result["cause_type_amount"]
leave_balance = result["leave_balance"]
leave_balance_money = result["leave_balance_money"]
@ -609,9 +624,9 @@ class ReportTerminationPublic(models.AbstractModel):
'ticket': ticket_num,
'ticket_price': ticket_price,
'leave_price': leave_balance_money,
'termination_price': net,
'five_year_price': cause_type_amount,
'amount': cause_type_amount,
'termination_price': cause_type_amount,
'five_year_price': minus_five_years_amount,
'amount': plus_five_years_amount,
'total': total_allowance,
'total_salary': 0.0,
'rule': '',
@ -619,7 +634,6 @@ class ReportTerminationPublic(models.AbstractModel):
}
rules = {}
lave_price = 0.0
if type == 'all' or type == 'salary' or type == 'leave':
for rule in rules_ids:
rule_amount = termination_model.compute_rule(rule, emp.contract_id)
@ -643,9 +657,9 @@ class ReportTerminationPublic(models.AbstractModel):
data['total_sum']['ticket_num'] += ticket_num
data['total_sum']['remaining_leaves'] += leave_balance
data['total_sum']['lave_price'] += leave_balance_money
data['total_sum']['termination_price'] += net
data['total_sum']['five_year_price'] += cause_type_amount
data['total_sum']['amount'] += cause_type_amount
data['total_sum']['termination_price'] += cause_type_amount
data['total_sum']['five_year_price'] += minus_five_years_amount
data['total_sum']['amount'] += plus_five_years_amount
data['total_sum']['total'] += total_allowance
mykey = list(dict.fromkeys(key_list))
return data, mykey