Merge pull request #2185 from expsa/bakry_hr3

Bakry hr3
This commit is contained in:
bakry 2025-01-22 12:44:02 +03:00 committed by GitHub
commit 89b36dc358
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 19 deletions

View File

@ -161,6 +161,7 @@ class employee_overtime_request(models.Model):
def submit(self):
if not self.line_ids_over_time:
raise exceptions.Warning(_('Sorry, Can Not Request without The Employees'))
self.line_ids_over_time.get_max_remain_hours()
self.chick_not_mission()
self.state = "submit"
@ -346,7 +347,8 @@ class HrEmployeeOverTime(models.Model):
max_hours = fields.Float(compute='get_max_remain_hours', string="Max Hours", store=True)
remaining_hours = fields.Float(compute='get_max_remain_hours', string="Remaining Hours", store=True)
exception = fields.Boolean(string="Exception", default=False)
#exception = fields.Boolean(string="Exception", default=False)
exception = fields.Boolean(related='employee_over_time_id.exception', string="Exception Hours", store=True)
overtime_plase = fields.Selection(related='employee_over_time_id.overtime_plase', store=True,
string="Overtime Plase")
state = fields.Selection(related='employee_over_time_id.state', store=True, string="State")

View File

@ -350,7 +350,7 @@ class SalaryRuleInput(models.Model):
payslip_loans.append({
'name': loan.request_type.name,
'code': loan.code,
'amount': (-l.installment_amount),
'amount': round((-l.installment_amount),2),
'date': l.installment_date,
'account_id': loan.request_type.account_id.id,
'loan_id': loan.id
@ -2172,9 +2172,9 @@ class HrPayslipLine(models.Model):
total_days_after_holiday = 30 - work_days
total_days = total_days_after_holiday
if line.salary_rule_id.special == False:
line.total = ((line.amount / 30) * total_days_after_holiday) * line.percentage / 100
line.total = round(((line.amount / 30) * total_days_after_holiday) * line.percentage / 100,2)
else:
line.total = ((line.amount) * line.percentage / 100)
line.total = round(((line.amount) * line.percentage / 100),2)
# line.total = ((line.amount / 30) * total_days_after_holiday) * line.percentage / 100
#################################################### Holidays percentage #######################################
elif wo.name == "Paid Holidays By percentage":
@ -2191,9 +2191,9 @@ class HrPayslipLine(models.Model):
per += (allow * percentage / 100)
actual_allow_tot = (line.amount / 30) * total_days_after_holiday
if line.salary_rule_id.special == False:
line.total = (actual_allow_tot + per) * line.percentage / 100
line.total = round((actual_allow_tot + per) * line.percentage / 100,2)
else:
line.total = ((line.amount) * line.percentage / 100)
line.total = round(((line.amount) * line.percentage / 100),2)
# line.total = (actual_allow_tot + per) * line.percentage / 100
##################################################### Holidays Additional ########################################
elif wo.name == "Additional Paid Holidays":
@ -2207,9 +2207,9 @@ class HrPayslipLine(models.Model):
total_days_after_holiday = 30 - work_days
total_days = total_days_after_holiday
if line.leave_request_case or line.salary_rule_id.special == True:
line.total = (line.amount) * line.percentage / 100
line.total = round((line.amount) * line.percentage / 100,2)
else:
line.total = ((line.amount / 30) * total_days_after_holiday) * line.percentage / 100
line.total = round(((line.amount / 30) * total_days_after_holiday) * line.percentage / 100,2)
################################################### Holidays Reconcile and Exclusion ###############################
elif wo.name == "Exclusion or Reconcile Paid Holidays":
work_days = wo.number_of_days
@ -2221,20 +2221,20 @@ class HrPayslipLine(models.Model):
total_days_after_holiday = 30 - work_days
total_days = total_days_after_holiday
if not line.leave_request_case or line.salary_rule_id.special == True:
line.total = (line.amount) * line.percentage / 100
line.total = round((line.amount) * line.percentage / 100,2)
else:
line.total = ((line.amount / 30) * total_days_after_holiday) * line.percentage / 100
line.total = round(((line.amount / 30) * total_days_after_holiday) * line.percentage / 100,2)
################################################### Working days for this month ######################################
else:
work_days = wo.number_of_days
total_days = work_days
if line.leave_request_case or line.salary_rule_id.special == True:
line.total = (line.amount) * line.percentage / 100
line.total = round((line.amount) * line.percentage / 100,2)
else:
line.total = ((line.amount / 30) * work_days) * line.percentage / 100
line.total = round(((line.amount / 30) * work_days) * line.percentage / 100,2)
################################################### End IF Then else #################################################
else:
line.total = (line.amount) * line.percentage / 100
line.total = round((line.amount) * line.percentage / 100,2)
#print("compute_shee_computee_total payslips_Run %s" % (time.time() - start_time))
@ -2939,8 +2939,8 @@ class HrPayslipRun(models.Model):
res.append({
'name': v[0],
'account_id': v[1],
'debit': sum(dicc['debit'] for dicc in new_items),
'credit': sum(dicc2['credit'] for dicc2 in new_items)
'debit': round(sum(dicc['debit'] for dicc in new_items),2),
'credit': round(sum(dicc2['credit'] for dicc2 in new_items),2)
})
return res
@ -3035,7 +3035,7 @@ class HrPayslipRun(models.Model):
'journal_id': journal.id,
'partner_id': line.employee_id.user_id.partner_id.id,
'account_id': journal.default_account_id.id,
'credit': total_allow - total_ded - total_loan,
'credit': round(total_allow,2) - round(total_ded,2) - round(total_loan,2),
'debit': 0,
})
if not move_vals:

View File

@ -2,6 +2,9 @@
<!-- Customize menus security -->
<odoo>
<record model="ir.ui.menu" id="exp_hr_payroll.menu_hr_payroll_root">
<field name="groups_id" eval="[(6,0,[ref('exp_hr_payroll.group_hr_payroll_user')])]"/>
<field name="groups_id" eval="[(4,ref('exp_hr_payroll.group_hr_payroll_user')),
(4,ref('hr_base.group_general_manager'))]"/>
</record>
</odoo>
</odoo>

View File

@ -8,7 +8,8 @@
<record model="ir.ui.menu" id="exp_hr_payroll.menu_department_tree">
<field name="groups_id"
eval="[(6,0,[ref('exp_payroll_custom.group_hr_payroll_contributor')]),(6,0,[ref('exp_hr_payroll.group_hr_payroll_user')])]"/>
eval="[(4,ref('exp_hr_payroll.group_hr_payroll_user')),
(4,ref('hr_base.group_general_manager'))]"/>
</record>
<record model="ir.ui.menu" id="exp_hr_payroll.menu_hr_payroll_configuration">