From 18d5d973948bf806841a0f47274258b39af37232 Mon Sep 17 00:00:00 2001
From: ljmwkx <1340053001@qq.com>
Date: Sat, 4 Jan 2025 18:42:30 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=8F=90=E4=BA=A4?=
=?UTF-8?q?=E4=B8=80=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
soong_workflow/models/soong_workflow_log.py | 7 +++++-
soong_workflow/models/soong_workflow_mixin.py | 7 +++---
.../templates/soong_workflow_templates.xml | 1 +
.../wizard/soong_workflow_comment_wizard.py | 25 +++++++++++++++++++
4 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/soong_workflow/models/soong_workflow_log.py b/soong_workflow/models/soong_workflow_log.py
index 1e96d2df2..a01265233 100644
--- a/soong_workflow/models/soong_workflow_log.py
+++ b/soong_workflow/models/soong_workflow_log.py
@@ -16,7 +16,7 @@ class SoongWorkflowLog(models.Model):
"unique(model, res_id, node_btn_id)",
_("Workflow log must be unique."),), ]
- name = fields.Char(string="节点名称", compute="_compute_name")
+ name = fields.Char(string="节点名称", compute="_compute_name", store=True)
model = fields.Char(string="Related Document Model", index=True, required=True)
res_id = fields.Integer(string="Related Document ID", index=True, required=True)
@@ -30,6 +30,11 @@ class SoongWorkflowLog(models.Model):
done_by = fields.Many2one(comodel_name="res.users", string="审批人")
lase_click_date = fields.Datetime(string="操作时间")
+ approval_state = fields.Selection([
+ ('0', '未审批'),
+ ('1', '审批中'),
+ ('2', '审批通过'),
+ ], string='审批状态', default='0')
comment = fields.Char(string="意见")
@api.depends("workflow_id", "node_id", "node_btn_id")
diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py
index 9968db23b..407fff7eb 100644
--- a/soong_workflow/models/soong_workflow_mixin.py
+++ b/soong_workflow/models/soong_workflow_mixin.py
@@ -155,7 +155,7 @@ class SoongWorkflowMixin(models.AbstractModel):
("res_id", "=", self.id),
("node_id", "=", btn_rec.node_id.id),
("workflow_id", "=", btn_rec.workflow_id.id),
- ("node_btn_id", "=", btn_rec.id),
+ # ("node_btn_id", "=", btn_rec.id),
]
)
if not record_obj:
@@ -165,12 +165,12 @@ class SoongWorkflowMixin(models.AbstractModel):
"res_id": self.id,
"node_id": btn_rec.node_id.id,
"workflow_id": btn_rec.workflow_id.id,
- "node_btn_id": btn_rec.id,
+ # "node_btn_id": btn_rec.id,
"done_by": self.env.uid,
"lase_click_date": fields.Datetime.now(),
}
)
- record_obj.update({"done_by": self.env.uid, "lase_click_date": fields.Datetime.now()})
+ record_obj.update({"node_btn_id": btn_rec.id, "done_by": self.env.uid, "approval_state": "2", "lase_click_date": fields.Datetime.now()})
return record_obj
def btn_exec_action(self):
@@ -648,6 +648,7 @@ class SoongWorkflowMixin(models.AbstractModel):
state_el = etree.Element("field")
state_el.set("name", "state")
state_el.set("widget", "statusbar")
+ state_el.set("invisible", "1")
# Loop all nodes
for node in wkf_rec.node_ids:
# Read Visible States
diff --git a/soong_workflow/templates/soong_workflow_templates.xml b/soong_workflow/templates/soong_workflow_templates.xml
index fcaba63a2..ebedb1731 100644
--- a/soong_workflow/templates/soong_workflow_templates.xml
+++ b/soong_workflow/templates/soong_workflow_templates.xml
@@ -9,6 +9,7 @@
+
diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py
index fb1c23f4b..c05f0ae2d 100644
--- a/soong_workflow/wizard/soong_workflow_comment_wizard.py
+++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py
@@ -145,6 +145,31 @@ class SoongWorkflowCommentWizard(models.TransientModel):
fields.Datetime.now() + timedelta(
hours=8)),
url=url, btntxt="查看详情")
+ # 转交创建记录
+ log_obj = self.env["soong.workflow.log"]
+ next_node_id = record_id.workflow_id.node_ids.search(
+ [('name', '=', self.trans_link_id.name), ('workflow_id', '=', record_id.workflow_id.id)])
+ record_obj = log_obj.search(
+ [
+ ("model", "=", self.res_model),
+ ("res_id", "=", self.res_id),
+ ("node_id", "=", next_node_id.id),
+ ("workflow_id", "=", record_id.workflow_id.id),
+ # ("node_btn_id", "=", record_id.node_btn_id.id),
+ ]
+ )
+ if not record_obj:
+ record_obj = log_obj.create(
+ {
+ "model": self.res_model,
+ "res_id": self.res_id,
+ "node_id": next_node_id.id,
+ "workflow_id": self.node_btn_id.workflow_id.id,
+ # "node_btn_id": self.node_btn_id.id,
+ # "lase_click_date": fields.Datetime.now(),
+ }
+ )
+ record_obj.update({"approval_state": "1"})
# partner_ids = self.employee_ids.user_id.partner_id.ids
# self.with_context(lang=self.env.lang)._message_auto_subscribe_notify(partner_ids, 'soong_workflow.message_soong_workflow_distribute')
return self.node_btn_id.with_context(cx).run()
From b6ee61d410420dfc262c73beb19bcfeab8f33b09 Mon Sep 17 00:00:00 2001
From: ljmwkx <1340053001@qq.com>
Date: Sun, 5 Jan 2025 15:00:49 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=20=E9=9C=80=E8=A6=81?=
=?UTF-8?q?=E4=BB=80=E4=B9=88=E5=8A=A0=E4=BB=80=E4=B9=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../models/hr_attendance_month.py | 80 ++++++++-----------
.../views/hr_attendance_month_views.xml | 17 ++--
.../views/hr_attendance_portal_templates.xml | 22 ++---
3 files changed, 47 insertions(+), 72 deletions(-)
diff --git a/yuthon_hr_attendance/models/hr_attendance_month.py b/yuthon_hr_attendance/models/hr_attendance_month.py
index d8a6d295c..f37f98cfa 100644
--- a/yuthon_hr_attendance/models/hr_attendance_month.py
+++ b/yuthon_hr_attendance/models/hr_attendance_month.py
@@ -91,18 +91,23 @@ class HrAttendanceMonthDetail(models.Model):
('11', '11月份'),
('12', '12月份')
], string="考勤月份")
- # todo 需要什么字段往上加什么
required_attendance_days = fields.Float(string="应出勤天数")
actual_attendance_days = fields.Float(string="实际出勤天数")
compensatory_leave = fields.Float(string="调休(小时)")
leave_of_absence = fields.Float(string="事假(小时)")
leave_of_sick = fields.Float(string="病假(天)")
- come_late = fields.Float(string="迟到(次)")
- work_overtime = fields.Float(string="加班(小时)")
statutory_leave = fields.Float(string="法定假(天)")
+ work_overtime = fields.Float(string="加班(小时)")
+ # todo 需要什么字段往上加什么
+ # 打卡
+ come_late = fields.Float(string="迟到(次)")
+ is_early_card = fields.Float(string="早退(次)")
+ is_no_card = fields.Float(string="缺卡(次)")
+ # 假期
+ unpaid_leave = fields.Float(string="无薪假(小时)")
+
note = fields.Char(string='备注')
-
hr_attendance_month_id = fields.Many2one('hr.attendance.month', string="出勤月度汇总", ondelete="cascade", readonly=True)
company_id = fields.Many2one(related="hr_attendance_month_id.company_id")
signature = fields.Image(string="签名", copy=False, attachment=True, max_width=1024, max_height=1024)
@@ -220,19 +225,24 @@ class HrAttendanceMonthDetail(models.Model):
"""
self.ensure_one()
days = calendar.monthrange(int(self.current_year), int(self.current_month))[1]
- come_late = 0
+ is_late_card = 0
+ is_early_card = 0
+ is_no_card = 0
for n in range(days):
# 根据出勤时间判断是否打卡
current_date = datetime.date(int(self.current_year), int(self.current_month), n + 1)
attendance_obj = self.env["hr.attendance"].sudo().search([('employee_id', '=', employee.id), ("current_data", '=', current_date)])
- is_come_late = False
for obj in attendance_obj:
- if obj.is_come_late():
- # 当天有打卡记录说明已经出勤
- is_come_late = True
- if is_come_late is True:
- come_late += 1
- return come_late
+ # 迟到
+ if obj.is_late_card:
+ is_late_card += 1
+ # 早退
+ if obj.is_early_card:
+ is_early_card += 1
+ # 缺卡
+ if obj.is_no_card:
+ is_no_card += 1
+ return is_late_card, is_early_card, is_no_card
def _hr_attendance_month_detail_action(self):
"""
@@ -294,7 +304,7 @@ class HrAttendanceMonthDetail(models.Model):
('date_to', '>=', date_start)
]
if type_list:
- domain.append(('holiday_status_id.holiday_type', 'in', type_list))
+ domain.append(('holiday_status_id.name', 'in', type_list))
hr_leaves = self.env['hr.leave'].sudo().search(domain)
hours = 0.0
days = 0.0
@@ -316,41 +326,21 @@ class HrAttendanceMonthDetail(models.Model):
# 排班的进行统计
if self.employee_id.default_planning_role_id:
# todo 需要什么字段往上加什么
- # # 应出勤天数
- # required_attendance_days = self._get_planning_required_attendance_days(self.employee_id)
- # self.required_attendance_days = required_attendance_days
- # # 实际出勤天数
- # actual_attendance_days = self._get_actual_attendance_days(self.employee_id)
- # self.actual_attendance_days = actual_attendance_days
- # 迟到(次):上班时间 < 上班打卡时间
- come_late = self._get_come_late(self.employee_id)
- self.come_late = come_late
+ # 迟到, 早退, 缺卡
+ self.come_late, self.is_early_card, self.is_no_card = self._get_come_late(self.employee_id)
+ # 无薪假:hr.leave表
+ days, hours = self._get_hr_leave_type(self.employee_id, ['无薪假'])
+ self.unpaid_leave = hours
+
# 行政的进行统计
if not self.employee_id.default_planning_role_id:
# todo 需要什么字段往上加什么
- # # 应出勤天数
- # required_attendance_days = self._get_required_attendance_days(self.employee_id)
- # self.required_attendance_days = required_attendance_days
- # # 实际出勤天数
- # actual_attendance_days = self._get_actual_attendance_days(self.employee_id)
- # self.actual_attendance_days = actual_attendance_days
- # # 调休(小时):取员工表上字段
- # work_overtime, compensatory_leave = self._get_overtime_annual_summary(self.employee_id)
- # self.compensatory_leave = compensatory_leave
- # # 事假(小时):hr.leave表
- # days, hours = self._get_hr_leave_type(self.employee_id, ['personal'])
- # self.leave_of_absence = hours + days * 8
- # # 病假(天):hr.leave表
- # days, hours = self._get_hr_leave_type(self.employee_id, ['sick'])
- # self.leave_of_sick = hours // 8 + days
- # 迟到(次):上班时间 < 上班打卡时间
- come_late = self._get_come_late(self.employee_id)
- self.come_late = come_late
- # # 加班(小时):取员工表上字段
- # self.work_overtime = work_overtime
- # 法定假(天):hr.leave表
- # days, hours = self._get_hr_leave_type(self.employee_id, ['marriage', 'maternity', 'paternity', 'funeral', 'parental'])
- # self.statutory_leave = hours // 8 + days
+ # 迟到, 早退, 缺卡
+ self.come_late, self.is_early_card, self.is_no_card = self._get_come_late(self.employee_id)
+ # 无薪假:hr.leave表
+ days, hours = self._get_hr_leave_type(self.employee_id, ['无薪假'])
+ self.unpaid_leave = hours
+
return True
def update_attendance_month(self):
diff --git a/yuthon_hr_attendance/views/hr_attendance_month_views.xml b/yuthon_hr_attendance/views/hr_attendance_month_views.xml
index 128f17563..5f2124530 100644
--- a/yuthon_hr_attendance/views/hr_attendance_month_views.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_month_views.xml
@@ -67,20 +67,17 @@
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
-
-
diff --git a/yuthon_hr_attendance/views/hr_attendance_portal_templates.xml b/yuthon_hr_attendance/views/hr_attendance_portal_templates.xml
index f62344880..d810ae870 100644
--- a/yuthon_hr_attendance/views/hr_attendance_portal_templates.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_portal_templates.xml
@@ -15,29 +15,17 @@
- -
- 应出勤天数:天
-
- -
- 实际出勤天数:天
-
- -
- 调休(小时):小时
-
- -
- 事假(小时):小时
-
- -
- 病假(天):天
-
-
迟到(次):次
-
- 加班(小时):小时
+ 早退(次):次
-
- 法定假(天):天
+ 缺卡(次):次
+
+ -
+ 无薪假(小时):小时
From 053bde08d44b4c02926edb7c98bbd8c705180a10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
Date: Sun, 5 Jan 2025 19:04:48 +0800
Subject: [PATCH 3/5] ljm 1
---
.../soong_workflow_comment_wizard_view.xml | 4 +-
.../models/property_tenant_information.py | 2 +-
.../models/property_lease_contract.py | 4 +-
.../views/property_lease_contract.xml | 514 ++++++++++--------
4 files changed, 281 insertions(+), 243 deletions(-)
diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml
index 410b78ddc..9d94d3ec4 100644
--- a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml
+++ b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml
@@ -9,7 +9,7 @@