同步考勤数据,累计欠收报表
This commit is contained in:
@@ -218,67 +218,30 @@ class HrLeaveAllocation(models.Model):
|
||||
leave_ids = self.env["hr.leave.allocation"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for leave in leave_ids:
|
||||
leave_list = []
|
||||
compensatory_list = []
|
||||
if leave.holiday_status_id.name != '年假':
|
||||
continue
|
||||
|
||||
vacation_date = leave.date_from.replace(day=1) if leave.date_from else fields.Date.today().replace(day=1)
|
||||
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', leave.employee_id.id),
|
||||
('vacation_date', '=', leave.date_from)
|
||||
('vacation_date', '=', vacation_date)
|
||||
], limit=1)
|
||||
other_list = []
|
||||
|
||||
if leave.holiday_status_id.name == '年假':
|
||||
current_leave_hours = leave.number_of_days * 8
|
||||
existing_leave_line = False
|
||||
if reports_id and reports_id.leave_ids:
|
||||
existing_leave_line = reports_id.leave_ids.filtered(
|
||||
lambda l: l.text == '上月额度继承'
|
||||
)[:1]
|
||||
if existing_leave_line:
|
||||
update_leave_vals = {
|
||||
'valid_date': leave.date_to,
|
||||
}
|
||||
existing_leave_line.write(update_leave_vals)
|
||||
|
||||
leave_list.append([0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'update_date': fields.Datetime.now(),
|
||||
'valid_date': leave.date_from,
|
||||
'update_lines': current_leave_hours,
|
||||
'text': '年假分配'
|
||||
}])
|
||||
|
||||
elif leave.holiday_status_id.name == '补休':
|
||||
compensatory_list.append([0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'employee_id': reports_id.employee_id.id,
|
||||
'update_type': 'add',
|
||||
'valid_date': leave.date_from,
|
||||
'workday': leave.number_of_hours_display,
|
||||
'legal_day': 0,
|
||||
'public_holidays': 0,
|
||||
'meal_number': 0,
|
||||
'text': f"上月额度继承"
|
||||
}])
|
||||
else:
|
||||
other_list.append([0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'holiday_type': leave.holiday_status_id.id,
|
||||
'employee_id': leave.employee_id.id,
|
||||
'update_date': fields.Date.today(),
|
||||
'update_type': 'add',
|
||||
'lines': leave.number_of_hours_display / 8,
|
||||
'text': leave.name
|
||||
}])
|
||||
|
||||
|
||||
if reports_id:
|
||||
leave_hours = leave.number_of_days_display * 8
|
||||
reports_id.write({
|
||||
'leave_ids': leave_list,
|
||||
'year_distribution': leave.number_of_days,
|
||||
'valid_date': leave.date_to,
|
||||
'overtime_ids': compensatory_list,
|
||||
'other_fee_ids': other_list
|
||||
'leave_ids': [(0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'update_date': fields.Datetime.now(),
|
||||
'valid_date': leave.date_from,
|
||||
'update_lines': leave_hours,
|
||||
'text': '年假分配'
|
||||
})]
|
||||
})
|
||||
reports_id.update_line()
|
||||
|
||||
def update_employee(self):
|
||||
leave_ids = self.env["hr.leave.allocation"].browse(
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<field name="code">action = model.action_uninstall_wizard()</field>
|
||||
</record>
|
||||
<record id="all_holiday_update_vacation" model="ir.actions.server">
|
||||
<field name="name">更新报表</field>
|
||||
<field name="name">同步考勤数据</field>
|
||||
<field name="model_id" ref="hr_holidays.model_hr_leave_allocation"/>
|
||||
<field name="binding_model_id" ref="hr_holidays.model_hr_leave_allocation"/>
|
||||
<field name="state">code</field>
|
||||
|
||||
@@ -11,8 +11,8 @@ class CumArrearsReport(models.Model):
|
||||
def get_cum_arrears_report(self, params):
|
||||
"""
|
||||
累计欠收报表(数据源:receivable.modify.line):
|
||||
- 状态为挂账(bank_state = 'registered')
|
||||
- 应收开始日期(receivable_id.due_date)小于等于查询月月末
|
||||
- 未收金额大于0(not_collected > 0)
|
||||
- 排除押金和违约金类型
|
||||
- 金额取 not_collected(未收)
|
||||
"""
|
||||
@@ -29,9 +29,9 @@ class CumArrearsReport(models.Model):
|
||||
month_end = query_date.replace(day=last_day)
|
||||
|
||||
domain = [
|
||||
('bank_state', '=', 'registered'),
|
||||
('receivable_id.due_date', '<=', month_end),
|
||||
('receivable_id.is_invalid', '=', False),
|
||||
('not_collected', '>', 0),
|
||||
]
|
||||
|
||||
keyword = params.get("keyword")
|
||||
@@ -57,6 +57,7 @@ class CumArrearsReport(models.Model):
|
||||
if management_type_id:
|
||||
domain.append(('receivable_id.management_type_id', '=', management_type_id))
|
||||
else:
|
||||
# 排除押金和违约金类型
|
||||
domain.append(('receivable_id.management_type_id.name', 'not in', ['押金', '违约金']))
|
||||
|
||||
lines = self.search(domain, order="receivable_id asc")
|
||||
|
||||
Reference in New Issue
Block a user