@@ -348,13 +348,43 @@ class VacationMedicalLine(models.Model):
|
||||
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期额度记录')
|
||||
employee_id = fields.Many2one('hr.employee', string='员工')
|
||||
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
|
||||
update_type = fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
|
||||
update_type = fields.Char(string='更新类型')
|
||||
update_date = fields.Date(string='更新时间')
|
||||
valid_date = fields.Date(string='有效期至')
|
||||
adjust_date = fields.Date(string='调整至')
|
||||
lines = fields.Float(string='额度')
|
||||
is_void = fields.Boolean(string='是否作废', default=False)
|
||||
text = fields.Text(string='备注')
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
record = super(VacationMedicalLine, self).create(vals)
|
||||
if record.employee_id and record.valid_date:
|
||||
employee = record.employee_id
|
||||
medical_rule = self.env['medical.rules.setting'].search([
|
||||
('company_id', '=', employee.company_id.id),
|
||||
('select_year', '<=', str(record.valid_date.year))
|
||||
], order='select_year DESC', limit=1)
|
||||
if medical_rule:
|
||||
age_diff = max(0, employee.old - 20)
|
||||
increase_times = age_diff // medical_rule.every_few_years
|
||||
base_amount = medical_rule.base
|
||||
|
||||
# 根据性别和婚姻状况调整额度
|
||||
if employee.gender == 'female':
|
||||
if employee.marital in ['single', 'divorced', 'widower', 'cohabitant']:
|
||||
base_amount += medical_rule.woman_unmarried
|
||||
else:
|
||||
base_amount += medical_rule.woman_unmarried + medical_rule.woman_married
|
||||
|
||||
# 计算最终额度(基础额度 + 递增额度)
|
||||
final_amount = base_amount + (increase_times * medical_rule.increasing)
|
||||
final_amount = min(final_amount, medical_rule.max)
|
||||
record.write({'lines': final_amount})
|
||||
return record
|
||||
|
||||
|
||||
|
||||
class DetailsTree(models.Model):
|
||||
_name = 'details.tree'
|
||||
_description = '明细表'
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
<field name="workflow_record_id" domain="[('workflow_id.name', '=', '外出'), ('create_uid.employee_id', '=', employee_id)]"/>
|
||||
<field name="update_type" readonly="1"/>
|
||||
<field name="update_date" readonly="1"/>
|
||||
<field name="lines"/>
|
||||
<field name="valid_date"/>
|
||||
<field name="adjust_date"/>
|
||||
<field name="is_void" optional="hide"/>
|
||||
@@ -195,6 +196,7 @@
|
||||
<field name="workflow_record_id" domain="[('workflow_id.name', '=', '外出'), ('create_uid.employee_id', '=', employee_id)]"/>
|
||||
<field name="update_type" readonly="1"/>
|
||||
<field name="update_date" readonly="1"/>
|
||||
<field name="lines"/>
|
||||
<field name="valid_date"/>
|
||||
<field name="adjust_date"/>
|
||||
<field name="is_void" optional="hide"/>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
'views/yuthon_duty_plan_views.xml',
|
||||
'views/yuthon_abnormal_approval_views.xml',
|
||||
'views/yuthon_abnormal_setting_views.xml',
|
||||
'views/medical_rules_setting_viwes.xml',
|
||||
'views/yuthon_adjustments_approval_views.xml',
|
||||
'views/yuthon_shift_approval_views.xml',
|
||||
'views/plan_views.xml',
|
||||
|
||||
@@ -24,7 +24,7 @@ from . import yuthon_customer_planning
|
||||
# from . import inherit_hr_employee
|
||||
from . import hr_attendance_wechat
|
||||
from . import hr_attendance_detail_wechat
|
||||
|
||||
from . import medical_rules_setting
|
||||
from . import hr_attendance_month
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import api, fields, models, tools, _
|
||||
from datetime import datetime, time, timedelta
|
||||
|
||||
|
||||
class MedicalRulesSetting(models.Model):
|
||||
_name = 'medical.rules.setting'
|
||||
_description = '体检费规则'
|
||||
|
||||
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2040)], string='生效年',
|
||||
default=lambda self: str(datetime.now().year))
|
||||
base = fields.Float(string='基数')
|
||||
every_few_years = fields.Integer(string='每几年')
|
||||
increasing = fields.Float(string='递增')
|
||||
woman_unmarried = fields.Float(string='女性未婚')
|
||||
woman_married = fields.Float(string='女性已婚')
|
||||
max = fields.Float(string='最大值')
|
||||
company_id = fields.Many2one("res.company", string="公司", required=True)
|
||||
@@ -59,3 +59,4 @@ access_yuthon_integrated_wizard,yuthon.integrated.wizard,model_yuthon_integrated
|
||||
access_applet_address,applet.address,model_applet_address,base.group_user,1,1,1,1
|
||||
access_applet_security,applet.security,model_applet_security,base.group_user,1,1,1,1
|
||||
access_applet_security_setting,applet.security.setting,model_applet_security_setting,base.group_user,1,1,1,1
|
||||
access_medical_rules_setting, medical.rules.setting,model_medical_rules_setting,base.group_user,1,1,1,1
|
||||
|
||||
|
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_medical_rules_setting_tree" model="ir.ui.view">
|
||||
<field name="name">medical.rules.setting.tree</field>
|
||||
<field name="model">medical.rules.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="体检费规则" editable="bottom">
|
||||
<field name="select_year"/>
|
||||
<field name="base"/>
|
||||
<field name="every_few_years"/>
|
||||
<field name="increasing"/>
|
||||
<field name="woman_unmarried"/>
|
||||
<field name="woman_married"/>
|
||||
<field name="max"/>
|
||||
<field name="company_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_medical_rules_setting_action" model="ir.actions.act_window">
|
||||
<field name="name">体检费规则</field>
|
||||
<field name="res_model">medical.rules.setting</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -265,10 +265,10 @@
|
||||
<field name="bank_account_id" optional="show" column_invisible="1"/>
|
||||
<field name="actual_salary" decoration-danger="1" decoration-bf="1" column_invisible="1"/>
|
||||
<field name="total_before_tax" decoration-danger="1" decoration-bf="1" optional="show"/>
|
||||
<field name="three_one" optional="show"/>
|
||||
<field name="b_year" decoration-danger="1" decoration-bf="1" optional="show"/>
|
||||
<field name="tax_payable" decoration-danger="1" decoration-bf="1" readonly="1" column_invisible="1"/>
|
||||
<field name="union_dues" decoration-danger="1" decoration-bf="1" optional="show"/>
|
||||
<field name="three_one" optional="show"/>
|
||||
<field name="base_salary" required="1" optional="show"/>
|
||||
<field name="rank_salary" required="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
|
||||
<field name="position_subsidy" groups="yuthon_salary.group_wg_user, yuthon_salary.group_lc_user" optional="show" decoration-success="1"/>
|
||||
|
||||
@@ -137,12 +137,6 @@ class SalaryComputeWizard(models.Model):
|
||||
employee = internship_id.employee_id
|
||||
contract = employee.contract_id
|
||||
|
||||
# 集团本部 岗位工资除了工勤返聘才用值
|
||||
if contract.structure_type_id.name == '工勤返聘' and self.company_id.name == '集团本部':
|
||||
for line in internship_id.line_ids:
|
||||
if line.name == '岗位工资':
|
||||
line.total = 0
|
||||
|
||||
# 获取离职日期
|
||||
turnover_date = employee.contract_id.date_end
|
||||
start_date = fields.Date.from_string(start_date)
|
||||
|
||||
@@ -223,6 +223,11 @@
|
||||
parent="attendance_resources_setting_root_board"
|
||||
action="yuthon_holiday.action_leave_type_form"
|
||||
sequence="9"/>
|
||||
<menuitem id="medical_rules_setting_board"
|
||||
name="体检费规则"
|
||||
parent="attendance_resources_setting_root_board"
|
||||
action="yuthon_hr_attendance.view_medical_rules_setting_action"
|
||||
sequence="12"/>
|
||||
<menuitem id="holiday_set_scheme_board"
|
||||
name="年假"
|
||||
parent="attendance_resources_setting_root_board"
|
||||
|
||||
Reference in New Issue
Block a user