diff --git a/room/data/room_wechat_cron_data.xml b/room/data/room_wechat_cron_data.xml index 1a458d825..1e30b58f6 100644 --- a/room/data/room_wechat_cron_data.xml +++ b/room/data/room_wechat_cron_data.xml @@ -14,6 +14,5 @@ -1 - \ No newline at end of file diff --git a/room/models/room_booking.py b/room/models/room_booking.py index c23f70e08..196a17788 100644 --- a/room/models/room_booking.py +++ b/room/models/room_booking.py @@ -98,23 +98,8 @@ class RoomBooking(models.Model): if attendee.get("userid", ""): user_obj = self.sudo().env["res_users"].search([("oauth_uid", '=', attendee.get("userid", ""))]) for obj in user_obj: - sign_obj = self.sudo().env["res_users"].search([("sign_user_id", '=', obj.id), ("room_booking_id", "=", record.id)]) - if sign_obj: - sign_obj.write({ - "room_booking_id": record.id, - "sign_user_id": obj.id, - "sign_user_name": obj.name, - "user_type": "insiders", - "sign_type": 'yes' - }) - else: - self.env["room.meeting.sign"].sudo().create({ - "room_booking_id": record.id, - "sign_user_id": obj.id, - "sign_user_name": obj.name, - "user_type": "insiders", - "sign_type": 'yes' - }) + sign_obj = self.sudo().env["room.meeting.sign"].search([("sign_user_id", '=', obj.id), ("room_booking_id", "=", record.id)]) + sign_obj.write({"sign_type": 'yes'}) @api.constrains("start_datetime", "stop_datetime") def _check_date_boundaries(self): diff --git a/yuthon_notice/__manifest__.py b/yuthon_notice/__manifest__.py index 15ebb3111..5c8156a93 100644 --- a/yuthon_notice/__manifest__.py +++ b/yuthon_notice/__manifest__.py @@ -15,6 +15,7 @@ 'security/ir.model.access.csv', # 'data/notice_code_data.xml', 'data/project_state_type_data.xml', + 'data/notice_cron_data.xml', 'views/inherit_project_task_views.xml', 'views/yuthon_notice_views.xml', 'views/yuthon_notice_type_views.xml', diff --git a/yuthon_notice/data/notice_cron_data.xml b/yuthon_notice/data/notice_cron_data.xml new file mode 100644 index 000000000..0faba9965 --- /dev/null +++ b/yuthon_notice/data/notice_cron_data.xml @@ -0,0 +1,18 @@ + + + + + + 公告未确认通知 + + code + model.sync_confirm_users_notices() + + + 1 + days + -1 + + + + \ No newline at end of file diff --git a/yuthon_notice/models/yuthon_confirm_users.py b/yuthon_notice/models/yuthon_confirm_users.py index ee9cf970f..be0952e4c 100644 --- a/yuthon_notice/models/yuthon_confirm_users.py +++ b/yuthon_notice/models/yuthon_confirm_users.py @@ -5,11 +5,17 @@ from odoo import api, fields, models, tools class YuthonConfirmUsers(models.Model): _name = "yuthon.confirm.users" _description = "公告确认信息" - # todo 定时任务给未确认的用户发送通知公告 - # todo 打印 employee_id = fields.Many2one('hr.employee', string='员工') notice_id = fields.Many2one('yuthon.notice', string="公告名称") notice_code = fields.Char(string="公告编号") notice_name = fields.Char(string="公告名称") state = fields.Selection([('no', '未确认'), ('yes', '已确认')], string="状态") + + def sync_confirm_users_notices(self): + menu_id = self.env['ir.ui.menu'].search([('name', '=', '我的通知公告')]) + for record in self.search([('state', '=', 'no')]): + str = 'https://www.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=yuthon.notice&view_type=form'.format( + record.notice_id.id, menu_id.id, menu_id.action.id) + data = "您有待确认的通知公告请及时确认\n" + "{}".format(str, self.name) + record.sudo().env["wecom.apps"].sync_send_message(record.employee_id.wecom_userid, data) diff --git a/yuthon_notice/report/notice_report.xml b/yuthon_notice/report/notice_report.xml deleted file mode 100644 index 0b3784d5b..000000000 --- a/yuthon_notice/report/notice_report.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - 通知公告打印 - yuthon.notice - qweb-pdf - yuthon_notice.yuthon_notice_report_template - yuthon_notice.yuthon_notice_report_template - '%s' % (object.name).replace('/', '') - - - report - - - -