!5582 添加功能

Merge pull request !5582 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-10-12 03:03:20 +00:00
committed by Gitee
6 changed files with 31 additions and 6 deletions
@@ -15,6 +15,7 @@ class AttendanceIotManager(models.Model):
attendance_iot_id = fields.Many2one('attendance.iot', string="设备号")
attendance_address = fields.Char(string="设备地址")
data_selection = fields.Selection([('mqtt', 'mqtt'), ('api', 'api')], default="mqtt", string="数据类型")
remarks = fields.Text(string='备注')
def action_attendance_iot_manager(self):
return {
@@ -8,6 +8,7 @@
<field name="attendance_iot_id"/>
<field name="attendance_address"/>
<field name="data_selection" required="1"/>
<field name="remarks"/>
<button name="employee_message" string="员工数据" type="object" class="oe_highlight"/>
</tree>
</field>
@@ -120,7 +120,6 @@ class YuthonVacationReports(models.Model):
return action
def confirm_state(self):
for rec in self:
rec.vacation_state = 'confirmed'
@@ -130,7 +129,6 @@ class YuthonVacationReports(models.Model):
next_month_date = current_date.replace(year=current_date.year + 1, month=1, day=1)
else:
next_month_date = current_date.replace(month=current_date.month + 1, day=1)
# 查找下个月是否已有该员工的记录
next_month_record = self.search([
('employee_id', '=', rec.employee_id.id),
@@ -225,8 +223,11 @@ class YuthonVacationReports(models.Model):
records = self.env["yuthon.vacation.reports"].browse(
self._context.get('active_ids', self._context.get('active_id', self.ids))
)
august_start = fields.Date.from_string('2025-10-01')
for rec in records:
rec._compute_attendance_fields1()
rec.write({
'vacation_date': august_start,
})
def update_data(self):
august_start = fields.Date.from_string('2025-09-01')
@@ -612,7 +613,7 @@ class YuthonVacationReports(models.Model):
# 创建本月报告主记录(包含继承的值)
new_report = self.create({
'employee_id': employee.id,
'vacation_date': today,
'vacation_date': current_month_first,
**inherit_vals
})
@@ -630,7 +631,7 @@ class YuthonVacationReports(models.Model):
# 如果没有已确认的上月记录,创建空的本月报告
self.create({
'employee_id': employee.id,
'vacation_date': today,
'vacation_date': current_month_first,
})
def _update_leave_lines(self, report, allocations, number_of_hours_display):
@@ -338,7 +338,7 @@ class YuthonHrEmployee(models.Model):
@api.onchange('user_role_id')
def _onchange_user_role_id(self):
if self.user_role_id and self.id:
if self.user_role_id:
user_id = self.env['soong.user.role'].search([('id', '=', self.user_role_id.id)])
user_id.write({'personnel_ids': [(4, self.id.origin)]})
@@ -218,6 +218,14 @@ class YuthonOnboardApproval(models.Model):
'is_probation': True,
})
vacation_date = self.duration_employment.replace(day=1)
self.env['yuthon.vacation.reports'].search([('employee_id', '=', employee_id.id), ('vacation_date', '=', self.vacation_date)])
if not vacation_date:
self.env['yuthon.vacation.reports'].create({
'employee_id': employee_id.id,
'vacation_date': vacation_date,
})
@api.onchange('employee_name')
def _onchange_employee_id(self):
for record in self:
@@ -784,13 +784,27 @@
<field name="lessee_id"/>
<field name="contract_code"/>
<field name="property_name"/>
<field name="property_id"/>
<field name="lessor_id"/>
<field name="tenure_type"/>
<group expand="0" string="Group By">
<filter name="group_by_lessor_id" context="{'group_by': 'lessor_id'}"/>
<filter name="group_by_tenure_type" context="{'group_by': 'tenure_type'}"/>
<filter name="group_by_condition" context="{'group_by': 'condition'}"/>
<filter name="group_by_lessee_id" context="{'group_by': 'lessee_id'}"/>
<filter name="group_by_lessor_id" context="{'group_by': 'lessor_id'}"/>
<filter name="group_by_admin_id" context="{'group_by': 'admin_id'}"/>
<filter name="group_by_title_address" context="{'group_by': 'title_address'}"/>
</group>
<header_search>
<quick_filter string="状态">
<filter string="待执行" name="to" domain="[('contact_state', '=', 'to')]" />
<filter string="已执行" name="complete" domain="[('contact_state', '=', 'complete')]" />
<filter string="已作废" name="done" domain="[('contact_state', '=', 'terminate')]"/>
<filter string="历史" name="early" domain="[('contact_state', '=', 'early_termination')]"/>
<filter string="即将到期" name="reclaim" domain="[('expiration_coming', '=', 'coming')]"/>
</quick_filter>
</header_search>
</search>
</field>
</record>