Merge branch 'dev' of https://gitee.com/jinan-pengyusen-data/gzth into dev
This commit is contained in:
@@ -137,7 +137,7 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
def _compute_is_confirm(self):
|
||||
for record in self:
|
||||
record.is_confirm = False
|
||||
record.is_end = False
|
||||
record.is_end = True
|
||||
log_ids_domain = [
|
||||
('done_by', '=', self.env.user.id),
|
||||
('workflow_id', '=', record.workflow_id.id),
|
||||
|
||||
@@ -493,8 +493,6 @@ class SoongWorkflowRecord(models.Model):
|
||||
def unlink(self):
|
||||
# record_ids = self.env["soong.workflow.record"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||
for i in self:
|
||||
record_id = self.env[i.res_model].search([('id', '=', i.res_id)])
|
||||
record_id.write({'active': False})
|
||||
i.reclaim_state = True
|
||||
res = super(SoongWorkflowRecord, self).unlink()
|
||||
return res
|
||||
|
||||
@@ -32,22 +32,33 @@ class SoongWorkflowRecordDeleteWizard(models.TransientModel):
|
||||
issue_library_id = self.env["issue.library"].sudo().search([("issue_approval_id", "=", issue_id.id)], limit=1)
|
||||
if issue_library_id:
|
||||
issue_library_id.write({'issue_state': 'draft'})
|
||||
|
||||
# 如果是请假审批 需要删除hr.leave记录
|
||||
if workflow_record.res_model == "hr.leave.batch":
|
||||
log = self.env[f"{record.res_model}"].sudo().search([("id", "=", record.res_id)])
|
||||
if log.leave_ids:
|
||||
for leave in log.leave_ids:
|
||||
if leave:
|
||||
leave.action_refuse()
|
||||
leave.state = 'draft'
|
||||
leave.sudo().unlink()
|
||||
try:
|
||||
leave.action_refuse()
|
||||
leave.state = 'draft'
|
||||
leave.sudo().unlink()
|
||||
except Exception as e:
|
||||
error_msg = str(e)
|
||||
if "记录不存在或已删除" in error_msg:
|
||||
continue
|
||||
raise
|
||||
# 处理小时请假记录
|
||||
if log.hour_leave_ids:
|
||||
for hour_leave in log.hour_leave_ids:
|
||||
if hour_leave:
|
||||
hour_leave.state = 'draft'
|
||||
hour_leave.sudo().unlink()
|
||||
hour_leave.action_refuse()
|
||||
try:
|
||||
hour_leave.state = 'draft'
|
||||
hour_leave.sudo().unlink()
|
||||
hour_leave.action_refuse()
|
||||
except Exception as e:
|
||||
error_msg = str(e)
|
||||
if "记录不存在或已删除" in error_msg:
|
||||
continue
|
||||
raise
|
||||
|
||||
# 删除假期额度里面的对应的流程记录
|
||||
related_detail_models = [
|
||||
|
||||
@@ -552,31 +552,31 @@ class HolidaysRequestBatch(models.Model):
|
||||
'is_void': False,
|
||||
'text': f"请假审批"
|
||||
})
|
||||
if self.users_id.employee_ids.company_id.name == '集团本部':
|
||||
overtime_records = self.env['vacation.over.line'].search([
|
||||
('employee_id', '=', self.users_id.employee_ids.id),
|
||||
('start_time', '>=', datetime(2026, 1, 1)),
|
||||
('is_void', '=', False),
|
||||
('text', '!=', '上月继承额度'),
|
||||
], order='start_time ASC')
|
||||
|
||||
overtime_records = self.env['vacation.over.line'].search([
|
||||
('employee_id', '=', self.users_id.employee_ids.id),
|
||||
('start_time', '>=', datetime(2026, 1, 1)),
|
||||
('is_void', '=', False),
|
||||
('text', '!=', '上月继承额度'),
|
||||
], order='start_time ASC')
|
||||
remaining_deduct = hours
|
||||
for record in overtime_records:
|
||||
if remaining_deduct <= 0:
|
||||
break
|
||||
current_remaining = record.remaining_quantity
|
||||
deduct_amount = min(remaining_deduct, current_remaining)
|
||||
if remaining_deduct > current_remaining:
|
||||
carry_state = 'partial'
|
||||
else:
|
||||
carry_state = 'completed'
|
||||
|
||||
remaining_deduct = hours
|
||||
for record in overtime_records:
|
||||
if remaining_deduct <= 0:
|
||||
break
|
||||
current_remaining = record.remaining_quantity
|
||||
deduct_amount = min(remaining_deduct, current_remaining)
|
||||
if remaining_deduct > current_remaining:
|
||||
carry_state = 'partial'
|
||||
else:
|
||||
carry_state = 'completed'
|
||||
|
||||
record.write({
|
||||
'carry_forward_date': fields.Date.to_string(period_start),
|
||||
'carry_forward_quantity': deduct_amount,
|
||||
'carry_forward_state': carry_state,
|
||||
})
|
||||
remaining_deduct -= deduct_amount
|
||||
record.write({
|
||||
'carry_forward_date': fields.Date.to_string(period_start),
|
||||
'carry_forward_quantity': deduct_amount,
|
||||
'carry_forward_state': carry_state,
|
||||
})
|
||||
remaining_deduct -= deduct_amount
|
||||
|
||||
|
||||
def _create_annual_leave_line(self, period_start, leave_data, hours, period):
|
||||
|
||||
@@ -28,7 +28,7 @@ class PayCarryoverWizard(models.TransientModel):
|
||||
month = int(self.select_time)
|
||||
vacation_date = datetime(year, month, 1).date()
|
||||
reports = self.env["yuthon.vacation.reports"].search([('vacation_date', '=', vacation_date),
|
||||
('employee_id.name', '=', '易尚廉')
|
||||
('company_id.name', '=', '集团本部')
|
||||
])
|
||||
is_2025_december = (year == 2026 and month == 1)
|
||||
for rec in reports:
|
||||
@@ -55,7 +55,7 @@ class PayCarryoverWizard(models.TransientModel):
|
||||
})
|
||||
else:
|
||||
overtime_records = self.env['vacation.over.line'].search([
|
||||
('employee_id', '=', self.users_id.employee_ids.id),
|
||||
('employee_id', '=', overtime.employee_id.id),
|
||||
('start_time', '>=', datetime(2026, 1, 1)),
|
||||
('remaining_quantity', '>', 0),
|
||||
('is_void', '=', False),
|
||||
|
||||
@@ -111,7 +111,7 @@ class YuthonWillTask(http.Controller):
|
||||
|
||||
file_list = []
|
||||
pdf = ['application/pdf']
|
||||
for file in task.documents_ids:
|
||||
for file in task.document_ids:
|
||||
base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
file_url = f"http://view.officeapps.live.com/op/view.aspx?src=https://oa.thtzjt.com/web/content/office_preview/{file.id}"
|
||||
if file.mimetype in pdf:
|
||||
|
||||
Reference in New Issue
Block a user