添加功能

This commit is contained in:
李鹏宇
2025-09-10 15:06:51 +08:00
parent 6583c5817f
commit dcd649c443
5 changed files with 52 additions and 14 deletions
@@ -177,7 +177,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">soong.workflow.record</field>
<field name="view_mode">tree,kanban,search</field>
<field name="domain">[('reclaim_state', '=', False), '|', ('approvals_group_id.name', '=', '人力资源'), ('approvals_group_id.name', '=', '考勤')]</field>
<field name="domain">[('reclaim_state', '=', False), '|', ('approvals_group_id.name', '=', '人力资源'), ('approvals_group_id.name', '=', '考勤'), ('approve_state', '!=', 'start')]</field>
<field name="search_view_id" ref="soong_workflow_record_search"/>
</record>
<record id="soong_workflow_other_record_action" model="ir.actions.act_window">
+33 -6
View File
@@ -82,15 +82,42 @@ class GoApprovals(models.Model):
'approval_date': fields.Datetime.now(),
})
@api.depends('users_id', 'days', 'hours')
@api.depends('users_id', 'days', 'hours', 'statr_date', 'end_date', 'date_start', 'date_end', 'is_day', 'is_half',
'is_hour')
def _compute_name(self):
for rec in self:
if rec.is_hour == True:
rec.name = f"{rec.users_id.name}外出{rec.hours}小时"
elif rec.is_day == True:
rec.name = f"{rec.users_id.name}外出{rec.days}天"
base_name = f"{rec.users_id.name}外出"
date_info = ""
if rec.is_hour:
# 按小时
if rec.date_start and rec.date_end:
start_date = fields.Date.from_string(rec.date_start)
end_date = fields.Date.from_string(rec.date_end)
start_str = start_date.strftime('%Y-%m-%d')
end_str = end_date.strftime('%Y-%m-%d')
if start_date == end_date:
date_info = f"{start_str}共:{rec.hours}小时"
else:
date_info = f"{start_str}至{end_str}共:{rec.hours}小时"
elif rec.is_day or rec.is_half:
# 按天或半天
if rec.statr_date and rec.end_date:
start_str = rec.statr_date.strftime('%Y-%m-%d')
end_str = rec.end_date.strftime('%Y-%m-%d')
if rec.statr_date == rec.end_date:
date_part = start_str
else:
date_part = f"{start_str}至{end_str}"
if rec.is_day:
date_info = f"{date_part}共:{rec.days}天"
else:
date_info = f"{date_part}共:{rec.days}天"
if date_info:
rec.name = f"{base_name}{date_info}"
else:
rec.name = f"{rec.users_id.name}外出"
rec.name = base_name
@api.onchange('statr_date', 'end_date')
def _onchange_days(self):
@@ -22,7 +22,7 @@ class YuthonVacationReports(models.Model):
meal_fee_ids = fields.One2many('vacation.meal.line', 'vacation_id', string='误餐明细')
medical_fee_ids = fields.One2many('vacation.medical.line', 'vacation_id', string='体检费明细')
other_fee_ids = fields.One2many('vacation.other.line', 'vacation_id', string='其他明细')
vacation_date = fields.Date(string='日期', default=lambda self: fields.Date.today())
vacation_date = fields.Date(string='日期', default=lambda self: fields.Date.today().replace(day=1))
display_date = fields.Char(string='日期', compute='_compute_display_date')
done_leave = fields.Float(string='年假', compute='_compute_leave', store=True, digits=(16, 3), group_operator=None)
done_working_overtime = fields.Float(string='加班时', compute='_compute_working_overtime', digits=(16, 3),
@@ -172,8 +172,8 @@ class YuthonVacationReports(models.Model):
rec._compute_attendance_fields1()
def update_data(self):
august_start = fields.Date.from_string('2025-08-01')
august_end = fields.Date.from_string('2025-08-31')
august_start = fields.Date.from_string('2025-09-01')
august_end = fields.Date.from_string('2025-9-31')
august_records = self.env["yuthon.vacation.reports"].search([
('vacation_date', '>=', august_start),
('vacation_date', '<=', august_end)
@@ -13,6 +13,12 @@
<!-- <button name="button_all" string="班次更新" type="object" class="btn btn-primary"/>-->
<button name="compute_attendance_ids" string="重新计算" type="object" class="btn btn-primary"/>
<button name="state_fix" string="状态修正" type="object" class="btn btn-primary" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
<button name="unlink"
string="删除"
type="object"
icon="fa-trash"
groups="yuthon_hr_attendance.group_he_attendance_sign_manager"
confirm="确定要删除选中的记录吗?"/>
</header>
<field name="employee_id" class="list_current_data" options="{'no_create': True}"/>
<field name="current_data" optional="show" class="list_current_data"/>
@@ -39,8 +45,8 @@
<field name="is_workflow" optional="hidden"/>
<field name="workflow_id" optional="hidden"/>
<button name="button_controls_wizard" type="object" string="操作" class="oe_highlight" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)"/>
<button name="button_correct_wizard" type="object" string="修正" class="btn btn-primary" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)" groups="base.group_system"/>
<button name="revoke" type="object" string="撤销" class="btn btn-primary" invisible="not (is_check_out_red or is_check_in_red)" groups="base.group_system"/>
<button name="button_correct_wizard" type="object" string="修正" class="btn btn-primary" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
<button name="revoke" type="object" string="撤销" class="btn btn-primary" invisible="not (is_check_out_red or is_check_in_red)" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
<button name="button_workflow" type="object" string="流程" class="oe_highlight" invisible="not is_workflow"/>
<button name="button_source" type="object" string="详情" class="oe_highlight" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
</tree>
@@ -80,8 +86,8 @@
<field name="is_check_in_red" column_invisible="1"/>
<field name="is_check_out_red" column_invisible="1"/>
<button name="button_controls_wizard" type="object" string="操作" class="oe_highlight" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)"/>
<button name="button_correct_wizard" type="object" string="修正" class="btn btn-primary" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)" groups="base.group_system"/>
<button name="revoke" type="object" string="撤销" class="btn btn-primary" invisible="not (is_check_out_red or is_check_in_red)" groups="base.group_system"/>
<button name="button_correct_wizard" type="object" string="修正" class="btn btn-primary" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
<button name="revoke" type="object" string="撤销" class="btn btn-primary" invisible="not (is_check_out_red or is_check_in_red)" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
<button name="button_source" type="object" string="详情" class="oe_highlight" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
</tree>
</field>
@@ -130,6 +130,11 @@ class YuthonMessageLogin(models.Model):
degree_id_ids = fields.One2many('education.details.line2', 'degree_id', string="学位证")
certificate_ids = fields.One2many('certificates.detail.line', 'certificate_id', string="专业证书")
@api.onchange('staff_name')
def _onchange_staff_name(self):
if self.staff_name:
self.name = '人员信息登记表'+ '-' + self.staff_name
@api.onchange('is_issues')
def _onchange_is_issues(self):
if self.is_issues: