!4255 添加功能

Merge pull request !4255 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-08-01 09:17:39 +00:00
committed by Gitee
2 changed files with 26 additions and 21 deletions
@@ -25,6 +25,7 @@ class YuthonOnboardApproval(models.Model):
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_onboard_approval_code'))
employee_name_id = fields.Many2one('hr.applicant', string='姓名')
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
company_id = fields.Many2one(related='users_id.company_id', string="公司")
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
account = fields.Char(string='账号')
reason = fields.Text(string="正文")
@@ -82,7 +83,12 @@ class YuthonOnboardApproval(models.Model):
if self.employee_name_id and self.job_id and self.department_id1:
self.name = self.employee_name_id.name + '-' + self.job_id.name + '-' + self.department_id1.name
@api.onchange('structure_type_id')
def _onchange_structure_type_id(self):
payroll_id = self.env['hr.payroll.structure'].search([('name', '=', self.structure_type_id.name), ('company_id', '=', self.company_id.id)], limit=1)
for salary_id in payroll_id.rule_ids:
if salary_id.name == '基本工资':
self.salary = salary_id.amount_fix
@api.onchange('employment_form')
def _onchange_employment_form(self):
@@ -91,7 +97,6 @@ class YuthonOnboardApproval(models.Model):
else:
self.contract_type1 = False
def button_office_supply(self):
form_id = self.env.ref('yuthon_sps_approval.view_yuthon_office_supplies_form').id
for record in self:
@@ -49,10 +49,8 @@
<group string="审批信息">
<field name="name" required="1"/>
<field name="work_end" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="users_id" options="{'no_create': True}"/>
<field name="employment_form"/>
<field name="contract_type" invisible="employment_form == 'formal' or not employment_form"/>
<field name="contract_type1" invisible="employment_form == 'informal'"/>
<field name="department_id" invisible="1"/>
<field name="onboarding_status" invisible="1"/>
<field name="reason"/>
@@ -67,37 +65,39 @@
<group col="3" string="乙方信息">
<group>
<field name="employee_name_id" required="1" domain="[('stage_id.name', '=', '待入职')]"/>
<label for="probation_start_date"/>
<field name="employment_form"/>
<label for="duration_employment"/>
<div>
<field name="duration_employment" class="oe_inline"/>至
<field name="duration_employment_end" class="oe_inline"/>
</div>
<field name="is_annual_salary"/>
</group>
<group>
<field name="department_id1" readonly="0"/>
<field name="contract_type" invisible="employment_form == 'formal' or not employment_form"/>
<field name="contract_type1" invisible="employment_form == 'informal'"/>
<label for="probation_start_date"/>
<div class="d-inline-flex w-100">
<field name="probation_start_date" string="试用期时间:" class="me-2"
style="max-width: 10rem !important;"/>至
<field name="probation_end_date" string=" " class="ms-2"
style="max-width: 10rem !important;"/>
</div>
<field name="salary" invisible="employment_form != 'formal' or contract_type == 'internship'"/>
<field name="salary" invisible="contract_type == 'internship'"/>
<field name="salary_level" invisible="contract_type != 'internship'"/>
</group>
<group>
<field name="structure_type_id"/>
<field name="is_annual_salary"/>
<field name="job_id" readonly="0"/>
<field name="is_office"/>
</group>
<group>
<field name="department_id1" readonly="0"/>
<field name="structure_type_id" domain="[('company_id', '=', company_id)]"/>
<field name="onboard_time"/>
<field name="salary" invisible="contract_type == 'internship'"/>
<field name="salary_level" invisible="contract_type != 'internship'"/>
<field name="is_office"/>
</group>
</group>
<group>
<field name="documents_ids" widget="preview_many2many"/>
</group>
<group>
<label for="duration_employment"/>
<div>
<field name="duration_employment" class="oe_inline"/>至
<field name="duration_employment_end" class="oe_inline"/>
</div>
</group>
<group col="2">
<group>
<field name="bank"/>