diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index dca860c82..956a21c16 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -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: diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 1917cc74e..ab6ef57de 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -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() diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 6c72e8213..e19475817 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -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) \ No newline at end of file diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 67ee15b47..804be310e 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -7,20 +7,20 @@ - + - + - + - - - - + + + + diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index e9bcb6e64..0a5f7ec51 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -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="失效日期") diff --git a/yuthon_property_approval/models/property_split_approval.py b/yuthon_property_approval/models/property_split_approval.py index b47d5d652..5da47a667 100644 --- a/yuthon_property_approval/models/property_split_approval.py +++ b/yuthon_property_approval/models/property_split_approval.py @@ -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 }) diff --git a/yuthon_property_approval/views/property_split_approval_views.xml b/yuthon_property_approval/views/property_split_approval_views.xml index b1d7cb99b..a6becb5e4 100644 --- a/yuthon_property_approval/views/property_split_approval_views.xml +++ b/yuthon_property_approval/views/property_split_approval_views.xml @@ -21,8 +21,6 @@
@@ -39,6 +37,8 @@ +