diff --git a/soong_workflow/models/soong_user_role.py b/soong_workflow/models/soong_user_role.py
index a58677230..c4b73c0c1 100644
--- a/soong_workflow/models/soong_user_role.py
+++ b/soong_workflow/models/soong_user_role.py
@@ -21,7 +21,7 @@ class YuthonUserRole(models.Model):
personnel = fields.Text(string="在岗人员", compute='_compute_personnel')
employee_ids = fields.One2many('hr.employee', 'user_role_id')
number_people = fields.Integer(string="在岗人数", compute='_compute_number_people')
- child_ids = fields.One2many('soong.user.role', 'parent_id', string='子集角色', index=True)
+ child_ids = fields.One2many('soong.user.role', 'parent_id', string='下级角色', index=True)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('thtjbb', '天河投资本部')], string="所属公司", compute='compute_company')
pinyin_name = fields.Char(string="拼音名称", compute='_compute_pinyin', index=True, store=True)
diff --git a/soong_workflow/views/soong_workflow_log_views.xml b/soong_workflow/views/soong_workflow_log_views.xml
index 66c519e17..0f5b52253 100644
--- a/soong_workflow/views/soong_workflow_log_views.xml
+++ b/soong_workflow/views/soong_workflow_log_views.xml
@@ -5,7 +5,7 @@
soong.workflow.log.tree
soong.workflow.log
-
+
diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py
index 018a9be37..9badd12d8 100644
--- a/yuthon_holiday/models/inherit_hr_leave.py
+++ b/yuthon_holiday/models/inherit_hr_leave.py
@@ -131,7 +131,7 @@ class HolidaysRequestBatch(models.Model):
details = fields.Text(string="假期流程说明", compute='_compute_details')
days = fields.Float(string='天数')
hours = fields.Float(string='小时')
- text = fields.Html(string='申请事由')
+ text = fields.Text(string='申请事由')
is_day = fields.Boolean(string='按天请假')
is_hour = fields.Boolean(string='按小时请假')
leave_ids = fields.One2many(string='按天请假详情', comodel_name='hr.leave', inverse_name='batch_id', domain=[('leave_type_request_unit', '=', 'day')])
diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml
index 11b285bc6..0bc11f7ac 100644
--- a/yuthon_holiday/views/hr_leave_batch.xml
+++ b/yuthon_holiday/views/hr_leave_batch.xml
@@ -36,9 +36,6 @@
-
-
-
+
+
+
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 17c222cb9..cb98c4c67 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -59,14 +59,14 @@ class YuthonProperty(models.Model):
description = fields.Html(string="描述")
is_message_fee = fields.Boolean(string="管理费")
message_standard_id = fields.Many2one('property.message.fee', string="管理费标准")
- code = fields.Char(string="编号",
- default=lambda self: self.env['ir.sequence'].next_by_code('property_message_code'))
+ code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_message_code'))
rental_unit_price = fields.Float(string="评估单价")
address = fields.Text(string="物业地址")
title_number = fields.Char(string="产权编号")
suite_area = fields.Float(string="套内面积")
start_time = fields.Date(string="生效时间")
end_date = fields.Date(string="失效日期")
+ lessee_id = fields.Many2one('yuthon.property.lessee', string='承租方')
manage_standard = fields.Char(string="物业管理费标准")
title_address = fields.Char(string="产权地址")
rental_address = fields.Char(string="出租地址")
@@ -240,6 +240,7 @@ class YuthonProperty(models.Model):
'default_property_merge_approval_line_ids':property_list
}}
+
class YuthonPropertyWater(models.Model):
_name = 'yuthon.property.water'
_description = '水表'
diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml
index 31ee8dc50..0340e686c 100644
--- a/yuthon_property/views/yuthon_property_views.xml
+++ b/yuthon_property/views/yuthon_property_views.xml
@@ -29,6 +29,7 @@
+
@@ -65,7 +66,7 @@
-
+
@@ -119,7 +120,7 @@
-
+
@@ -188,7 +189,6 @@
-
@@ -225,6 +225,10 @@
管理员:
+
+ 承租方:
+
+
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index 5e9a4d58e..70700adb1 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -66,9 +66,6 @@ class PropertyLeaseContract(models.Model):
percentage_liquidated_damages = fields.Char(string="违约金比例")
date_of_payment = fields.Date(string="每月支付日期")
unit_price = fields.Float(string="单价")
- management_fee = fields.Float(string="管理费")
- water = fields.Float(string="水费")
- tariff = fields.Float(string="电费")
deposit = fields.Float(string="押金/履约保证金")
first_year_rent = fields.Float(string="首年租金")
total_contract_receivables = fields.Float(string="合同应收")
@@ -76,7 +73,7 @@ class PropertyLeaseContract(models.Model):
not_tax_amount = fields.Float(string="不含税价")
tax = fields.Float(string="税金")
miscellaneous = fields.Char(string="其他约定")
- total_area = fields.Float(string="总面积")
+ total_area = fields.Float(string="总面积", digits=(16, 4))
lease_ids = fields.One2many('property.lease.contract.line', 'lease_id',string="租赁信息明细行")
breakdown_ids = fields.One2many('property.rent.breakdown.line', 'breakdown_id', string="物业租金明细行")
@@ -353,6 +350,11 @@ class PropertyLeaseContract(models.Model):
"period_rent": monthly_amount * months,
})
+ @api.onchange("first_year_rent")
+ def _onchange_first_year_rent(self):
+ for rec in self:
+ rec.deposit = rec.first_year_rent * 2
+
class PropertyLeaseContractLine(models.Model):
_name = 'property.lease.contract.line'
_description = '物业列表明细行'
diff --git a/yuthon_property_approval/models/property_offline_registration.py b/yuthon_property_approval/models/property_offline_registration.py
index 7c07da8c8..631986389 100644
--- a/yuthon_property_approval/models/property_offline_registration.py
+++ b/yuthon_property_approval/models/property_offline_registration.py
@@ -13,7 +13,7 @@ class PropertyOfflineRegistration(models.Model):
rental_price = fields.Float(string='租金底价(元/m²)')
monthly_rent = fields.Float(string='月租金(元)')
increment_rate = fields.Char(string='递增率')
- rent_free = fields.Char(string='免租期')
+ rent_free = fields.Datetime(string='免租期')
contract_years = fields.Char(string='签约年限')
start_data = fields.Date(string="报价开始日期")
end_data = fields.Date(string="报价结束日期")
diff --git a/yuthon_property_approval/models/property_split_approval.py b/yuthon_property_approval/models/property_split_approval.py
index 1d634f660..d9cf22018 100644
--- a/yuthon_property_approval/models/property_split_approval.py
+++ b/yuthon_property_approval/models/property_split_approval.py
@@ -1,4 +1,5 @@
from odoo import models, fields, api, exceptions, _
+from odoo.exceptions import UserError
class PropertySplitApproval(models.Model):
@@ -6,8 +7,7 @@ class PropertySplitApproval(models.Model):
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
_description = '物业拆分审批'
- code = fields.Char(string="编号",
- default=lambda self: self.env['ir.sequence'].next_by_code('property_split_approval_code'))
+ code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_split_approval_code'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
property_id = fields.Many2one('yuthon.property', string='物业名称')
@@ -23,25 +23,20 @@ class PropertySplitApproval(models.Model):
reason = fields.Html(string="正文")
notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
property_split_approval_line_ids = fields.One2many('property.split.approval.line', 'property_split_approval_id', string='关联物业拆分明细行')
- split_quantity = fields.Integer(string='拆分数量')
+ split_quantity = fields.Integer(string='拆分数量', default=2)
- #自由拆分
- @api.onchange('split_quantity')
- def onchange_split_quantity(self):
- self.property_split_approval_line_ids.unlink()
- for i in range(self.split_quantity):
- self.property_split_approval_line_ids.create({
- 'property_split_approval_id': self.id,
- 'split_property':self.property_id.name + '-'+str(i+1)})
-
- # #平均拆分
- # def put_evaluation_splitting(self):
- # for i in range(self.split_quantity):
- # self.env['property.split.approval.line'].create({
- # 'property_split_approval_id': self.id,
- # 'split_property': self.property_id.name + '-' + str(i + 1),
- # 'split_building_area': self.property_id.building_area/self.split_quantity,
- # 'split_rent_area': self.property_id.rent_area/self.split_quantity})
+ def property_split_button(self):
+ if self.split_quantity < 2:
+ raise UserError('拆分数量必须是大于2')
+ if self.id.origin and self.property_id:
+ lines_to_create = []
+ for i in range(self.split_quantity):
+ lines_to_create.append({
+ 'property_split_approval_id': self.id.origin,
+ 'split_property': f"{self.property_id.name}-{i + 1}"
+ })
+ self.property_split_approval_line_ids.unlink()
+ self.env['property.split.approval.line'].create(lines_to_create)
def put_split_message(self):
property_list = []
@@ -58,6 +53,7 @@ class PropertySplitApproval(models.Model):
self.property_id.write({'is_done_split': True})
self.property_id.disassembly_information_ids = property_list
+
class PropertySplitApprovalLine(models.Model):
_name = 'property.split.approval.line'
_description = '物业拆分明细行'
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index 22af8395b..49341e848 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -60,8 +60,9 @@
-
-
+
+
+
@@ -81,9 +82,9 @@
-
-
+
+
@@ -92,23 +93,18 @@
-
-
+
-
+
-
-
-
-
diff --git a/yuthon_property_approval/views/property_split_approval_views.xml b/yuthon_property_approval/views/property_split_approval_views.xml
index ee45d488b..6efc855a8 100644
--- a/yuthon_property_approval/views/property_split_approval_views.xml
+++ b/yuthon_property_approval/views/property_split_approval_views.xml
@@ -37,6 +37,8 @@
+
+
@@ -44,9 +46,6 @@
-
-
-
diff --git a/yuthon_wechat/models/hr_attendance_detail.py b/yuthon_wechat/models/hr_attendance_detail.py
index 637eb327c..3079b82b3 100644
--- a/yuthon_wechat/models/hr_attendance_detail.py
+++ b/yuthon_wechat/models/hr_attendance_detail.py
@@ -244,16 +244,32 @@ class HrAttendanceDetail(models.Model):
if not attendance_obj:
res_user_obj = self.env['res.users'].search([("oauth_uid", "=", userid)], limit=1)
hr_employee_obj = self.env['hr.employee'].sudo().search([("user_id", "=", res_user_obj.id)], limit=1)
+ if not hr_employee_obj.default_planning_role_id:
+ attendance_obj = self.env['hr.attendance'].sudo().create({
+ 'employee_id': hr_employee_obj.id,
+ "userid": userid,
+ "current_data": current_data,
+ "attendance_type": "wx_work"
+ })
+ else:
+ if hr_employee_obj.default_planning_role_id.name == '保安部':
+ current_datetime_start = datetime.datetime.combine(
+ datetime.datetime.strptime(current_data, '%Y-%m-%d'), datetime.time.min)
+ current_datetime_end = datetime.datetime.combine(
+ datetime.datetime.strptime(current_data, '%Y-%m-%d'), datetime.time.max)
+ planning_slot_id = self.env['planning.slot'].search(
+ [('resource_id', '=', hr_employee_obj.resource_id.id),
+ ('start_datetime', '>=', current_datetime_start),
+ ('start_datetime', '<=', current_datetime_end)])
+ if planning_slot_id:
+ attendance_obj = self.env['hr.attendance'].sudo().create({
+ 'employee_id': hr_employee_obj.id,
+ "userid": userid,
+ "current_data": current_data,
+ "shift_id": planning_slot_id.id,
+ "attendance_type": "wx_work"
+ })
if not hr_employee_obj.default_planning_role_id:
- checkin_type = data.get("checkin_type", "")
- exception_type = data.get("exception_type", "")
- attendance_obj = self.env['hr.attendance'].sudo().create({
- 'employee_id': hr_employee_obj.id,
- "userid": userid,
- "current_data": current_data,
- "attendance_type": "wx_work"
- })
-
# 获取考勤日历的上班下班时间
min_hour_from = self.env['resource.calendar'].search([])[0].attendance_ids[0].hour_from
min_hour = int(min_hour_from)
@@ -261,10 +277,13 @@ class HrAttendanceDetail(models.Model):
max_hour_to = self.env['resource.calendar'].search([])[-1].attendance_ids[0].hour_to
max_hour = int(max_hour_to)
max_minute = int(max_hour_to * 10 % max_hour_to)
- if attendance_obj.is_approval:# 已经审批修复无需再次进行更新数据
+ if attendance_obj.is_approval:
+ # 已经审批修复无需再次进行更新数据
return True
# 赋值企业微信打卡数据
attendance_obj.attendance_type = "wx_work"
+ checkin_type = data.get("checkin_type", "")
+ exception_type = data.get("exception_type", "")
will_datetime_start = checkin_time.replace(hour=min_hour, minute=min_minute)
will_datetime_end = checkin_time.replace(hour=max_hour, minute=max_minute)
if exception_type != "未打卡":
@@ -309,304 +328,31 @@ class HrAttendanceDetail(models.Model):
else:
attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True})
elif hr_employee_obj.default_planning_role_id.name == '保安部':
+ attendance_obj.attendance_type = "wx_work"
checkin_type = data.get("checkin_type", "")
current_datetime_start = datetime.datetime.combine(datetime.datetime.strptime(current_data, '%Y-%m-%d'), datetime.time.min)
current_datetime_end = datetime.datetime.combine(datetime.datetime.strptime(current_data, '%Y-%m-%d'), datetime.time.max)
- planning_slot_id = self.env['planning.slot'].search([('resource_id', '=', hr_employee_obj.resource_id.id),
- ('start_datetime', '>=', current_datetime_start),
- ('start_datetime', '<=', current_datetime_end)])
- if planning_slot_id:
- attendance_obj = self.env['hr.attendance'].sudo().create({
- 'employee_id': hr_employee_obj.id,
- "userid": userid,
- "current_data": current_data,
- "shift_id": planning_slot_id.id,
- "attendance_type": "wx_work"
- })
+ planning_id = self.env['planning.slot'].search([('resource_id', '=', hr_employee_obj.resource_id.id),
+ ('start_datetime', '>=', current_datetime_start),
+ ('start_datetime', '<=', current_datetime_end)])
+ if planning_id:
+ planning_start_time = planning_id.start_datetime
+ planning_end_time = planning_id.end_datetime
if checkin_time:
if checkin_time and checkin_type == "上班打卡" and not attendance_obj.check_in:
attendance_obj.sudo().write({
"check_in": checkin_time,
- "is_late_card": checkin_time > planning_slot_id.start_datetime,
+ "is_late_card": checkin_time > planning_start_time
})
elif checkin_time and checkin_type == "下班打卡" and not attendance_obj.check_out:
attendance_obj.sudo().write({
"check_out": checkin_time,
- "is_early_card": planning_slot_id.end_datetime > checkin_time,
+ "is_early_card": planning_end_time> checkin_time,
})
- # elif attendance_obj.check_in and checkin_time and checkin_type == "上班打卡" and checkin_time < attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif attendance_obj.check_out and checkin_time and checkin_type == "下班打卡" and checkin_time > attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif checkin_time and not attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- elif attendance_obj.is_early_card or attendance_obj.is_late_card:
- attendance_obj.sudo().write({"is_abnormal": True})
- else:
- attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True})
- # elif planning_slot_id.department_id.name == '工程部':
- # attendance_obj = self.env['hr.attendance'].sudo().create({
- # 'employee_id': hr_employee_obj.id,
- # "userid": userid,
- # "current_data": current_data,
- # "shift_id": planning_slot_id.id,
- # "attendance_type": "wx_work"
- # })
- # if planning_slot_id.template_id.planning_name == '中值':
- # if exception_type != "未打卡":
- # if checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and not attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif attendance_obj.check_in and checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and checkin_time < attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif attendance_obj.check_out and checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and checkin_time > attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif checkin_time and exception_type != "未打卡" and not attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and exception_type != "未打卡" and attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif datetime.time(11, 30)<= checkin_time <= datetime.time(13, 30):
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "noon_duty":False
- # })
- # elif attendance_obj.is_early_card or attendance_obj.is_late_card or attendance_obj.noon_duty:
- # attendance_obj.sudo().write({"is_abnormal": True})
- # else:
- # attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True})
- # elif planning_slot_id.template_id.planning_name == '夜值':
- # if exception_type != "未打卡":
- # if checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and not attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif attendance_obj.check_in and checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and checkin_time < attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif attendance_obj.check_out and checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and checkin_time > attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif checkin_time and exception_type != "未打卡" and not attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and exception_type != "未打卡" and attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif (datetime.time(9, 30) <= checkin_time <= datetime.time(23, 59, 59) or
- # datetime.time(0, 0) <= checkin_time <= datetime.time(6, 0)):
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "night_duty": False
- # })
- # elif attendance_obj.is_early_card or attendance_obj.is_late_card or attendance_obj.night_duty:
- # attendance_obj.sudo().write({"is_abnormal": True})
- # else:
- # attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True})
- # else:
- # if exception_type != "未打卡":
- # if checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and not attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif attendance_obj.check_in and checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and checkin_time < attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif attendance_obj.check_out and checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and checkin_time > attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif checkin_time and exception_type != "未打卡" and not attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and exception_type != "未打卡" and attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif attendance_obj.is_early_card or attendance_obj.is_late_card or attendance_obj.noon_duty:
- # attendance_obj.sudo().write({"is_abnormal": True})
- # else:
- # attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True})
- # elif planning_slot_id.department_id.name == '联安粮库':
- # attendance_obj = self.env['hr.attendance'].sudo().create({
- # 'employee_id': hr_employee_obj.id,
- # "userid": userid,
- # "current_data": current_data,
- # "shift_id": planning_slot_id.id,
- # "attendance_type": "wx_work"
- # })
- # if planning_slot_id.template_id.planning_name == '夜值':
- # if exception_type != "未打卡":
- # if checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and not attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif attendance_obj.check_in and checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and checkin_time < attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif attendance_obj.check_out and checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and checkin_time > attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif checkin_time and exception_type != "未打卡" and not attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and exception_type != "未打卡" and attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif (datetime.time(9, 30) <= checkin_time <= datetime.time(23, 59, 59) or
- # datetime.time(0, 0) <= checkin_time <= datetime.time(6, 0)):
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "night_duty": False
- # })
- # elif attendance_obj.is_early_card or attendance_obj.is_late_card or attendance_obj.noon_duty:
- # attendance_obj.sudo().write({"is_abnormal": True})
- # else:
- # attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True})
- # else:
- # if exception_type != "未打卡":
- # if checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and not attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif attendance_obj.check_in and checkin_time and checkin_type == "上班打卡" and exception_type != "未打卡" and checkin_time < attendance_obj.check_in:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif attendance_obj.check_out and checkin_time and checkin_type == "下班打卡" and exception_type != "未打卡" and checkin_time > attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif checkin_time and exception_type != "未打卡" and not attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_in_time": sch_checkin_time,
- # "check_in": checkin_time,
- # "is_late_card": checkin_time > planning_slot_id.start_datetime,
- # })
- # elif checkin_time and exception_type != "未打卡" and attendance_obj.check_in and not attendance_obj.check_out:
- # attendance_obj.sudo().write({
- # "sch_check_out_time": sch_checkin_time,
- # "check_out": checkin_time,
- # "is_early_card": planning_slot_id.end_datetime > checkin_time,
- # })
- # elif attendance_obj.is_early_card or attendance_obj.is_late_card:
- # attendance_obj.sudo().write({"is_abnormal": True})
- # else:
- # attendance_obj.sudo().write({"is_no_card": True, "is_abnormal": True})
- # # 进行关联
+ # 进行关联
attendance_detail_obj.hr_attendance_id = attendance_obj.id
return True
+
def get_hr_attendance_time(self):
"""
获取企业微信打卡数据的核心逻辑
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index 71528d000..b64ead976 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -134,8 +134,8 @@
sequence="10"/>
+ parent="hr_menu_root_board"
+ sequence="5"/>