diff --git a/requirements.txt b/requirements.txt index ba3204376..971007477 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,7 @@ pandas gtts jwt pypinyin -mammoth \ No newline at end of file +mammoth + +shapely +geojson diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index 440d4f17b..678803ddf 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -13,10 +13,11 @@ 'sequence': 240, 'website': 'https://www.pengyuthon.com', 'depends': ['hr_attendance', 'resource', 'base', 'hr', 'mail', - 'soong_workflow', 'yuthon_issue', 'planning', 'calendar', 'web_gantt'], + 'soong_workflow', 'yuthon_issue', 'planning', 'calendar', 'web_gantt', 'yuthon_wechat'], 'data': [ 'security/ir.model.access.csv', 'security/attendance_security_group.xml', + 'data/hr_attendance_time.xml', 'data/attendance_code_data.xml', 'data/attendance_role_groups_data.xml', 'data/attendance_time_data.xml', @@ -28,6 +29,8 @@ 'views/yuthon_customer_approval_views.xml', 'views/yuthon_shift_planning_views.xml', 'views/yuthon_run_planning_views.xml', + 'views/hr_attendance_wechat_views.xml', + 'views/hr_attendance_detail_wechat_views.xml', 'views/overtime_approval.xml', 'views/go_approval.xml', 'views/leave_approval.xml', @@ -46,6 +49,7 @@ 'views/card_remind_form.xml', 'views/yuthon_customer_planning_views.xml', 'views/all_attendance_menu.xml', + 'views/planning_slot_template_views.xml', ], 'assets': { diff --git a/yuthon_wechat/data/hr_attendance_time.xml b/yuthon_hr_attendance/data/hr_attendance_time.xml similarity index 100% rename from yuthon_wechat/data/hr_attendance_time.xml rename to yuthon_hr_attendance/data/hr_attendance_time.xml diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py index 1cd4aa8ae..75499145c 100644 --- a/yuthon_hr_attendance/models/__init__.py +++ b/yuthon_hr_attendance/models/__init__.py @@ -23,7 +23,8 @@ from . import yuthon_shift_approval from . import yuthon_special_approval from . import yuthon_customer_planning - +from . import hr_attendance_wechat +from . import hr_attendance_detail_wechat # from odoo.tools import SQL # import odoo diff --git a/yuthon_wechat/models/hr_attendance_detail.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py similarity index 98% rename from yuthon_wechat/models/hr_attendance_detail.py rename to yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index e23e6afd2..a4ababc66 100644 --- a/yuthon_wechat/models/hr_attendance_detail.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -6,7 +6,6 @@ import logging import traceback from odoo import api, fields, models, tools, _ from dateutil.relativedelta import relativedelta -from ...yuthon_wechat.utils.common import utils_list_page _logger = logging.getLogger(__name__) @@ -543,7 +542,7 @@ class HrAttendanceDetail(models.Model): start_time = now_time - timedelta(days=30) # 企业微信获取打卡数据,要求用户分组100,分批获取打卡记录 - for userid_limit in utils_list_page(user_list, 100): + for userid_limit in self.utils_list_page(user_list, 100): # 获取企业微信的打卡信息 try: attendance_data = self._get_wx_attendance_data(userid_limit, now_time, start_time) @@ -844,4 +843,19 @@ class HrAttendanceDetail(models.Model): from_time = "%d:%d" % (int(data), round((data - int(data)) * 60)) from_times = str(current_data) + " " + from_time from_ti = datetime.strptime(from_times, "%Y-%m-%d %H:%M") - return from_ti \ No newline at end of file + return from_ti + + @staticmethod + def utils_list_page(data, limit): + """ + 列表平分 + :param data: list + :param limit: 每组多少个 + :return: 平分结果 + """ + for start in range(0, len(data), limit): + if start + limit > len(data): + end = len(data) + else: + end = start + limit + yield data[start:end] diff --git a/yuthon_wechat/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance_wechat.py similarity index 100% rename from yuthon_wechat/models/hr_attendance.py rename to yuthon_hr_attendance/models/hr_attendance_wechat.py diff --git a/yuthon_hr_attendance/models/planning_template_inherit.py b/yuthon_hr_attendance/models/planning_template_inherit.py index edb745516..b79126be9 100644 --- a/yuthon_hr_attendance/models/planning_template_inherit.py +++ b/yuthon_hr_attendance/models/planning_template_inherit.py @@ -18,6 +18,12 @@ class PlanningTemplate(models.Model): planning_name = fields.Char(string='名称') color = fields.Integer("颜色", default=_get_default_color) + check_in_start = fields.Char(string="上班开始") + check_in_end = fields.Char(string="上班结束") + + check_out_start = fields.Char(string="下班开始") + check_out_end = fields.Char(string="下班结束") + def _compute_name(self): super()._compute_name() user_tz = pytz.timezone(self.env['planning.slot']._get_tz()) diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index e88f13794..74d032ff3 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -34,4 +34,10 @@ access_yuthon_shift_approval,yuthon.shift.approval,model_yuthon_shift_approval,b access_yuthon_special_approval,yuthon.special.approval,model_yuthon_special_approval,base.group_user,1,1,1,1 access_card_remind_form,card.remind.form,model_card_remind_form,base.group_user,1,1,1,1 access_yuthon_customer_planning,yuthon.customer.planning,model_yuthon_customer_planning,base.group_user,1,1,1,1 -access_customer_plan_line,customer.plan.line,model_customer_plan_line,base.group_user,1,1,1,1 \ No newline at end of file +access_customer_plan_line,customer.plan.line,model_customer_plan_line,base.group_user,1,1,1,1 + +access_hr_attendance_detail_user,hr.attendance.detail.user,model_hr_attendance_detail,base.group_user,1,0,0,0 +access_hr_attendance_detail_manager,hr.attendance.detail.manager,model_hr_attendance_detail,base.group_user,1,1,1,1 + +access_hr_attendance_detail_image_user,hr.attendance.detail.image.user,model_hr_attendance_detail_image,base.group_user,1,0,0,0 +access_hr_attendance_detail_image_manager,hr.attendance.detail.image.manager,model_hr_attendance_detail_image,base.group_user,1,1,1,1 diff --git a/yuthon_wechat/views/hr_attendance_detail_views.xml b/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml similarity index 100% rename from yuthon_wechat/views/hr_attendance_detail_views.xml rename to yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml diff --git a/yuthon_wechat/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_wechat_views.xml similarity index 100% rename from yuthon_wechat/views/hr_attendance_views.xml rename to yuthon_hr_attendance/views/hr_attendance_wechat_views.xml diff --git a/yuthon_wechat/views/planning_slot_template_views.xml b/yuthon_hr_attendance/views/planning_slot_template_views.xml similarity index 100% rename from yuthon_wechat/views/planning_slot_template_views.xml rename to yuthon_hr_attendance/views/planning_slot_template_views.xml diff --git a/yuthon_wechat/__manifest__.py b/yuthon_wechat/__manifest__.py index e722dab6e..055734ac6 100644 --- a/yuthon_wechat/__manifest__.py +++ b/yuthon_wechat/__manifest__.py @@ -15,11 +15,9 @@ * 新增 API 获取临时素材 * 新增 定时任务 和 刷新access_token的代码 """, - 'depends': ['base', 'auth_oauth', 'hr', 'yuthon_hr_attendance'], + 'depends': ['base', 'auth_oauth', 'hr'], 'data': [ 'security/ir.model.access.csv', - 'data/hr_attendance_time.xml', - # 'data/wecom_apps_cron_data.xml', 'data/wecom_api_data.xml', 'data/auth_oauth_provider.xml', 'views/wecom_api_views.xml', @@ -27,10 +25,7 @@ 'views/hr_employee_views.xml', 'views/wecom_apps_config_views.xml', 'wizard/wecom_api_sync_wizard.xml', - 'views/hr_attendance_views.xml', - 'views/hr_attendance_detail_views.xml', 'views/wx_work_views.xml', - 'views/planning_slot_template_views.xml', ], 'application': True, 'installable': True, diff --git a/yuthon_wechat/models/__init__.py b/yuthon_wechat/models/__init__.py index 17403c42a..0fd959714 100644 --- a/yuthon_wechat/models/__init__.py +++ b/yuthon_wechat/models/__init__.py @@ -5,10 +5,8 @@ from . import wecom_apps from . import hr_employee from . import res_users from . import wecom_apps_config -from . import hr_attendance_detail from . import wx_work -from . import hr_attendance -from . import planning_slot_template + diff --git a/yuthon_wechat/models/planning_slot_template.py b/yuthon_wechat/models/planning_slot_template.py deleted file mode 100644 index 106d5f455..000000000 --- a/yuthon_wechat/models/planning_slot_template.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -from odoo import api, fields, models, _ - - -class PlanningTemplate(models.Model): - _inherit = 'planning.slot.template' - - check_in_start = fields.Char(string="上班开始") - check_in_end = fields.Char(string="上班结束") - - check_out_start = fields.Char(string="下班开始") - check_out_end = fields.Char(string="下班结束") - diff --git a/yuthon_wechat/security/ir.model.access.csv b/yuthon_wechat/security/ir.model.access.csv index bb47359ec..9f6991423 100644 --- a/yuthon_wechat/security/ir.model.access.csv +++ b/yuthon_wechat/security/ir.model.access.csv @@ -4,9 +4,3 @@ access_wecom_apps,wecom.apps.user,model_wecom_apps,,1,1,1,1 access__wecom_apps_config,wecom.app.config.user,model_wecom_apps_config,,1,1,1,1 access_wecom_api_sync_wizard_manager,wecom.api.sync.wizard,model_wecom_api_sync_wizard,,1,1,1,1 - -access_hr_attendance_detail_user,hr.attendance.detail.user,model_hr_attendance_detail,base.group_user,1,0,0,0 -access_hr_attendance_detail_manager,hr.attendance.detail.manager,model_hr_attendance_detail,base.group_user,1,1,1,1 - -access_hr_attendance_detail_image_user,hr.attendance.detail.image.user,model_hr_attendance_detail_image,base.group_user,1,0,0,0 -access_hr_attendance_detail_image_manager,hr.attendance.detail.image.manager,model_hr_attendance_detail_image,base.group_user,1,1,1,1