添加功能
This commit is contained in:
@@ -185,6 +185,7 @@ class YuthonOnboardApproval(models.Model):
|
||||
marital = 'single'
|
||||
else:
|
||||
marital = 'married'
|
||||
|
||||
resource_calendar_id = self.env['resource.calendar'].search([('company_id', '=', self.company_id.id)], limit=1)
|
||||
employee_id = self.env['hr.employee'].create({'name': self.information_form_id.staff_name,
|
||||
'birthday': login_id.date_birth,
|
||||
@@ -205,6 +206,23 @@ class YuthonOnboardApproval(models.Model):
|
||||
})
|
||||
# employee_id.send_wecom_employee()
|
||||
employee_id.create_user()
|
||||
if self.job_id.name not in ['董事长', '总经理', '副总经理']:
|
||||
applet_security = self.env['applet.security.setting'].sudo().search([
|
||||
('employee_id', '=', employee_id.id)
|
||||
], limit=1)
|
||||
if not applet_security:
|
||||
permission_names = [
|
||||
'考勤确认单', '打卡', '日程', '通知公告', '薪资条',
|
||||
'关于', '我的', '党费', '个人', '考勤汇总'
|
||||
]
|
||||
permission_ids = self.env['applet.security.setting'].sudo().search([
|
||||
('name', 'in', permission_names)
|
||||
]).ids
|
||||
self.env['applet.security.setting'].sudo().create({
|
||||
'employee_id': employee_id.id,
|
||||
'applet_security_setting_ids': [(6, 0, permission_ids)] # 绑定10个权限
|
||||
})
|
||||
|
||||
if self.contract_type == 'internship':
|
||||
salary = self.salary
|
||||
else:
|
||||
|
||||
@@ -431,56 +431,56 @@ class PropertyBankStatements(models.Model):
|
||||
vals_list = []
|
||||
current_sequence = sequence_val
|
||||
type_name = collection_type_map.get(collection_type_val, '')
|
||||
# 特殊处理:押金类型需要去重相同合同的记录
|
||||
if collection_type_val == 'deposit':
|
||||
# 使用字典来跟踪已处理的合同ID
|
||||
processed_contracts = set()
|
||||
for sub_record in ids:
|
||||
contract_id = sub_record.contract_id.id if sub_record.contract_id else False
|
||||
original_amount = sub_record.original_amount if sub_record.original_amount else 0
|
||||
submitted = sub_record.submitted if sub_record.submitted else 0
|
||||
# 跳过已处理的合同
|
||||
if contract_id and contract_id in processed_contracts:
|
||||
continue
|
||||
# 获取合同的实际结束日期作为到期日
|
||||
due_date = False
|
||||
if contract_id:
|
||||
due_date = sub_record.contract_id.actual_start_time
|
||||
# 构建对账行数据
|
||||
vals = {
|
||||
'contract_id': contract_id,
|
||||
'rent_month': original_amount,
|
||||
'rent': submitted,
|
||||
'collection_type': collection_type_val,
|
||||
'sequence': current_sequence,
|
||||
'due_date': due_date, # 押金类型使用合同实际开始日期
|
||||
}
|
||||
total_rent_month += original_amount # 累加总金额
|
||||
vals_list.append((0, 0, vals))
|
||||
# 标记此合同已处理
|
||||
if contract_id:
|
||||
processed_contracts.add(contract_id)
|
||||
# # 特殊处理:押金类型需要去重相同合同的记录
|
||||
# if collection_type_val == 'deposit':
|
||||
# # 使用字典来跟踪已处理的合同ID
|
||||
# processed_contracts = set()
|
||||
# for sub_record in ids:
|
||||
# contract_id = sub_record.contract_id.id if sub_record.contract_id else False
|
||||
# original_amount = sub_record.original_amount if sub_record.original_amount else 0
|
||||
# submitted = sub_record.submitted if sub_record.submitted else 0
|
||||
# # 跳过已处理的合同
|
||||
# if contract_id and contract_id in processed_contracts:
|
||||
# continue
|
||||
# # 获取合同的实际结束日期作为到期日
|
||||
# due_date = False
|
||||
# if contract_id:
|
||||
# due_date = sub_record.contract_id.actual_start_time
|
||||
# # 构建对账行数据
|
||||
# vals = {
|
||||
# 'contract_id': contract_id,
|
||||
# 'rent_month': original_amount,
|
||||
# 'rent': submitted,
|
||||
# 'collection_type': collection_type_val,
|
||||
# 'sequence': current_sequence,
|
||||
# 'due_date': due_date, # 押金类型使用合同实际开始日期
|
||||
# }
|
||||
# total_rent_month += original_amount # 累加总金额
|
||||
# vals_list.append((0, 0, vals))
|
||||
# # 标记此合同已处理
|
||||
# if contract_id:
|
||||
# processed_contracts.add(contract_id)
|
||||
#
|
||||
# current_sequence += 10
|
||||
# else:
|
||||
# # 非押金类型:正常处理每条记录
|
||||
for sub_record in ids:
|
||||
contract_id = sub_record.contract_id.id if sub_record.contract_id else False
|
||||
original_amount = sub_record.original_amount if sub_record.original_amount else 0
|
||||
submitted = sub_record.submitted if sub_record.submitted else 0
|
||||
due_date = sub_record.due_date if sub_record.due_date else False
|
||||
vals = {
|
||||
'contract_id': contract_id,
|
||||
'rent_month': original_amount,
|
||||
'rent': submitted,
|
||||
'collection_type': collection_type_val,
|
||||
'sequence': current_sequence,
|
||||
'due_date': due_date,
|
||||
}
|
||||
total_rent_month += original_amount # 累加总金额
|
||||
vals_list.append((0, 0, vals))
|
||||
|
||||
current_sequence += 10
|
||||
else:
|
||||
# 非押金类型:正常处理每条记录
|
||||
for sub_record in ids:
|
||||
contract_id = sub_record.contract_id.id if sub_record.contract_id else False
|
||||
original_amount = sub_record.original_amount if sub_record.original_amount else 0
|
||||
submitted = sub_record.submitted if sub_record.submitted else 0
|
||||
due_date = sub_record.due_date if sub_record.due_date else False
|
||||
vals = {
|
||||
'contract_id': contract_id,
|
||||
'rent_month': original_amount,
|
||||
'rent': submitted,
|
||||
'collection_type': collection_type_val,
|
||||
'sequence': current_sequence,
|
||||
'due_date': due_date,
|
||||
}
|
||||
total_rent_month += original_amount # 累加总金额
|
||||
vals_list.append((0, 0, vals))
|
||||
|
||||
current_sequence += 10
|
||||
current_sequence += 10
|
||||
|
||||
if vals_list and type_name:
|
||||
used_type_names.add(type_name)
|
||||
|
||||
Reference in New Issue
Block a user