add ne tab on hr.official.mission ,tran
This commit is contained in:
parent
6a19fb1a76
commit
1e52369fbc
|
|
@ -678,6 +678,14 @@ msgstr "المدة بالايــام"
|
|||
msgid "Duration Hours"
|
||||
msgstr "المدة بالساعات"
|
||||
|
||||
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: 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_training_form_view
|
||||
msgid "Total Hours"
|
||||
msgstr "مجموع الساعات"
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission__duration_type
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission_type__duration_type
|
||||
|
|
@ -2597,6 +2605,28 @@ msgstr "المدرب"
|
|||
msgid "Training Details"
|
||||
msgstr "تفاصيل الدورة التدريبية"
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission__training_details
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission_employee__training_details
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.employee_training_form_view
|
||||
msgid "Training Table"
|
||||
msgstr "جدول الدورة"
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission__training_details
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission_employee__training_details
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.employee_training_form_view
|
||||
msgid "Description"
|
||||
msgstr "وصف"
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission__training_details
|
||||
#: model:ir.model.fields,field_description:exp_official_mission.field_hr_official_mission_employee__training_details
|
||||
#: model_terms:ir.ui.view,arch_db:exp_official_mission.employee_training_form_view
|
||||
msgid "Trainer"
|
||||
msgstr "المدرب"
|
||||
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: code:addons/exp_official_mission/models/hr_official_mission.py:0
|
||||
#: model:ir.actions.act_window,name:exp_official_mission.action_training_appraisal_wizard
|
||||
|
|
@ -2681,6 +2711,13 @@ msgstr "اقصى ايام للسنة"
|
|||
msgid "Sorry The Employee %s, The Number of Requests Cannot Exceed %s Maximum Days Per year."
|
||||
msgstr "للأسف الموظف %s, لايمكن تجاوز عدد ايام الطلبات %s يوم وهي اقصى أيام للإنتدابات بالسنة."
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: code:addons/exp_official_mission/models/hr_official_mission.py:0
|
||||
#, python-format
|
||||
msgid "The mission date %(date)s must be between destination's date from %(date_from)s and date to %(date_to)s."
|
||||
msgstr "يجب أن يكون تاريخ المهمة %(date)s بين تاريخ البداية %(date_from)s وتاريخ النهاية %(date_to)s للوجهة."
|
||||
|
||||
|
||||
#. module: exp_official_mission
|
||||
#: code:addons/exp_official_mission/models/hr_official_mission.py:0
|
||||
#, python-format
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class HrOfficialMission(models.Model):
|
|||
hour_to = fields.Float(default=16)
|
||||
date_duration = fields.Float()
|
||||
hour_duration = fields.Float(default=8)
|
||||
total_hours = fields.Float()
|
||||
balance = fields.Float()
|
||||
early_exit = fields.Boolean()
|
||||
mission_purpose = fields.Text()
|
||||
|
|
@ -43,6 +44,8 @@ class HrOfficialMission(models.Model):
|
|||
department_id = fields.Many2many('hr.department')
|
||||
attach_ids = fields.One2many('ir.attachment', 'mission_id')
|
||||
employee_ids = fields.One2many('hr.official.mission.employee', 'official_mission_id')
|
||||
table_ids = fields.One2many('mission.table', 'destination_id',)
|
||||
|
||||
approved_by = fields.Many2one(comodel_name='res.users')
|
||||
refused_by = fields.Many2one(comodel_name='res.users')
|
||||
mission_type = fields.Many2one('hr.official.mission.type', tracking=True)
|
||||
|
|
@ -99,6 +102,12 @@ class HrOfficialMission(models.Model):
|
|||
appraisal_count = fields.Integer(string="Appraisals", compute="get_employees_appraisal")
|
||||
hr_nomination = fields.Boolean(string="HR Nomination")
|
||||
|
||||
@api.onchange('hour_duration', 'date_duration')
|
||||
def compute_number_of_hours(self):
|
||||
for item in self:
|
||||
|
||||
item.total_hours = item.hour_duration * item.date_duration
|
||||
|
||||
|
||||
|
||||
'''@api.constrains('employee_ids')
|
||||
|
|
@ -252,7 +261,7 @@ class HrOfficialMission(models.Model):
|
|||
raise exceptions.Warning(
|
||||
_('Employee %s, The course does not follow the career record') % emp.employee_id.name)
|
||||
|
||||
@api.onchange('date_from', 'date_to', 'hour_to', 'hour_from', 'mission_type', 'state')
|
||||
@api.onchange('date_from', 'date_to', 'hour_to', 'hour_from', 'mission_type', 'state','table_ids')
|
||||
def _get_mission_no(self):
|
||||
for item in self:
|
||||
|
||||
|
|
@ -266,8 +275,12 @@ class HrOfficialMission(models.Model):
|
|||
end_mission_date = datetime.strptime(str(item.date_to), "%Y-%m-%d")
|
||||
|
||||
if end_mission_date >= start_mission_date:
|
||||
days = (end_mission_date - start_mission_date).days
|
||||
item.date_duration = days + 1
|
||||
if not item.table_ids:
|
||||
days = (end_mission_date - start_mission_date).days
|
||||
item.date_duration = days + 1
|
||||
else:
|
||||
unique_dates = set(item.table_ids.mapped('date'))
|
||||
item.date_duration = len(unique_dates)
|
||||
else:
|
||||
# item.duration = 0.0
|
||||
raise exceptions.Warning(_('Date Form Must Be Less than Date To'))
|
||||
|
|
@ -1630,3 +1643,33 @@ class HrContract(models.Model):
|
|||
status = 'work'
|
||||
active_mission_id = False
|
||||
emp_rec.write({'work_state': status, 'active_mission_id': active_mission_id})
|
||||
|
||||
|
||||
|
||||
|
||||
class MissionTable(models.Model):
|
||||
_name = 'mission.table'
|
||||
_rec_name = 'description'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
|
||||
description = fields.Char(translate=True,string='Description')
|
||||
|
||||
date = fields.Date()
|
||||
|
||||
hour_from = fields.Float(default=8)
|
||||
hour_to = fields.Float(default=16)
|
||||
trainer_id = fields.Many2one('res.partner', string="Trainer")
|
||||
destination_id = fields.Many2one('hr.official.mission', string="Destination ")
|
||||
|
||||
@api.constrains('date', 'destination_id')
|
||||
def _check_date_within_destination(self):
|
||||
for rec in self:
|
||||
if rec.destination_id and rec.date:
|
||||
date_from = rec.destination_id.date_from
|
||||
date_to = rec.destination_id.date_to
|
||||
if date_from and date_to:
|
||||
if not (date_from <= rec.date <= date_to):
|
||||
raise exceptions.ValidationError(
|
||||
_("The mission date %(date)s must be between destination's date from %(date_from)s and date to %(date_to)s.",
|
||||
date=rec.date, date_from=date_from, date_to=date_to)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,3 +14,5 @@ access_employee_mission_selection_wizard,employee.mission.selection.wizard,model
|
|||
access_training_appraisal_wizard,training_appraisal_wizard,model_training_appraisal_wizard,base.group_user,1,1,1,1
|
||||
access_hr_mission_type_account_hr_user,access_hr_mission_type_account,model_hr_mission_type_account,hr.group_hr_user,1,1,1,1
|
||||
access_hr_mission_type_account_emp,access_hr_mission_type_account,model_hr_mission_type_account,base.group_user,1,0,0,0
|
||||
|
||||
access_mission_table,access_mission_table,model_mission_table,base.group_user,1,1,1,1
|
||||
|
|
|
|||
|
|
|
@ -97,6 +97,9 @@
|
|||
<field name="date_duration" string="Duration Days" readonly="1" force_save="1"
|
||||
attrs="{'required':[('duration_type','=','days')]}"/>
|
||||
|
||||
<field name="total_hours" string="Total Hours" readonly="1" force_save="1"
|
||||
/>
|
||||
|
||||
</group>
|
||||
<group>
|
||||
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
|
||||
|
|
@ -225,7 +228,7 @@
|
|||
<field name="hour_to" string="Hour to" widget="float_time"
|
||||
/>
|
||||
<field name="hours" string="Hours" readonly="0" widget="float_time"/>
|
||||
<field name="total_hours" string="Total Hours" readonly="0"
|
||||
<field name="total_hours" string="Total Hours" readonly="1"
|
||||
widget="float_time"/>
|
||||
|
||||
<field name="hour_price" string="Hour price"
|
||||
|
|
@ -304,6 +307,23 @@
|
|||
|
||||
</page>
|
||||
|
||||
|
||||
|
||||
<page string="Training Table">
|
||||
<field name="table_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="description" string="Description" />
|
||||
<field name="date" string="Date Request"/>
|
||||
<field name="hour_from" string="Hour from"
|
||||
/>
|
||||
<field name="hour_to" string="Hour to"
|
||||
/>
|
||||
<field name="trainer_id" string="Trainer" readonly="0"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
</page>
|
||||
|
||||
<page string="Attachments" name="attachments" invisible="1">
|
||||
<field name="attach_ids" string="Attachments"
|
||||
attrs="{'readonly':[('state','!=','draft')]}">
|
||||
|
|
@ -350,6 +370,8 @@
|
|||
<field name="train_category" string="Category"/>
|
||||
<field name="date_from" string="Date From"/>
|
||||
<field name="date_to" string="Date To"/>
|
||||
<field name="total_hours" string="Total Hours" />
|
||||
|
||||
<field name="destination" string="Destination"/>
|
||||
<field name="attachment_count" invisible="1"/>
|
||||
<button name="action_get_attachment_view" string="Attachments" type="object" icon="fa-paperclip"
|
||||
|
|
|
|||
Loading…
Reference in New Issue