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

# Conflicts:
#	yuthon_property_approval/models/property_lease_contract.py
#	yuthon_property_approval/views/property_lease_contract.xml
This commit is contained in:
ljmwkx
2024-12-20 13:43:03 +08:00
13 changed files with 90 additions and 346 deletions
+1 -1
View File
@@ -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)
@@ -5,7 +5,7 @@
<field name="name">soong.workflow.log.tree</field>
<field name="model">soong.workflow.log</field>
<field name="arch" type="xml">
<tree string="工作流日志">
<tree string="工作流日志" default_order="lase_click_date desc">
<field name="name"/>
<field name="model"/>
<field name="res_id"/>
+1 -1
View File
@@ -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')])
+3 -3
View File
@@ -36,9 +36,6 @@
<field name="department_id" invisible="1"/>
<field name="is_issues" invisible="1"/>
</group>
<group>
<field name="details" readonly="1"/>
</group>
</group>
<group string="按天请假" invisible="not is_day"/>
<field name="leave_ids" invisible="not is_day"
@@ -128,6 +125,9 @@
<field name="custom_document_ids" widget="preview_many2many" options="{'show_select_btn': false}"/>
</tree>
</field>
<group>
<field name="details" readonly="1"/>
</group>
</sheet>
</form>
</field>
+3 -2
View File
@@ -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 = '水表'
@@ -29,6 +29,7 @@
<group string="基本信息">
<group>
<field name="name" required="1"/>
<field name="lessee_id"/>
<field name="premises"/>
<field name="units"/>
<field name="house_type_id"/>
@@ -65,7 +66,7 @@
</group>
<group string="属性价值" col="2">
<group>
<field name="yuthon_company" readonly="1"/>
<field name="yuthon_company"/>
<field name="admin_id"/>
<field name="purpose_id"/>
<field name="mgmt_type_id"/>
@@ -119,7 +120,7 @@
<field name="purpose_id"/>
<field name="precinct"/>
<field name="admin_id"/>
<field name="yuthon_company" readonly="1"/>
<field name="yuthon_company"/>
<field name="start_time"/>
<field name="end_date"/>
</tree>
@@ -188,7 +189,6 @@
<searchpanel>
<field name="mgmt_type_id" string="管理类型"/>
<field name="yuthon_company" string="所属公司"/>
<field name="admin_id" string="管理员"/>
</searchpanel>
</search>
</field>
@@ -225,6 +225,10 @@
<span>管理员:</span>
<field name="admin_id"/>
</div>
<div>
<span>承租方:</span>
<field name="lessee_id"/>
</div>
</div>
</div>
<div name="tags"/>
@@ -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 = '物业列表明细行'
@@ -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="报价结束日期")
@@ -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 = '物业拆分明细行'
@@ -60,8 +60,9 @@
<field name="lease_term_month"/>
<field name="lease_term_month_uom" />
</div>
<field name="cycle_dict"/>
<field name="cycle_mode"/>
<field name="term_start_time"/>
<field name="term_end_time" />
</group>
<group>
<field name="expected_reminders"/>
@@ -81,9 +82,9 @@
<field name="increments_every_few_years"/>
</group>
<group>
<field name="term_start_time" />
<field name="term_end_time" />
<field name="total_area" />
<field name="cycle_dict"/>
<field name="cycle_mode"/>
</group>
<group>
<field name="breach_time"/>
@@ -92,23 +93,18 @@
</group>
<group>
<field name="unit_price"/>
<field name="management_fee"/>
<field name="water"/>
<field name="tax"/>
</group>
<group>
<field name="tariff"/>
<field name="deposit"/>
<field name="first_year_rent"/>
<field name="miscellaneous"/>
</group>
<group>
<field name="total_contract_receivables"/>
<field name="tax_rate"/>
<field name="not_tax_amount"/>
</group>
<group>
<field name="tax"/>
<field name="miscellaneous"/>
</group>
</group>
<notebook>
<page string="物业列表">
@@ -37,6 +37,8 @@
<field name="units"/>
<field name="property_floor"/>
<field name="asset_type_id"/>
<field name="split_quantity"/>
<button name="property_split_button" type="object" string="拆分" class="btn-primary"/>
</group>
<group>
<field name="building_area"/>
@@ -44,9 +46,6 @@
<field name="remarks"/>
</group>
</group>
<group>
<field name="split_quantity"/>
</group>
<notebook>
<page string="拆分信息">
<field name="property_split_approval_line_ids">
+40 -294
View File
@@ -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):
"""
获取企业微信打卡数据的核心逻辑
+2 -2
View File
@@ -134,8 +134,8 @@
sequence="10"/>
<menuitem id="hr_set_process_menu_root_board"
name="流程"
parent="hr_employee_menu_root_board"
sequence="11"/>
parent="hr_menu_root_board"
sequence="5"/>
<menuitem id="hr_menu_regularization_approval_root_board"
name="转正申请表"
parent="hr_set_process_menu_root_board"