Merge pull request !5223 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-09-18 08:40:15 +00:00
committed by Gitee
3 changed files with 32 additions and 5 deletions
+22
View File
@@ -43,6 +43,28 @@ class HrLeave(models.Model):
# if previous_emp_data != emp_data and len(emp_data) >= len(previous_emp_data):
# raise ValidationError("您的假期额度不足,无法申请该假期")
leave_hours = fields.Float(string='请假小时', default=0.0)
@api.onchange('request_hour_from', 'leave_hours')
def _onchange_request_hour_to(self):
if not (self.request_hour_from and self.leave_hours is not None):
self.request_hour_to = False
return
start_hour = float(self.request_hour_from)
leave_hours = float(self.leave_hours)
end_hour = (start_hour + leave_hours) % 24.0
end_hour_rounded = round(end_hour * 2) / 2
if end_hour_rounded.is_integer():
end_hour_key = str(int(end_hour_rounded))
else:
end_hour_key = str(end_hour_rounded)
selection_keys = [k for k, v in self._fields['request_hour_to'].selection]
if end_hour_key in selection_keys:
self.request_hour_to = end_hour_key
else:
self.request_hour_to = False
def action_leave_wizard(self):
return {
+2 -1
View File
@@ -133,6 +133,7 @@
'holiday_status_id_default_request_unit': 'hour'
}">
<tree editable="bottom">
<field name="leave_hours"/>
<field name="employee_id" readonly="1" force_save="1" column_invisible="1"/>
<field name="state" column_invisible="True"/>
<field name="employee_company_id" column_invisible="True"/>
@@ -163,7 +164,7 @@
<field name="request_hour_from_real" column_invisible="True"/>
<field name="request_hour_to" width="200px"/>
<field name="request_date_to" column_invisible="True"/>
<field name="number_of_hours_text" string="小时" width="100px"/>
<field name="number_of_hours_text" string="小时" width="100px" column_invisible="True"/>
<field name="leave_documents_ids" widget="preview_many2many" options="{'preview_type': 'button', 'preview_string': ' '}" string=" " width="100px" readonly="1"/>
<field name="number_of_days_display" column_invisible="True"/>
</tree>
@@ -780,7 +780,9 @@ class AppletAttendance(Controller):
'address': address,
'building': building,
'floor': floor,
'room': room
'room': room,
'epitope_values':electric.epitope_values,
'unit_number':electric.unit_number,
})
# 处理水表
@@ -812,14 +814,16 @@ class AppletAttendance(Controller):
'address': address,
'building': building,
'floor': floor,
'room': room
'room': room,
'epitope_values':water.epitope_values,
'unit_number':water.unit_number
})
# 按“楼盘->楼层”分组
building_floor_map = {}
for record in all_records:
building_name = record['building']
floor_name = record['floor']
floor_name = record['epitope_values']
# 初始化楼盘分组(空楼盘名也作为有效分组)
if building_name not in building_floor_map:
@@ -830,7 +834,7 @@ class AppletAttendance(Controller):
building_floor_map[building_name][floor_name] = []
# 移除building和floor字段,只保留数据项
record_data = {k: v for k, v in record.items() if k not in ['building', 'floor']}
record_data = {k: v for k, v in record.items() if k not in ['building', 'epitope_values']}
building_floor_map[building_name][floor_name].append(record_data)
# 组装最终返回结构