From fce2fdf99f6bd20973ef63ef60150f8dbd4f5449 Mon Sep 17 00:00:00 2001 From: FathiaBMExp Date: Mon, 14 Apr 2025 09:39:41 +0100 Subject: [PATCH 1/4] chore(odex25_hr): Task 12386 Absent report: Menu and days. Signed-off-by: FathiaBMExp --- odex25_hr/hr_base_reports/__manifest__.py | 2 +- odex25_hr/hr_base_reports/report/absence_execuse.py | 8 ++++---- odex25_hr/hr_base_reports/wizard/employee_cost_wizard.xml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/odex25_hr/hr_base_reports/__manifest__.py b/odex25_hr/hr_base_reports/__manifest__.py index 5ec308479..90c7cabcd 100644 --- a/odex25_hr/hr_base_reports/__manifest__.py +++ b/odex25_hr/hr_base_reports/__manifest__.py @@ -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', diff --git a/odex25_hr/hr_base_reports/report/absence_execuse.py b/odex25_hr/hr_base_reports/report/absence_execuse.py index acceed39a..1fe4470b8 100644 --- a/odex25_hr/hr_base_reports/report/absence_execuse.py +++ b/odex25_hr/hr_base_reports/report/absence_execuse.py @@ -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 diff --git a/odex25_hr/hr_base_reports/wizard/employee_cost_wizard.xml b/odex25_hr/hr_base_reports/wizard/employee_cost_wizard.xml index 7ce8849e4..e85f12cb5 100644 --- a/odex25_hr/hr_base_reports/wizard/employee_cost_wizard.xml +++ b/odex25_hr/hr_base_reports/wizard/employee_cost_wizard.xml @@ -308,7 +308,7 @@ From 2b11b648600287172b963e1f4bb0a59c03600675 Mon Sep 17 00:00:00 2001 From: FathiaBMExp Date: Mon, 14 Apr 2025 16:58:11 +0100 Subject: [PATCH 2/4] fix(hr_termination): Task 12230 Fix plus et minus five years amount. Signed-off-by: FathiaBMExp --- .../wizard/termination_report_wiz.py | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/odex25_hr/hr_termination/wizard/termination_report_wiz.py b/odex25_hr/hr_termination/wizard/termination_report_wiz.py index 185ced1e9..346bf87c7 100644 --- a/odex25_hr/hr_termination/wizard/termination_report_wiz.py +++ b/odex25_hr/hr_termination/wizard/termination_report_wiz.py @@ -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 From 433827c70d40030e41502f946705dbf5474d3d99 Mon Sep 17 00:00:00 2001 From: Samir Ladoui Date: Wed, 16 Apr 2025 08:21:17 +0100 Subject: [PATCH 3/4] [FIX] exp_hr_appraisal --- odex25_hr/exp_hr_appraisal/security/ir.model.access.csv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/odex25_hr/exp_hr_appraisal/security/ir.model.access.csv b/odex25_hr/exp_hr_appraisal/security/ir.model.access.csv index b286a2697..833d76d29 100644 --- a/odex25_hr/exp_hr_appraisal/security/ir.model.access.csv +++ b/odex25_hr/exp_hr_appraisal/security/ir.model.access.csv @@ -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 From 04baa81cb8ff4b175b6f826e38dcbb961d543aa0 Mon Sep 17 00:00:00 2001 From: Bakry Date: Thu, 17 Apr 2025 17:06:05 +0300 Subject: [PATCH 4/4] fix --- .../models/hr_attendance_transactions.py | 1 + .../views/hr_attendance_transactions.xml | 5 ++ odex25_hr/exp_official_mission/i18n/ar_001.po | 23 +++++++- .../models/hr_official_mission.py | 53 +++++++++++++++++-- .../views/especially_hours.xml | 2 +- .../views/hr_official_mission.xml | 5 +- .../exp_official_mission/views/training.xml | 4 +- 7 files changed, 83 insertions(+), 10 deletions(-) diff --git a/odex25_hr/attendances/models/hr_attendance_transactions.py b/odex25_hr/attendances/models/hr_attendance_transactions.py index 82ff550f0..3d6206dd7 100644 --- a/odex25_hr/attendances/models/hr_attendance_transactions.py +++ b/odex25_hr/attendances/models/hr_attendance_transactions.py @@ -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' diff --git a/odex25_hr/attendances/views/hr_attendance_transactions.xml b/odex25_hr/attendances/views/hr_attendance_transactions.xml index f0a46e171..97b1ae3eb 100644 --- a/odex25_hr/attendances/views/hr_attendance_transactions.xml +++ b/odex25_hr/attendances/views/hr_attendance_transactions.xml @@ -73,6 +73,11 @@ +
+ + + +
diff --git a/odex25_hr/exp_official_mission/i18n/ar_001.po b/odex25_hr/exp_official_mission/i18n/ar_001.po index 499ada76c..3ccee8274 100644 --- a/odex25_hr/exp_official_mission/i18n/ar_001.po +++ b/odex25_hr/exp_official_mission/i18n/ar_001.po @@ -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' فقط او مدير الموارد البشرية !" diff --git a/odex25_hr/exp_official_mission/models/hr_official_mission.py b/odex25_hr/exp_official_mission/models/hr_official_mission.py index f15b66dc4..bbeca7b50 100644 --- a/odex25_hr/exp_official_mission/models/hr_official_mission.py +++ b/odex25_hr/exp_official_mission/models/hr_official_mission.py @@ -483,13 +483,58 @@ class HrOfficialMission(models.Model): # self.chick_employee_ids() self.employee_ids.chick_not_overtime() self.employee_ids.compute_Training_cost_emp() - 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() diff --git a/odex25_hr/exp_official_mission/views/especially_hours.xml b/odex25_hr/exp_official_mission/views/especially_hours.xml index 6c39e7e19..f6214a923 100644 --- a/odex25_hr/exp_official_mission/views/especially_hours.xml +++ b/odex25_hr/exp_official_mission/views/especially_hours.xml @@ -27,7 +27,7 @@