!5103 添加功能

Merge pull request !5103 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-09-13 07:32:52 +00:00
committed by Gitee
13 changed files with 78 additions and 64 deletions
@@ -11,7 +11,7 @@ _logger = logging.getLogger(__name__)
class SoongWorkflowRecord(models.Model):
_name = "soong.workflow.record"
_description = "工作流记录"
_order = 'write_date2'
_order = 'write_date2 desc'
_rec_name = 'code'
def get_no_read_count(self):
@@ -494,35 +494,54 @@ class SoongWorkflowCommentWizard(models.TransientModel):
if self.node_btn_name == '结束':
current_user = self.env.user
current_datetime = fields.Datetime.now()
log_records = record_id.log_ids
if record_id.log_ids2:
log_records = record_id.log_ids2
elif record_id.log_ids:
is_admin = current_user.has_group('soong_workflow.group_soong_workflow_manager')
if is_admin:
record_id.log_ids[-1].comment = self.comment
record_id.log_ids[-1].approval_state = "3"
record_id.log_ids[-1].lase_click_date = fields.Datetime.now()
record_id.work_end = True
self.env['soong.workflow.record'].search([('code', '=', record_id.code)]).write({'approve_state': 'end',
"employee_ids": False,
"node_id": False, })
else:
log_records = record_id.log_ids
if record_id.log_ids2:
log_records = record_id.log_ids2
elif record_id.log_ids:
log_records = record_id.log_ids
if log_records:
# 查找当前用户的日志记录并更新
user_log = log_records.filtered(lambda log: log.done_by == current_user)
if user_log:
user_log.write({
'comment': self.comment,
'approval_state': "3",
'lase_click_date': current_datetime
})
last_log = log_records[-1] if log_records else None
if last_log:
same_name_logs = log_records.filtered(
lambda log: log.name == last_log.name
and log.node_btn_name == '4'
and log.id != last_log.id
)
if log_records:
# 查找当前用户的日志记录并更新
user_log = log_records.filtered(lambda log: log.done_by == current_user)
if user_log:
user_log.write({
'comment': self.comment,
'approval_state': "3",
'lase_click_date': current_datetime
})
last_log = log_records[-1] if log_records else None
if last_log:
same_name_logs = log_records.filtered(
lambda log: log.name == last_log.name
and log.node_btn_name == '4'
and log.id != last_log.id
)
# 判断是否需要更新工作流状态
if same_name_logs:
all_approved = all(log.approval_state == '3' for log in same_name_logs)
all_approved = all_approved and (last_log.approval_state == '3')
if all_approved:
# 所有符合条件的记录都已批准,更新工作流状态
# 判断是否需要更新工作流状态
if same_name_logs:
all_approved = all(log.approval_state == '3' for log in same_name_logs)
all_approved = all_approved and (last_log.approval_state == '3')
if all_approved:
# 所有符合条件的记录都已批准,更新工作流状态
self.env['soong.workflow.record'].search([
('code', '=', record_id.code)
]).write({
'approve_state': 'end',
'employee_ids': False,
'node_id': False,
})
record_id.work_end = True
else:
self.env['soong.workflow.record'].search([
('code', '=', record_id.code)
]).write({
@@ -531,15 +550,6 @@ class SoongWorkflowCommentWizard(models.TransientModel):
'node_id': False,
})
record_id.work_end = True
else:
self.env['soong.workflow.record'].search([
('code', '=', record_id.code)
]).write({
'approve_state': 'end',
'employee_ids': False,
'node_id': False,
})
record_id.work_end = True
# 给申请人发消息
biz_record = self.env[self.res_model].browse(self.res_id)
@@ -1035,6 +1035,7 @@ class HrAttendance(models.Model):
record.shift_name = ''
else:
record.shift_name = '行政班次'
self._update_vacation_report(record)
return record
@@ -252,6 +252,7 @@ class HrAttendanceDetail(models.Model):
attendance.write({
'check_in': check_in_time,
'check_out': check_out_time,
'shift_id': planning_slots.id,
'is_early_card': is_early_card,
'is_late_card': is_late_card,
'is_abnormal': is_abnormal,
@@ -262,6 +263,7 @@ class HrAttendanceDetail(models.Model):
else:
self.env['hr.attendance'].create({
'employee_id': employee.id,
'shift_id': planning_slots.id,
'current_data': current_data,
'check_in': check_in_time,
'check_out': check_out_time,
@@ -105,7 +105,7 @@ class HrAttendanceMonthDetail(models.Model):
actual_attendance_days = fields.Integer(string="实际出勤天数")
compensatory_leave = fields.Integer(string="调休")
leave_of_absence = fields.Integer(string="事假", digits=(16, 3))
statutory_leave = fields.Integer(string="加班时(法定假)")
statutory_leave = fields.Integer(string="加班时(法定)")
work_overtime = fields.Integer(string="加班")
entry_date = fields.Date(related='employee_id.entry_date', string="入职日期")
expected_date = fields.Date(string="离职日期")
@@ -88,8 +88,9 @@
<field name="duration"/>
<field name="employee_ids" widget="many2many_tags" options="{'no_create': True}"/>
<field name="department_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="overtime_hours" readonly="1"/>
<field name="meal" required="1"/>
<field name="meal" required="1" invisible="company_id.name == '天河物管'"/>
</group>
<group/>
</group>
@@ -19,6 +19,7 @@
<field name="actual_attendance" options='{ "fg_color": "white: actual_attendance == False"}'/>
<field name="right_days" options='{ "fg_color": "white: right_days == False"}'/>
<field name="internship_days" options='{ "fg_color": "white: internship_days == False"}'/>
<field name="test_days" options='{ "fg_color": "white: test_days == False"}'/>
<field name="done_leave" options='{ "fg_color": "white: done_leave == False"}'/>
<field name="done_working_overtime" options='{ "fg_color": "white: done_working_overtime == False"}'/>
<field name="meal_fee" options='{ "fg_color": "white: meal_fee == False"}'/>
@@ -90,7 +91,7 @@
<field name="vacation_state" widget="badge" decoration-info="vacation_state == 'unconfirmed'"
decoration-success="vacation_state == 'confirmed'"/>
<button name="log" type="object" string="详情" class="oe_highlight"/>
<button name="confirm_state" type="object" string="确认" class="oe_highlight"/>
<button name="confirm_state" type="object" string="确认" class="oe_highlight" invisible="vacation_state == 'confirmed'"/>
</tree>
</field>
</record>
@@ -418,7 +419,7 @@
</field>
</record>
<record id="view_yuthon_vacation_reports_action" model="ir.actions.act_window">
<field name="name">假期额度日志</field>
<field name="name">考勤确认单台账</field>
<field name="res_model">yuthon.vacation.reports</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_group_by_employee_id': 1, 'search_default_group_by_vacation_year': True, 'search_default_group_by_vacation_month': True}</field>
+14 -11
View File
@@ -40,20 +40,23 @@ class IssueApproval(models.Model):
def _check_issue_approval_ids(self):
for rec in self:
if rec.issue_approval_ids:
# 处理 issue_library_id.name(假设为字符串,无需转换)
issue_names = [issue_library.issue_library_id.name for issue_library in rec.issue_approval_ids]
# 处理 approval_decision_sequence,确保转换为字符串
issue_names = []
for issue_library in rec.issue_approval_ids:
name_val = issue_library.issue_library_id.name or ""
issue_names.append(str(name_val))
decision_sequences = []
for issue_library in rec.issue_approval_ids:
# 假设 approval_decision_sequence 是布尔类型,转换为 '是'/‘否’ 或直接转字符串
if isinstance(issue_library.approval_decision_sequence, bool):
decision_sequences.append('是' if issue_library.approval_decision_sequence else '否')
seq_val = issue_library.approval_decision_sequence
if isinstance(seq_val, bool):
decision_sequences.append("是" if seq_val else "否")
else:
# 其他类型(如整数、浮点数)直接转字符串
decision_sequences.append(str(issue_library.approval_decision_sequence))
# 拼接字符串
rec.issue_display = '\n'.join(issue_names)
rec.decision_display = '\n'.join(decision_sequences)
decision_sequences.append(str(seq_val or ""))
rec.issue_display = "\n".join(issue_names)
rec.decision_display = "\n".join(decision_sequences)
else:
rec.issue_display = ""
class IssueApprovalLine(models.Model):
_name = 'issue.approval.line'
+2 -4
View File
@@ -7,8 +7,8 @@
<tree string="议题审批">
<field name="name"/>
<field name="department_id"/>
<field name="issue_display" widget="json_template"/>
<field name="decision_display" widget="json_template"/>
<field name="issue_display"/>
<field name="decision_display"/>
</tree>
</field>
</record>
@@ -53,8 +53,6 @@
<field name="job_id" invisible="1"/>
</group>
<group>
<field name="issue_display" widget="json_template" invisible="1"/>
<field name="decision_display" widget="json_template" invisible="1"/>
<field name="is_parent_unit" invisible="1"/>
</group>
<notebook>
+2 -4
View File
@@ -201,10 +201,8 @@ class YuthonProperty(models.Model):
property_ids = self.env["yuthon.property"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for rec in property_ids:
if rec.manage_information_ids:
precinct_id = self.env['yuthon.precinct.message'].search([('employee_id', '=', rec.admin_id.employee_ids.id)])
rec.manage_information_ids[-1].precinct_id = precinct_id.id
rec.manage_information_ids[-1].admin_id = rec.manage_information_ids[-1].precinct_id.employee_id.user_id
rec._compute_information_fields()
def put_declare_approval(self):
property_ids = self.env["yuthon.property"].browse(
@@ -474,7 +474,7 @@
<field name="groups_id" eval="[(6, 0, [ref('group_yuthon_property_manager')])]"/>
</record>
<record id="all_update_precinct" model="ir.actions.server">
<field name="name">更新片区</field>
<field name="name">更新管理信息</field>
<field name="model_id" ref="yuthon_property.model_yuthon_property"/>
<field name="binding_model_id" ref="yuthon_property.model_yuthon_property"/>
<field name="state">code</field>
@@ -178,8 +178,7 @@ class PropertyRentalWizard(models.Model):
start_year_month = start_date_adj.strftime('%Y-%m')
end_year_month = rent_id.end_data.strftime('%Y-%m')
start_day = start_date_adj.day
# 通过period_month 来判断是否有免租期,则使用 ,否则月租金使用 期间租金
rent_amount = rent_id.monthly_amount if period_month else rent_id.period_rent
rent_amount = rent_id.monthly_amount
if is_year:
if rent_id.month_number >12:
multiplier = rent_id.month_number - 12
@@ -212,7 +211,8 @@ class PropertyRentalWizard(models.Model):
last_day = (first_day + relativedelta(months=1, days=-1)) # 当月最后一天
records = self.env['property.lease.contract'].search([
('actual_start_time', '<=', last_day),
('actual_end_time', '>=', first_day)
('actual_end_time', '>=', first_day),
('contract_code', '=', 'TX2024-A026')
])
for record in records:
date_data = {
+1 -1
View File
@@ -160,7 +160,7 @@
<!-- action="hr_holidays.hr_leave_allocation_action_my"-->
<!-- sequence="13"/>-->
<menuitem id="holiday_yuthon_vacation_reports_board"
name="假期额度记录"
name="考勤确认单台账"
parent="hr_attendance_root_board_menu"
action="yuthon_hr_attendance.view_yuthon_vacation_reports_action"
sequence="14"/>