@@ -8,6 +8,7 @@
|
||||
<xpath expr="//field[@name='work_email']" position="after">
|
||||
<field name="user_role_id" domain="[('company_id', '=', company_id)]"/>
|
||||
<field name="user_role_ids" widget="many2many_tags" domain="[('company_id', '=', company_id)]"/>
|
||||
<field name="contract_id"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='department_id']" position="after">
|
||||
<field name="department_ids" widget="many2many_tags"/>
|
||||
|
||||
@@ -12,6 +12,7 @@ class InheritHrLeave(models.Model):
|
||||
|
||||
caption = fields.Char(string="标题", compute="_compute_application_reason")
|
||||
employee_id = fields.Many2one('hr.employee', string="发起人")
|
||||
length_leave = fields.Float(string="请假时长", compute="_compute_application_reason")
|
||||
leave_stats = fields.Char(string="请假统计", compute="_compute_leave_stats")
|
||||
is_filing = fields.Boolean(string="归档")
|
||||
application_reason = fields.Char(string="申请原因", compute="_compute_application_reason")
|
||||
@@ -42,12 +43,15 @@ class InheritHrLeave(models.Model):
|
||||
if rec.batch_id:
|
||||
rec.application_reason = rec.batch_id.text
|
||||
rec.caption = rec.batch_id.name
|
||||
rec.length_leave = rec.batch_id.days
|
||||
elif rec.hour_batch_id:
|
||||
rec.application_reason = rec.hour_batch_id.text
|
||||
rec.caption = rec.hour_batch_id.name
|
||||
rec.length_leave = rec.hour_batch_id.days
|
||||
else:
|
||||
rec.application_reason = ''
|
||||
rec.caption = ''
|
||||
rec.length_leave = 0
|
||||
|
||||
@api.depends('holiday_status_id', 'employee_id')
|
||||
def _compute_leave_stats(self):
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="holiday_status_id"/>
|
||||
<field name="date_from" groups="base.group_system"/>
|
||||
<field name="date_to"/>
|
||||
<field name="number_of_days" string="请假时长(天)"/>
|
||||
<field name="length_leave" string="请假时长(天)"/>
|
||||
<field name="leave_stats"/>
|
||||
<field name="application_reason"/>
|
||||
<field name="state"/>
|
||||
|
||||
@@ -42,5 +42,18 @@
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
<record forcecreate="True" id="update_end_comparison" model="ir.cron">
|
||||
<field name="name">定时任务:更新花名册员工颜色</field>
|
||||
<field name="model_id" ref="model_hr_employee"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.update_end_comparison()</field>
|
||||
<field eval="True" name="active"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 00:00:00')"/>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -289,6 +289,11 @@ class YuthonHrEmployee(models.Model):
|
||||
if record.contract_id.date_end <= date.today() + timedelta(days=8):
|
||||
record.is_membership = False
|
||||
|
||||
def update_end_comparison(self):
|
||||
employees = self.env['hr.employee'].search([])
|
||||
for employee in employees:
|
||||
employee._compute_end_comparison()
|
||||
|
||||
@api.depends('date_end')
|
||||
def _compute_end_comparison(self):
|
||||
for record in self:
|
||||
|
||||
@@ -87,10 +87,10 @@ class YuthonReassignmentApproval(models.Model):
|
||||
def end_approval(self):
|
||||
current_date = fields.Date.today()
|
||||
# 筛选已完成审批的记录
|
||||
reassignment_approval_ids = self.search([('work_end', '=', True),
|
||||
('is_execution', '=', False),
|
||||
])
|
||||
for record in reassignment_approval_ids:
|
||||
# reassignment_approval_ids = self.search([('work_end', '=', True),
|
||||
# ('is_execution', '=', False),
|
||||
# ])
|
||||
for record in self:
|
||||
if record.change_date <= current_date:
|
||||
employee = record.employee_id
|
||||
old_contract = employee.contract_id
|
||||
@@ -121,7 +121,7 @@ class YuthonReassignmentApproval(models.Model):
|
||||
'date_start': record.change_date,
|
||||
'date_end': False,
|
||||
'resource_calendar_id': old_contract.resource_calendar_id.id,
|
||||
'structure_type_id': old_contract.structure_type_id.id,
|
||||
# 'structure_type_id': old_contract.structure_type_id.id,
|
||||
'department_id': old_contract.department_id.id,
|
||||
'job_id': old_contract.job_id.id,
|
||||
'termination_date': old_contract.termination_date,
|
||||
@@ -134,18 +134,17 @@ class YuthonReassignmentApproval(models.Model):
|
||||
if record.change_job_id:
|
||||
new_contract_vals['job_id'] = record.change_job_id.id
|
||||
if record.change_structure_id:
|
||||
new_contract_vals[ 'structure_type_id'] = record.change_structure_id.id
|
||||
new_contract_vals[ 'structure_type_id'] = record.change_structure_id.type_id.id
|
||||
if record.change_department_id:
|
||||
new_contract_vals['department_id'] = record.change_department_id.id
|
||||
new_contract = self.env['hr.contract'].create(new_contract_vals)
|
||||
old_contract.write({
|
||||
'state': 'cancel',
|
||||
'date_end': record.change_date - timedelta(days=1),
|
||||
})
|
||||
new_contract = self.env['hr.contract'].create(new_contract_vals)
|
||||
employee.contract_id = new_contract.id
|
||||
record.is_execution = True
|
||||
|
||||
|
||||
class HrJobType(models.Model):
|
||||
_name = "hr.job.type"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user