添加功能

This commit is contained in:
zhou
2025-05-15 11:53:43 +08:00
parent 7abb28adec
commit 8b3c4f54d5
7 changed files with 133 additions and 40 deletions
@@ -10,7 +10,9 @@ class YuthonEmergencyContactLine(models.Model):
message_login_id = fields.Many2one('yuthon.message.login', string="关联信息登记")
name = fields.Char(string="姓名")
user_sfz = fields.Char(string="身份证")
user_relationship = fields.Selection([("parents", "父母"), ("children", "子女"), ("spouse", "配偶"), ("spouse", "其他")], string="关系")
user_relationship = fields.Selection([("father", "父亲"), ("sisters", "姐妹"), ("spouse", "妻子"), ("daughter", "母女"),
('husband', '丈夫'), ('sister', '姐姐'), ('brother', '兄弟'), ('sister_do', '妹妹'),
('siblings', '姐弟'), ('mother', '母亲'), ('daughter', '母女')], string="关系")
workplace = fields.Char(string="工作单位")
post = fields.Char(string="岗位")
phone_number = fields.Char(string="手机号")
+127 -29
View File
@@ -171,37 +171,135 @@ class YuthonHrEmployeeWizard(models.Model):
# employee_name.write({
# 'skills_certificates_ids': [(0, 0, certificate_data)]
# })
def employee_date(self, value):
date = pd.to_datetime(value, unit='d', origin='1899-12-30').date()
return date
def salary_group_import(self,row):
employee_id = self.env['hr.employee'].search([('name', '=', row[0].value)])
social_base_on = row[2].value if row[2].value else None
social_base_off = row[3].value if row[3].value else None
last_year_salary = row[3].value if row[3].value else None
employee_date = {
'social_base_on': social_base_on,
'social_base_off': social_base_off,
'last_year_salary':last_year_salary,
}
if employee_id:
employee_id.write(employee_date)
def update_bank_account(self,row):
employee_id = self.env['hr.employee'].search([('name', '=', row[2].value)])
bank_account_id = self.env['res.partner.bank'].search([('acc_number', '=', row[1].value)])
partner_id = self.env['res.partner'].search([('name', '=', row[2].value)], limit=1)
if not partner_id:
partner_id = self.env['res.partner'].create({
'name': row[2].value,
'phone': employee_id.mobile_phone,
'email': employee_id.work_email,
'company_id' : employee_id.company_id.id,
})
if not bank_account_id:
bank_account_id = self.env['res.partner.bank'].create({
'acc_number': row[1].value,
'partner_id': partner_id.id,
contacts_list = []
employee_id = self.env['hr.employee'].search([('name', '=', row[1].value)])
company_id = self.env['res.company'].search([('name', '=', row[0].value)])
work_phone = row[4].value
mobile_phone = row[5].value
if row[6].value:
entry_date = self.employee_date(row[6].value)
else:
entry_date = None
if row[7].value:
confirmation_date = self.employee_date(row[7].value)
else:
confirmation_date = None
identification_id = row[9].value
if row[10].value:
user_number_start_time = self.employee_date(row[10].value)
else:
user_number_start_time = None
if row[11].value and row[11].value != "长期":
user_number_end_time = self.employee_date(row[11].value)
else:
user_number_end_time = None
user_type = row[17].value
if row[18].value:
retire_date = self.employee_date(row[18].value)
else:
retire_date = None
political_aspects_dict = {'中共党员': 'cpc_dang', '民盟': 'nld', '共青团员': 'league_member', '群众': 'people',
'': ''}
political_aspects = political_aspects_dict[row[20].value]
if row[21].value and row[21].value != "/":
dang_data = self.employee_date(row[21].value)
else:
dang_data = None
user_origin = row[22].value
user_location = row[23].value
if row[26].value:
open_start_time = self.employee_date(row[26].value)
else:
open_start_time = None
interrupt_work_month = row[27].value
cumulative_work_month = row[28].value
high_degree = row[29].value
high_degree2 = row[30].value
graduate_school = row[31].value
profession = row[32].value
job_lv = row[33].value
contract_id = self.env['hr.contract'].search([('employee_id', '=', employee_id.id)])
if row[24].value:
date_start = self.employee_date(row[24].value)
else:
date_start = None
date_end = row[25].value
if date_end == '无固定期限':
date_end = False
else:
date_end = self.employee_date(date_end)
contract_type_id = self.env['hr.contract.type'].search([('name', '=', row[34].value)])
if contract_id:
contract_id.write({
'date_start': date_start,
'date_end': date_end,
'contract_type_id': contract_type_id.id,
})
name = row[36].value
relationship_dict = {
'父亲': 'father',
'姐妹': 'sisters',
'妻子': 'spouse',
'女儿': 'daughter',
'丈夫': 'husband',
'姐姐': 'sister',
'兄弟': 'brother',
'妹妹': 'sister_do',
'父母': 'parents',
'子女': 'children',
'姐弟': 'siblings',
'母亲': 'mother',
'母女': 'daughter',
}
if row[37].value:
user_relationship = relationship_dict[row[37].value]
else:
user_relationship = False
phone_number = row[38].value
archiving_agency = row[39].value
contacts_list.append([0, 0, {'name': name,
'user_relationship': user_relationship,
'phone_number': phone_number,
}])
write_uid = self.env['res.users'].search([('id', '=', employee_id.user_id.id)])
#
employee_date= {
'company_id': company_id.id,
'work_phone': work_phone,
'mobile_phone': mobile_phone,
'entry_date': entry_date,
'dang_data':dang_data,
'confirmation_date': confirmation_date,
'user_number_start_time': user_number_start_time,
'user_number_end_time': user_number_end_time,
'retire_date': retire_date,
'open_start_time': open_start_time,
'identification_id': identification_id,
'user_type': user_type,
'political_aspects': political_aspects,
'user_origin': user_origin,
'user_location': user_location,
'interrupt_work_month': interrupt_work_month,
'cumulative_work_month': cumulative_work_month,
'high_degree': high_degree,
'high_degree2': high_degree2,
'graduate_school': graduate_school,
'profession': profession,
'job_lv': job_lv,
'write_uid': write_uid,
'archiving_agency': archiving_agency,
'emergency_contact_ids': contacts_list,
}
#
if employee_id:
employee_id.write({
'bank_account_id': bank_account_id.id,
})
employee_id.write(employee_date)
-7
View File
@@ -72,14 +72,7 @@ class IssueLibrary(models.Model):
#
def _search_part_of_department(self, operator, value):
if operator not in ('=', '!=') or not isinstance(value, bool):
raise UserError(_('Operation not supported'))
user_employee = self._get_valid_employee_for_user()
# Double negation
if not value:
operator = '!=' if operator == '=' else '='
if not user_employee.department_id:
return [('id', operator, user_employee.id)]
return (['!'] if operator == '!=' else []) + [('department_id', '=', user_employee.department_id.id)]
def _get_default_name_title(self):
+3 -3
View File
@@ -4,19 +4,19 @@
<record id="salary_year_wizard_downloads_tianhetouzi_action" model="ir.actions.act_url">
<field name="name">天河投资模板下载</field>
<field name="target">self</field>
<field name="url">/yuthon_salary/static/others/salary_year_thtz.xlsx</field>
<field name="url">/yuthon_salary/static/others/年终奖(天河投资).xlsx</field>
</record>
<!-- 天河物管模板下载动作 -->
<record id="salary_year_wizard_downloads_tianhewuguan_action" model="ir.actions.act_url">
<field name="name">天河物管模板下载</field>
<field name="target">self</field>
<field name="url">/yuthon_salary/static/others/salary_year_thwg.xlsx</field>
<field name="url">/yuthon_salary/static/others/年终奖(天河物管).xlsx</field>
</record>
<!-- 天河粮储模板下载动作 -->
<record id="salary_year_wizard_downloads_tianheliangchu_action" model="ir.actions.act_url">
<field name="name">天河粮储模板下载</field>
<field name="target">self</field>
<field name="url">/yuthon_salary/static/others/salary_year_thlc.xlsx</field>
<field name="url">/yuthon_salary/static/others/年终奖(天河粮储).xlsx</field>
</record>
<record id="salary_year_wizard_form" model="ir.ui.view">