Merge pull request #2478 from expsa/Esraa-Ensan-hr-tasks

Esraa ensan hr tasks
This commit is contained in:
Esraa-Exp 2025-02-25 05:53:17 +02:00 committed by GitHub
commit 34352081dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 38 deletions

View File

@ -189,18 +189,17 @@ class HrOfficialMission(models.Model):
rec.appraisal_count = 0
employee_ids = rec.employee_ids.mapped('employee_id')
training = rec.env['hr.employee.appraisal'].search(
[('employee_id', 'in', employee_ids.ids), ('state', '=', 'state_done'),('mission_id', '=', rec.id)])
[('employee_id', 'in', employee_ids.ids), ('mission_id', '=', rec.id)])
rec.appraisal_count = len(training)
def action_employees_appraisal(self):
employee_ids = self.employee_ids.mapped('employee_id')
training = self.env['hr.employee.appraisal'].search(
[('employee_id', 'in', employee_ids.ids), ('state', '=', 'state_done'), ('mission_id', '=', self.id)])
print(training,"training>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.")
[('employee_id', 'in', employee_ids.ids), ('mission_id', '=', self.id)])
return {
'name': (_("Employees Appraisal")),
'view_mode': 'tree',
'view_mode': 'tree,form',
'view_id': False,
'res_model': 'hr.employee.appraisal',
'type': 'ir.actions.act_window',

View File

@ -207,32 +207,7 @@
</tree>
<form string="Employee Training Course Day">
<header>
<button name="approve" string="Approve" class="oe_highlight" type="object"
attrs="{'invisible':[('status','!=','draft')]}"
groups="hr_base.group_division_manager"/>
<button name="refuse" string="Refuse" class="oe_highlight" type="object"
attrs="{'invisible':[('status','!=','draft')]}"
groups="hr_base.group_division_manager"/>
<button name="done" string="Done" class="oe_highlight" type="object"
attrs="{'invisible':[('status','!=','approved')]}"/>
<button name="set_to_draft" string="Set to Draft" class="oe_highlight"
type="object"
attrs="{'invisible':[('status','not in', ('done','refused'))]}"/>
<field name="status" widget="statusbar"
statusbar_visible="draft,approved,approved2,done,refused"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_get_attachment_view" class="oe_stat_button"
icon="fa-file-text-o"
type="object">
<field name="attachment_count" widget="statinfo"
string="Attachments"
options="{'reload_on_button': true}"/>
</button>
</div>
<group col="4">
<field name="employee_id" string="Employee" required="1"/>
<field name="date_from" string="Date from"/>

View File

@ -39,6 +39,7 @@ class TrainingAppraisalWizard(models.TransientModel):
appraisal = self.env['hr.employee.appraisal'].sudo().create(vals_list)
appraisal.fill_employee_or_manager_appraisal()
employee.appraisal_id = appraisal.id
return {'type': 'ir.actions.act_window_close'}

View File

@ -17,9 +17,9 @@ class HrOfficialMission(models.Model):
# check if there is dealing with financial
if self.mission_type.work_state == 'training':
if self.Training_cost > 0.0:
self.employee_ids.chick_not_overtime()
self.employee_ids.chick_not_overtime()
if self.Training_cost > 0.0:
if not self.mission_type.pr_product_id.id:
raise ValidationError(_("You must Enter Purchase Product in Training Type Configuration"))
@ -41,13 +41,13 @@ class HrOfficialMission(models.Model):
})
self.purchase_request_id = purchase_request.id
self.state = "approve"
if self.mission_type.work_state and self.mission_type.duration_type == 'days':
for emp in self.employee_ids:
if emp.date_to >= fields.Date.today() >= emp.date_from:
emp.employee_id.write(
{'work_state': self.mission_type.work_state, 'active_mission_id': emp.id})
self.call_cron_function()
self.state = "approve"
if self.mission_type.work_state and self.mission_type.duration_type == 'days':
for emp in self.employee_ids:
if emp.date_to >= fields.Date.today() >= emp.date_from:
emp.employee_id.write(
{'work_state': self.mission_type.work_state, 'active_mission_id': emp.id})
self.call_cron_function()
else:
res = super(HrOfficialMission, self).approve()