Employees Appraisal
This commit is contained in:
parent
661cabdfe0
commit
ec6e4b3106
|
|
@ -1323,3 +1323,9 @@ msgstr "إعدادات التقييم"
|
|||
#: model:ir.cron,name:exp_hr_appraisal.ir_cron_week_appraisal
|
||||
msgid "Appraisal ;Automatic Employee Appraisal"
|
||||
msgstr "التقييم : إنشاء تقييم الموظفين تلقائيا"
|
||||
|
||||
#. module: exp_hr_appraisal
|
||||
#: code:addons/exp_hr_appraisal/models/appraisal.py:0
|
||||
#, python-format
|
||||
msgid "Only Manager of Employee \"%s\" should approve the Appraisal"
|
||||
msgstr "فقط مدير الموظف\"%s\" يستطيع إعتماد التقييم"
|
||||
|
|
|
|||
|
|
@ -234,7 +234,11 @@ class Appraisal(models.Model):
|
|||
else:
|
||||
raise exceptions.Warning(
|
||||
_('There is no contract for employee "%s" to update appraisal result ') % item.employee_id.name)
|
||||
item.state = 'state_done'
|
||||
if item.appraisal_type != 'training' and item.employee_id.parent_id.user_id != self.env.user:
|
||||
raise exceptions.Warning(
|
||||
_('Only Manager of Employee "%s" should approve the Appraisal') % item.employee_id.parent_id.user_id.name)
|
||||
else:
|
||||
item.state = 'state_done'
|
||||
|
||||
def closed(self):
|
||||
self.state = 'closed'
|
||||
|
|
|
|||
|
|
@ -761,6 +761,7 @@ msgstr ""
|
|||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.employee_especially_hours_form_view
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.employee_official_mission_form_view
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.employee_training_form_view
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_training_appraisal_wizard__employee_ids
|
||||
msgid "Employees"
|
||||
msgstr "الموظفين"
|
||||
|
||||
|
|
@ -2510,7 +2511,7 @@ msgstr "تمت الموافقة"
|
|||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.hr_employees_training_lines_form
|
||||
#, python-format
|
||||
msgid "Done"
|
||||
msgstr "تم"
|
||||
msgstr "تم الحضور"
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.hr_employees_training_lines_form
|
||||
|
|
@ -2566,6 +2567,7 @@ msgstr "إضافه"
|
|||
|
||||
#. module: exp_official_mission
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.view_employee_mission_selection_wizard_form
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.view_training_appraisal_wizard_form
|
||||
msgid "Cancel"
|
||||
msgstr "إلغاء"
|
||||
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ class HrOfficialMission(models.Model):
|
|||
|
||||
|
||||
def check_appraisal(self):
|
||||
if any(self.employee_ids.mapped('appraisal_id')):
|
||||
if all(record.appraisal_id for record in self.employee_ids):
|
||||
self.appraisal_found = True
|
||||
else:
|
||||
self.appraisal_found = False
|
||||
|
|
@ -931,6 +931,7 @@ class HrOfficialMissionEmployee(models.Model):
|
|||
_name = 'hr.official.mission.employee'
|
||||
_rec_name = 'employee_id'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'date_from desc'
|
||||
|
||||
date_from = fields.Date()
|
||||
date_to = fields.Date()
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
states="approve,refused" groups="hr.group_hr_user"
|
||||
confirm="Are you sure to Reset To Draft This Record?"/>
|
||||
<button name="action_training_appraisal" string="Training Course Appraisal" type="object" class="oe_highlight"
|
||||
icon="fa-users" attrs="{'invisible':['|',('state','!=','approve'),('appraisal_found','=',True)]}"/>
|
||||
icon="fa-users" attrs="{'invisible':['|',('state','in',('draft','refused')),('appraisal_found','=',True)]}"/>
|
||||
<field name="state" widget="statusbar"
|
||||
statusbar_visible="draft,depart_manager,hr_aaproval,approve,refused"/>
|
||||
</header>
|
||||
|
|
@ -457,6 +457,8 @@
|
|||
|
||||
<field name="date_from" readonly="1"/>
|
||||
<field name="date_to" readonly="1"/>
|
||||
<field name="appraisal_id" attrs="{'invisible':[('appraisal_id','=',False)]}"/>
|
||||
<field name="appraisal_result" attrs="{'invisible':[('appraisal_id','=',False)]}"/>
|
||||
|
||||
</group>
|
||||
<group>
|
||||
|
|
@ -495,6 +497,8 @@
|
|||
<field name="hour_from" widget="float_time"/>
|
||||
<field name="hour_to" widget="float_time"/>
|
||||
<field name="hours" widget="float_time"/>
|
||||
<field name="appraisal_id" attrs="{'invisible':[('appraisal_id','=',False)]}"/>
|
||||
<field name="appraisal_result" attrs="{'invisible':[('appraisal_id','=',False)]}"/>
|
||||
<field name="status" string="Employee Status"/>
|
||||
<field name="state" string="Status" invisible="1"/>
|
||||
<field name="attachment_count" invisible="1"/>
|
||||
|
|
|
|||
|
|
@ -10,12 +10,32 @@ class TrainingAppraisalWizard(models.TransientModel):
|
|||
_description = 'Training Appraisal Wizard'
|
||||
|
||||
appraisal_plan_id = fields.Many2one('appraisal.plan', string="Appraisal Plan", required=True)
|
||||
employee_ids = fields.Many2many(
|
||||
'hr.employee',
|
||||
string='Employees',
|
||||
required=True,
|
||||
)
|
||||
|
||||
def _get_active_employee_mission(self):
|
||||
if self.env.context.get('active_model') == 'hr.official.mission':
|
||||
mission_id = self.env.context.get('active_id')
|
||||
return mission_id
|
||||
|
||||
@api.onchange('employee_ids')
|
||||
def _onchange_employee_ids(self):
|
||||
mission = self.env['hr.official.mission'].browse(self._get_active_employee_mission())
|
||||
employee_id = []
|
||||
if mission.employee_ids:
|
||||
for line in mission.employee_ids:
|
||||
if line.employee_id:
|
||||
if line.employee_id.id in employee_id:
|
||||
employee_id.remove(line.employee_id.id)
|
||||
if line.status == 'done' and not line.appraisal_id:
|
||||
employee_id.append(line.employee_id.id)
|
||||
|
||||
return {'domain': {'employee_ids': [('id', 'in', employee_id)]}}
|
||||
|
||||
|
||||
|
||||
def create_employee_appraisal(self):
|
||||
mission = self.env['hr.official.mission'].browse(self._get_active_employee_mission())
|
||||
|
|
@ -26,7 +46,8 @@ class TrainingAppraisalWizard(models.TransientModel):
|
|||
mission = self.env['hr.official.mission'].create(mission_vals)
|
||||
|
||||
for employee in mission.employee_ids:
|
||||
vals_list = {
|
||||
if employee.employee_id in self.employee_ids:
|
||||
vals_list = {
|
||||
'employee_id': employee.employee_id.id,
|
||||
'date_from': employee.date_from,
|
||||
'date_to': employee.date_to,
|
||||
|
|
@ -36,10 +57,9 @@ class TrainingAppraisalWizard(models.TransientModel):
|
|||
'mission_id': mission.id,
|
||||
}
|
||||
|
||||
appraisal = self.env['hr.employee.appraisal'].sudo().create(vals_list)
|
||||
appraisal.fill_employee_or_manager_appraisal()
|
||||
employee.appraisal_id = appraisal.id
|
||||
|
||||
|
||||
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'}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<sheet>
|
||||
<group>
|
||||
<field name="appraisal_plan_id"/>
|
||||
<field name="employee_ids" widget="many2many_tags"/>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
|
|
|
|||
Loading…
Reference in New Issue