diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index cdc4b2ae7..74b56cf6c 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -68,7 +68,7 @@ class YuthonHrEmployee(models.Model):
compute_month = fields.Integer(string="社保时长假期")
open_start_time_today = fields.Date(string="工作至今")
interrupt_work_month = fields.Integer(string="中断工作月数")
- cumulative_work_month = fields.Integer(string="累计工作月数", compute='_compute_cumulative_work_month', store=True)
+ cumulative_work_month = fields.Integer(string="累计工作月数", compute='_compute_social_insurance_info', store=True)
cumulative_work_years = fields.Char(string="累计工作年限", compute='_compute_cumulative_work_years', store=True)
# 教育
high_degree = fields.Char(string="最高学历")
@@ -165,34 +165,25 @@ class YuthonHrEmployee(models.Model):
else:
record.company_old = None
- @api.depends('social_insurance_date')
- def _compute_cumulative_work_month(self):
+ @api.depends('social_insurance_date', 'interrupt_work_month')
+ def _compute_social_insurance_info(self):
for record in self:
- if record.social_insurance_time:
+ cumulative_months = 0
+ if record.social_insurance_date:
today = datetime.now().date()
- if record.social_insurance_date:
- delta = relativedelta(today, record.social_insurance_date)
- record.cumulative_work_month = delta.years * 12 + delta.months
- else:
- record.cumulative_work_month = 0
-
- @api.depends('cumulative_work_month', 'interrupt_work_month')
- def _compute_social_insurance_time(self):
- for record in self:
- record.social_insurance_time = record.cumulative_work_month - record.interrupt_work_month
- record.compute_month = record.cumulative_work_month - record.interrupt_work_month
- total_months = int(record.social_insurance_time)
+ delta = relativedelta(today, record.social_insurance_date)
+ cumulative_months = delta.years * 12 + delta.months
+ record.cumulative_work_month = cumulative_months
+ total_months = cumulative_months - record.interrupt_work_month
+ record.compute_month = total_months
if total_months <= 0:
- record.social_insurance_time = "0个月"
- years = total_months // 12
- months = total_months % 12
- if years > 0:
- result_str = f"{years}年"
- if months > 0:
- result_str += f"{months}个月"
+ social_insurance_time_str = "0个月"
else:
- result_str = f"{months}个月"
- record.social_insurance_time = result_str
+ years = total_months // 12
+ months = total_months % 12
+ social_insurance_time_str = f"{years}年{months}个月" if years > 0 and months > 0 else (
+ f"{years}年" if years > 0 else f"{months}个月")
+ record.social_insurance_time = social_insurance_time_str
@api.depends('cumulative_work_month')
def _compute_cumulative_work_years(self):
diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py
index be80b09b7..f0d2a5074 100644
--- a/yuthon_notice/models/yuthon_notice.py
+++ b/yuthon_notice/models/yuthon_notice.py
@@ -16,7 +16,7 @@ class YuthonNotice(models.Model):
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
notice_type_id = fields.Many2one('yuthon.notice.type', string="类型")
- create_date = fields.Date(string="发布日期")
+ create_date = fields.Date(string="发布日期", default=fields.Date.today())
start_date = fields.Date(string="生效日期", default=fields.Date.today())
end_date = fields.Date(string="终止日期")
sequence = fields.Integer(string="顺序", default=1, compute='_compute_sequence')
@@ -81,7 +81,7 @@ class YuthonNotice(models.Model):
'state': 'no',
})
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id,
- title="通知公告", description=self.name,
+ title="通知公告", description=self.name+self.users_id.name,
url=str, btntxt="详细信息")
# partner_ids = self.sudo().env['res.users'].search([('id', 'in', employee_users_list)]).mapped('partner_id').ids
# self.sudo().with_context(lang=self.env.lang)._message_auto_subscribe_notify(partner_ids, 'yuthon_notice.message_yuthon_confirm_users_data')
diff --git a/yuthon_notice/views/yuthon_notice_views.xml b/yuthon_notice/views/yuthon_notice_views.xml
index 3d4af6a6b..f49aa9f6b 100644
--- a/yuthon_notice/views/yuthon_notice_views.xml
+++ b/yuthon_notice/views/yuthon_notice_views.xml
@@ -33,15 +33,19 @@
-
+
+
+
+
+
+
-
diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py
index f972d6b61..4e4c8ed40 100644
--- a/yuthon_will_task/models/yuthon_will_task.py
+++ b/yuthon_will_task/models/yuthon_will_task.py
@@ -43,7 +43,7 @@ class YuthonWillTask(models.Model):
raise UserError("请同步{}的企业微信".format(employee_id.name))
url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self._name, self.id)
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='task', user_id=employee_id.wecom_userid,
- title="待办事项提醒", description="请注意你的待办事项" + self.task_content,
+ title="待办事项提醒", description=self.task_content,
url=url, btntxt="详细信息")
def button_add_comment(self):
diff --git a/yuthon_will_task/views/yuthon_will_task_views.xml b/yuthon_will_task/views/yuthon_will_task_views.xml
index 2bf161655..bb4286b18 100644
--- a/yuthon_will_task/views/yuthon_will_task_views.xml
+++ b/yuthon_will_task/views/yuthon_will_task_views.xml
@@ -4,7 +4,7 @@
yuthon.will.task.tree
yuthon.will.task
-
@@ -25,7 +25,7 @@
yuthon.will.task.search
yuthon.will.task
-
+
@@ -38,7 +38,7 @@
yuthon.will.task.form
yuthon.will.task
-