@@ -98,7 +98,7 @@ class HrAttendanceMonthDetail(models.Model):
|
||||
leave_of_sick = fields.Integer(string="病假")
|
||||
statutory_leave = fields.Integer(string="法定假")
|
||||
work_overtime = fields.Integer(string="加班")
|
||||
entry_date = fields.Date(string="入职时间")
|
||||
entry_date = fields.Date(relatde='employee_id.open_start_time', string="入职时间")
|
||||
expected_date = fields.Date(string="离职日期")
|
||||
cop_leave = fields.Float(string='补休')
|
||||
annual_leave = fields.Float(string='年假')
|
||||
@@ -121,7 +121,7 @@ class HrAttendanceMonthDetail(models.Model):
|
||||
come_late = fields.Integer(string="迟到")
|
||||
is_early_card = fields.Integer(string="早退")
|
||||
is_no_card = fields.Integer(string="缺卡")
|
||||
is_work = fields.Boolean(string='旷工')
|
||||
is_work = fields.Integer(string='旷工')
|
||||
# 假期
|
||||
unpaid_leave = fields.Integer(string="无薪假")
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class PropertyHandover(models.Model):
|
||||
code = fields.Char(string="编号",
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('property_handover_code'))
|
||||
property_documents_ids = fields.Many2many('documents.document', string="附件")
|
||||
source = fields.Char(string="移交单位")
|
||||
source = fields.Char(string="接收单位")
|
||||
source_time = fields.Date(string="移交时间")
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
|
||||
@@ -124,4 +124,58 @@ class HrPayrollStructure(models.Model):
|
||||
"res_model": "yuthon.payroll.wizard",
|
||||
"view_mode": "form",
|
||||
"target": "new",
|
||||
}
|
||||
}
|
||||
|
||||
def generate_salary_rules(self, company_code, field_mapping):
|
||||
# 搜索符合条件的薪资结构
|
||||
structure_ids = self.env['hr.payroll.structure'].search([('yuthon_company', '=', company_code)])
|
||||
for structure in structure_ids:
|
||||
# 清空当前结构的规则
|
||||
structure.rule_ids.unlink()
|
||||
# 初始化规则列表
|
||||
rule_list = []
|
||||
for rule_name, field_attr in field_mapping.items():
|
||||
field_amount = getattr(structure, field_attr)
|
||||
if field_amount is not None:
|
||||
name_pinyin = pinyin(rule_name, style=Style.FIRST_LETTER)
|
||||
code = "".join([p[0][0] for p in name_pinyin]).upper()
|
||||
category_id = self.env['hr.salary.rule.category'].search([('name', '=', '职级')], limit=1)
|
||||
rule_list.append([0, 0, {
|
||||
'name': rule_name,
|
||||
'category_id': category_id.id,
|
||||
'code': code,
|
||||
'yuthon_company': company_code,
|
||||
'amount_fix': field_amount,
|
||||
'struct_id': structure.id
|
||||
}])
|
||||
if rule_list:
|
||||
structure.write({'rule_ids': rule_list})
|
||||
|
||||
def salary_rule_data(self):
|
||||
# 定义不同公司的字段映射
|
||||
company_mappings = {
|
||||
'thwg': {
|
||||
'基本工资': 'base_salary',
|
||||
'岗位工资': 'position_salary',
|
||||
'综合补贴': 'integrated_subsidy',
|
||||
'通讯补贴': 'communication_subsidy',
|
||||
'全勤奖': 'full_attendance_bonus'
|
||||
},
|
||||
'thlc': {
|
||||
'基本工资': 'base_salary',
|
||||
'岗位工资': 'position_salary',
|
||||
'岗位补贴': 'position_subsidy',
|
||||
'绩效奖金': 'performance_bonus'
|
||||
},
|
||||
'thtz': {
|
||||
'基本工资': 'base_salary',
|
||||
'职级工资': 'rank_salary',
|
||||
'绩效奖金': 'performance_bonus',
|
||||
'通讯补贴': 'communication_subsidy',
|
||||
'全勤奖': 'full_attendance_bonus'
|
||||
}
|
||||
}
|
||||
|
||||
for record in self:
|
||||
for company_code, field_mapping in company_mappings.items():
|
||||
self.generate_salary_rules(company_code, field_mapping)
|
||||
@@ -19,6 +19,7 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='country_id']" position="after">
|
||||
<button name="open_record" type="object" class="btn btn-primary" string="查看详情"/>
|
||||
<button name="salary_rule_data" type="object" class="btn btn-primary" string="cs"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="before">
|
||||
<field name="sequence"/>
|
||||
@@ -103,6 +104,13 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.action_yuthon_salary()</field>
|
||||
</record>
|
||||
<record id="all_paroll_write_salary_admin" model="ir.actions.server">
|
||||
<field name="name">清除数据</field>
|
||||
<field name="model_id" ref="hr_payroll.model_hr_payroll_structure"/>
|
||||
<field name="binding_model_id" ref="hr_payroll.model_hr_payroll_structure"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.salary_rule_data()</field>
|
||||
</record>
|
||||
<record id="all_data_write_payroll" model="ir.actions.server">
|
||||
<field name="name">导入薪资</field>
|
||||
<field name="model_id" ref="hr_payroll.model_hr_payroll_structure"/>
|
||||
|
||||
@@ -43,6 +43,7 @@ class YuthonPayrollWizard(models.Model):
|
||||
communication_subsidy = row[4].value
|
||||
full_attendance_bonus = row[5].value
|
||||
payroll_id = self.env['hr.payroll.structure'].search([('type_id', '=', type_id.id), ('yuthon_company', '=','thtz')], limit=1)
|
||||
payroll_id.rule_ids.unlink()
|
||||
if payroll_id:
|
||||
payroll_id.write({
|
||||
'base_salary': base_salary,
|
||||
|
||||
Reference in New Issue
Block a user