@@ -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):
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -33,15 +33,19 @@
|
||||
<button name="notice_publish" string="发布" type="object" class="btn-primary"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group col="2">
|
||||
<group col="4">
|
||||
<group>
|
||||
<field name="notice_type_id" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="users_id" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="yuthon_company" string="发布公司"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="department_id" string="发布部门" invisible="1"/>
|
||||
<field name="create_date"/>
|
||||
<field name="users_id" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_notice_roger" invisible="1"/>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<field name='name'>yuthon.will.task.tree</field>
|
||||
<field name='model'>yuthon.will.task</field>
|
||||
<field name='arch' type='xml'>
|
||||
<tree string='待办任务' editable="bottom"
|
||||
<tree string='日程' editable="bottom"
|
||||
decoration-danger="priority == 'very_urgent'"
|
||||
decoration-info="priority == 'urgent'"
|
||||
decoration-success="priority == 'important'">
|
||||
@@ -25,7 +25,7 @@
|
||||
<field name='name'>yuthon.will.task.search</field>
|
||||
<field name='model'>yuthon.will.task</field>
|
||||
<field name='arch' type='xml'>
|
||||
<search string='待办任务'>
|
||||
<search string='日程'>
|
||||
<field name="task_content"/>
|
||||
<filter name="next_seven_days" string="周内事项" domain="[('start_time', '>=', context_today()),
|
||||
('start_time', '<=', context_today() + relativedelta(days=7))]"/>
|
||||
@@ -38,7 +38,7 @@
|
||||
<field name="name">yuthon.will.task.form</field>
|
||||
<field name="model">yuthon.will.task</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="待办任务">
|
||||
<form string="日程">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
@@ -64,7 +64,7 @@
|
||||
<field name="model">yuthon.will.task</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="待办事项"
|
||||
<calendar string="日程"
|
||||
date_start="start_time"
|
||||
date_stop="end_time"
|
||||
event_open_popup="true"
|
||||
@@ -78,17 +78,17 @@
|
||||
</field>
|
||||
</record>
|
||||
<record id='view_yuthon_will_task_action' model='ir.actions.act_window'>
|
||||
<field name='name'>待办任务</field>
|
||||
<field name='name'>日程</field>
|
||||
<field name='res_model'>yuthon.will.task</field>
|
||||
<field name='view_mode'>tree,calendar</field>
|
||||
<field name="context">{'search_default_next_seven_days': 1}</field>
|
||||
</record>
|
||||
<menuitem id='menu_yuthon_will_task'
|
||||
name='待办'
|
||||
name='日程'
|
||||
web_icon="yuthon_will_task,static/description/icon.png"
|
||||
sequence='1'/>
|
||||
<menuitem id='menu_yuthon_will_task_root'
|
||||
name='待办任务'
|
||||
name='日程任务'
|
||||
parent='menu_yuthon_will_task'
|
||||
action='view_yuthon_will_task_action'
|
||||
sequence='1'/>
|
||||
@@ -97,7 +97,7 @@
|
||||
parent="menu_yuthon_will_task"
|
||||
sequence="1"/>
|
||||
<menuitem id="task_type_setting_menu"
|
||||
name="任务类型设置"
|
||||
name="任务类型"
|
||||
parent="task_type_menu"
|
||||
action="view_task_type_setting_action"
|
||||
sequence="5"/>
|
||||
|
||||
@@ -82,16 +82,25 @@
|
||||
parent="menu_hr_attendance_duty_summary_menu_board"
|
||||
action="yuthon_hr_attendance.yuthon_duty_summary_wizard_action"
|
||||
sequence="5"/>
|
||||
<menuitem id="menu_adjustments_approval_board"
|
||||
name="值班调休申请"
|
||||
parent="menu_hr_attendance_duty_summary_menu_board"
|
||||
sequence="7"
|
||||
action="yuthon_hr_attendance.view_yuthon_adjustments_approval_action"/>
|
||||
<menuitem id="menu_yuthon_duty_setting_board"
|
||||
<menuitem id="menu_yuthon_duty_shows_board"
|
||||
name="值班说明"
|
||||
parent="menu_hr_attendance_duty_summary_menu_board"
|
||||
sequence="9"
|
||||
sequence="7"
|
||||
action="yuthon_hr_attendance.action_yuthon_duty_setting"/>
|
||||
<menuitem id="menu_hr_attendance_duty_summary_flow_board"
|
||||
name="流程"
|
||||
parent="menu_hr_attendance_duty_summary_menu_board"
|
||||
sequence="9"/>
|
||||
<menuitem id="menu_adjustments_approval_board"
|
||||
name="值班调休申请"
|
||||
parent="menu_hr_attendance_duty_summary_flow_board"
|
||||
sequence="1"
|
||||
action="yuthon_hr_attendance.view_yuthon_adjustments_approval_action"/>
|
||||
<menuitem id="menu_yuthon_abnormal_approval_board"
|
||||
name="值班异常申请"
|
||||
parent="menu_hr_attendance_duty_summary_flow_board"
|
||||
sequence="3"
|
||||
action="yuthon_hr_attendance.view_yuthon_abnormal_approval_action"/>
|
||||
<!-- 计划相关 -->
|
||||
<menuitem id="menu_hr_attendance_approval_request_board"
|
||||
name="流程"
|
||||
|
||||
Reference in New Issue
Block a user