!6214 添加功能

Merge pull request !6214 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-11-05 12:07:27 +00:00
committed by Gitee
2 changed files with 19 additions and 4 deletions
@@ -223,9 +223,9 @@ class HrLeaveAllocation(models.Model):
'vacation_date': date 'vacation_date': date
}) })
reports_id.write({'leave_ids': leave_list}) reports_id.write({'leave_ids': [(5, 0, 0)] + leave_list})
reports_id.write({'overtime_ids': compensatory_list}) reports_id.write({'overtime_ids': [(5, 0, 0)] + compensatory_list})
reports_id.write({'other_fee_ids': other_list}) reports_id.write({'other_fee_ids': [(5, 0, 0)] + other_list})
# def allocation_date(self): # def allocation_date(self):
# date = datetime(2025, 1, 1) # date = datetime(2025, 1, 1)
# leave_id = self.env['hr.leave.allocation'].search([]) # leave_id = self.env['hr.leave.allocation'].search([])
@@ -185,8 +185,22 @@ class PropertyRentalWizard(models.Model):
adjusted_day = min(start_day, max_day) adjusted_day = min(start_day, max_day)
date_str = f"{date_field_year_month}-{adjusted_day}" date_str = f"{date_field_year_month}-{adjusted_day}"
start_date = datetime.strptime(date_str, "%Y-%m-%d").date() start_date = datetime.strptime(date_str, "%Y-%m-%d").date()
# 判断是否是最新合同版本
new_version = True
all_versions = self.env['property.lease.contract'].search([
('contract_code', '=', record.contract_code)
])
if all_versions:
version_info = []
for ver in all_versions:
version_num = float(ver.version.lstrip('Vv'))
version_info.append((ver.id, version_num))
max_version_id = max(version_info, key=lambda x: x[1])[0]
if record.id != max_version_id:
new_version = False
# 当期应收日期 # 当期应收日期
if not record.is_contract: if not record.is_contract and new_version:
if start_year_month <= date_field_year_month <= end_year_month: if start_year_month <= date_field_year_month <= end_year_month:
if rent_id.period_rent != 0 and record.contract_sort not in ['guanggao', 'guanzi', 'room']: if rent_id.period_rent != 0 and record.contract_sort not in ['guanggao', 'guanzi', 'room']:
self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier) self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier)
@@ -211,6 +225,7 @@ class PropertyRentalWizard(models.Model):
records = self.env['property.lease.contract'].search([ records = self.env['property.lease.contract'].search([
('actual_start_time', '<', next_month_first_day), ('actual_start_time', '<', next_month_first_day),
('actual_end_time', '>=', first_day), ('actual_end_time', '>=', first_day),
('state', '=', 'done')
]) ])
for record in records: for record in records:
# 获取租金乘数(1 表示按月,3 表示季租金,6 表示半年租金,年后面赋值) # 获取租金乘数(1 表示按月,3 表示季租金,6 表示半年租金,年后面赋值)