Merge branch 'dev' of gitee.com:jinan-pengyusen-data/gzth into dev_zhou

Signed-off-by: 李鹏宇 <9664676+pengyuthon@user.noreply.gitee.com>
This commit is contained in:
李鹏宇
2024-11-04 10:22:40 +00:00
committed by Gitee
8 changed files with 59 additions and 78 deletions
+21 -40
View File
@@ -148,9 +148,28 @@ class SoongWorkflowMixin(models.AbstractModel):
log_obj = self._create_update_logs(btn_rec)
if btn_rec.has_comment:
return self.with_context(cx)._add_comment(log_obj, btn_rec)
elif btn_rec.name == '转交' and not btn_rec.has_comment:
self.with_context(cx).no_comment_notice(log_obj, btn_rec)
else:
if btn_rec.name == '转交':
# 如果有下一个节点,发消息通知。
state_list = ['拟办' if i.node_name == 'start' else i.node_name for i in btn_rec.workflow_id.node_ids]
# 当前节点状态
self_state = state_list.index('拟办' if self.state == 'start' else self.state)
# 下一个节点
next_state = btn_rec.workflow_id.node_ids[self_state + 1].button_ids[1]
# 不自动匹配
employee_user_role_ids = self.env['hr.employee'].search([('user_role_id', '=', next_state.users_role_id.id)])
# 自动匹配
employee_user_role_id = self.env['hr.employee'].search([('user_role_id', '=', next_state.users_role_id.id),
('department_id', '=', self.department_id.id)])
employee_ids = employee_user_role_ids if not next_state.is_automatic else employee_user_role_id
# http://127.0.0.1:8057/web#cids=1&menu_id=366&active_id=132&model=yuthon.notice&view_type=form&id=32
url = 'https://oa.thtzjt.com/web#cids=1&menu_id=366&active_id={}&model={}&view_type=form&id={}'.format(self.env.context.get('active_id'),
self._name,
self.id)
for employee in employee_ids:
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='default', user_id=employee.wecom_userid,
title=self.name, description="您有新的审批单请及时处理",
url=url, btntxt="详情")
return btn_rec.with_context(cx).run()
def _add_comment(self, logs, btn_rec):
@@ -178,32 +197,12 @@ class SoongWorkflowMixin(models.AbstractModel):
'link_type': 'return',
'record_id': self.id,
})
return {
"name": _("评论"),
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "soong.workflow.comment.wizard",
"views": [(wizard.id, "form")],
"view_id": wizard.id,
"target": "new",
"context": {
"default_res_id": self.id,
"default_res_model": self._name,
"default_log_ids": logs.ids,
"default_node_btn_id": btn_rec.id,
"default_node_link_len": '转交2' if len(btn_rec.node_id.out_link_ids) > 1 and btn_rec.name == '转交' else '',
},
}
# 不自动匹配
employee_user_role_ids = self.env['hr.employee'].search([('user_role_id', '=', next_state.users_role_id.id)])
# 自动匹配
employee_user_role_id = self.env['hr.employee'].search([('user_role_id', '=', next_state.users_role_id.id),
('department_id', '=', self.department_id.id)])
# self.sudo().env["wecom.apps"].sync_send_message("18562027762", 1111)
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='default', user_id="18562027762", title="测试", description="测试", url="https://oa.thtzjt.com", btntxt="详情")
return {
"name": _("评论"),
"type": "ir.actions.act_window",
@@ -223,24 +222,6 @@ class SoongWorkflowMixin(models.AbstractModel):
},
}
def no_comment_notice(self, logs, btn_rec):
state_list = ['拟办' if i.node_name == 'start' else i.node_name for i in btn_rec.workflow_id.node_ids]
# 当前节点状态
self_state = state_list.index('拟办' if self.state == 'start' else self.state)
# 下一个节点
next_state = btn_rec.workflow_id.node_ids[self_state + 1].button_ids[1]
self.env['trans.link'].search([]).unlink()
if btn_rec.name == '转交' and len(btn_rec.node_id.out_link_ids) > 1:
for state in btn_rec.node_id.out_link_ids:
self.env['trans.link'].create({
'node_button_id': btn_rec.id,
'name': state.name.split('-> ')[1],
'link_type': 'trans',
'record_id': self.id,
})
employee_user_role_id = self.env['hr.employee'].search([('user_role_id', '=', next_state.users_role_id.id), ('department_id', '=', self.department_id.id)])
self.sudo().env["wecom.apps"].sync_send_message("18562027762", 1111)
@api.constrains("state")
def _update_wkf_records(self):
for rec in self:
@@ -85,4 +85,8 @@ class SoongWorkflowCommentWizard(models.TransientModel):
# 加签人员写入
if self.node_btn_name == '加签':
record_id.approval_sign_ids = self.approval_users_ids
# self.sudo().env["wecom.apps"].sync_send_message_textcard(category='default', user_id="18562027762",
# title="测试", description="测试",
# url="https://oa.thtzjt.com", btntxt="详情")
return self.node_btn_id.with_context(cx).run()
+3 -2
View File
@@ -11,11 +11,12 @@ class HrAttendance(models.Model):
is_early_card = fields.Boolean(string="是否早退")
is_late_card = fields.Boolean(string="是否迟到")
work_time_type = fields.Selection([('close_day', '休息日'), ('work_day', '工作日')], string="工作时间类型")
# 暂时不用
company_id = fields.Many2one('res.company', string='公司', index=True, default=lambda self: self.env.company)
on_card_location = fields.Char(string="上班打卡地点")
down_card_location = fields.Char(string="下班打卡地点")
out_card_time = fields.Datetime(string="外出打卡时间")
out_card_location = fields.Char(string="外出打卡地点")
work_hours = fields.Float(string="工作时长")
company_id = fields.Many2one('res.company', string='公司', index=True, default=lambda self: self.env.company)
current_data = fields.Date(string='打卡日期', tracking=True)
@@ -7,20 +7,20 @@
<field name="arch" type="xml">
<tree string="出勤" editable="bottom">
<field name="employee_id" widget="many2one_avatar_user"/>
<field name="company_id" optional="show"/>
<!-- <field name="company_id" optional="show"/>-->
<field name="is_clock_card" optional="show"/>
<field name="is_no_card" optional="show"/>
<field name="is_early_card" optional="show"/>
<field name="is_late_card" optional="show"/>
<field name="work_time_type" optional="hidden"/>
<field name="current_data"/>
<!-- <field name="current_data"/>-->
<field name="check_in" optional="show"/>
<field name="on_card_location" optional="show"/>
<!-- <field name="on_card_location" optional="show"/>-->
<field name="check_out" optional="show"/>
<field name="down_card_location" optional="show"/>
<field name="out_card_time" optional="show"/>
<field name="out_card_location" optional="show"/>
<field name="work_hours" optional="show"/>
<!-- <field name="down_card_location" optional="show"/>-->
<!-- <field name="out_card_time" optional="show"/>-->
<!-- <field name="out_card_location" optional="show"/>-->
<!-- <field name="work_hours" optional="show"/>-->
</tree>
</field>
</record>
+2 -2
View File
@@ -318,6 +318,6 @@ class DisassemblyInformationLine(models.Model):
yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息")
property_id = fields.Many2one('yuthon.property', string="物业名称")
rent_area = fields.Float(related='property_id.rentable_area', string="可租面积")
start_time = fields.Date(related='property_id.start_time',string="生效日期")
end_date = fields.Date(related='property_id.end_date',string="失效日期")
start_time = fields.Date(string="生效日期")
end_date = fields.Date(string="失效日期")
@@ -41,12 +41,12 @@ class PropertySplitApproval(models.Model):
def put_split_message(self):
property_list = []
for property_split in self.property_split_approval_line_ids:
for i in self.property_split_approval_line_ids:
property_id = self.env['yuthon.property'].create({
'name': property_split.split_property,
'building_area': property_split.split_building_area,
'rentable_area': property_split.split_rent_area,
'asset_type_id': property_split.split_asset_type_id.id,
'name': i.split_property,
'building_area': i.split_building_area,
'rentable_area': i.split_rent_area,
'asset_type_id': i.split_asset_type_id.id,
'property_merge_approval_id':self.property_id.id,
'is_done_merge': True
})
@@ -21,8 +21,6 @@
<sheet>
<header>
<button name="put_split_message" type="object" string="按钮" class="oe_highlight"/>
<button name="put_free_splitting" string="自由拆分" type="object" class="oe_highlight"/>
<button name="put_evaluation_splitting" string="评估拆分" type="object" class="oe_highlight"/>
</header>
<group col="2" string="物业信息">
<group>
@@ -39,6 +37,8 @@
</group>
<group>
<field name="split_quantity"/>
<button name="put_free_splitting" string="自由拆分" type="object" class="btn btn-primary"/>
<button name="put_evaluation_splitting" string="评估拆分" type="object" class="btn btn-primary"/>
</group>
<group string="审批事项">
<field name="name"/>
+15 -20
View File
@@ -297,21 +297,21 @@
name="配置"
parent="menu_hr_attendance_plan_request_board"
sequence="7"/>
<menuitem id="menu_hr_plan_set_setting_board"
name="设置"
parent="menu_hr_plan_set_request_board"
action="yuthon_none_action"
sequence="1"/>
<menuitem id="menu_hr_plan_set_employee_board"
name="员工"
parent="menu_hr_plan_set_request_board"
action="hr.open_view_employee_list_my"
sequence="3"/>
<menuitem id="menu_hr_plan_set_stuff_board"
name="材料"
parent="menu_hr_plan_set_request_board"
action="planning.planning_action_resources"
sequence="5"/>
<!-- <menuitem id="menu_hr_plan_set_setting_board"-->
<!-- name="设置"-->
<!-- parent="menu_hr_plan_set_request_board"-->
<!-- action="yuthon_none_action"-->
<!-- sequence="1"/>-->
<!-- <menuitem id="menu_hr_plan_set_employee_board"-->
<!-- name="员工"-->
<!-- parent="menu_hr_plan_set_request_board"-->
<!-- action="hr.open_view_employee_list_my"-->
<!-- sequence="3"/>-->
<!-- <menuitem id="menu_hr_plan_set_stuff_board"-->
<!-- name="材料"-->
<!-- parent="menu_hr_plan_set_request_board"-->
<!-- action="planning.planning_action_resources"-->
<!-- sequence="5"/>-->
<menuitem id="menu_hr_plan_set_role_board"
name="角色"
parent="menu_hr_plan_set_request_board"
@@ -414,11 +414,6 @@
parent="holiday_set_menu_board"
action="hr_holidays.open_view_public_holiday"
sequence="5"/>
<menuitem id="holiday_set_compulsory_board"
name="国定假日"
parent="holiday_set_menu_board"
action="hr_holidays.hr_leave_mandatory_day_action"
sequence="7"/>
<!-- 薪资管理 -->