添加功能

This commit is contained in:
zhou
2025-06-18 18:54:41 +08:00
parent 4fc671dd21
commit e6ab24e7be
5 changed files with 34 additions and 35 deletions
+8 -19
View File
@@ -127,27 +127,16 @@ class SoongWorkflowMixin(models.AbstractModel):
for record in res:
button_ids = record.sudo().workflow_id.node_ids.button_ids.search([('workflow_id', '=', res.workflow_id.id), ('sequence', '=', 1)])
for button_id in button_ids:
if record.env.user.employee_id.department_id:
if button_id.users_role_id:
employee_ids = record.sudo().env['hr.employee'].search(
['|', ('user_role_id', '=', button_id.users_role_id.id),
('user_role_ids', 'in', button_id.users_role_id.id),
])
else:
employee_ids = record.sudo().env['hr.employee'].search([
'|', ('user_role_id', 'in', button_id.users_role_group_ids.user_role_ids.ids),
('user_role_ids', 'in', button_id.users_role_group_ids.user_role_ids.ids),
if button_id.users_role_id:
employee_ids = record.sudo().env['hr.employee'].search(
['|', ('user_role_id', '=', button_id.users_role_id.id),
('user_role_ids', 'in', button_id.users_role_id.id),
])
else:
if button_id.users_role_id:
employee_ids = record.sudo().env['hr.employee'].search(
['|', ('user_role_id', '=', button_id.users_role_id.id), ('user_role_ids', 'in', button_id.users_role_id.id),
'|', ('department_id', '=', record.env.user.employee_id.department_id.id), ('department_ids', 'in', record.env.user.employee_id.department_id.id),
])
else:
employee_ids = record.sudo().env['hr.employee'].search([
'|', ('user_role_id', 'in', button_id.users_role_group_ids.user_role_ids.ids), ('user_role_ids', 'in', button_id.users_role_group_ids.user_role_ids.ids),
'|', ('department_id', '=', record.env.user.employee_id.department_id.id), ('department_ids', 'in', record.env.user.employee_id.department_id.id),])
employee_ids = record.sudo().env['hr.employee'].search([
'|', ('user_role_id', 'in', button_id.users_role_group_ids.user_role_ids.ids),
('user_role_ids', 'in', button_id.users_role_group_ids.user_role_ids.ids),
])
if record.env.user.employee_id.id in employee_ids.ids:
record.state = button_id.node_id.node_name
return res
@@ -56,7 +56,7 @@
<field name="name">租金列表</field>
<field name="res_model">property.rent.list</field>
<field name="view_mode">tree,search</field>
<!-- <field name="domain">[('is_push', '=', False)]</field>-->
<field name="domain">[('is_push', '=', False)]</field>
<field name="context">{'search_default_group_contract_id': 1}</field>
</record>
<!--押金-->
@@ -22,7 +22,8 @@ class PropertyRentalWizard(models.Model):
('contract_id', '=', record.id),
('property_id', '=', property_id),
('due_date', '>=', first_day_of_month),
('due_date', '<=', last_day_of_month)
('due_date', '<=', last_day_of_month),
('is_push', '=', False)
])
if not rent_id:
self.sudo().env["property.rent.list"].create({
@@ -59,12 +60,16 @@ class PropertyRentalWizard(models.Model):
('performance_bonds', 'performance_bonds'),
('utility_bills', 'utility_bills'),
('renovation_deposit', 'decorate'),
# 可以根据需要添加更多押金类型
]
# 遍历每种押金类型,创建对应的押金记录(值不为0时)
# 获取当前合同已存在的押金记录
existing_deposits = self.sudo().env["property.deposit.list"].search([
("contract_id", "=", record.id),
]).mapped('posit_type')
# 遍历每种押金类型,创建对应的押金记录(值不为0且记录不存在时)
for field_name, deposit_type in deposit_types:
amount = getattr(record, field_name, 0)
if amount > 0: # 只创建金额大于0的押金记录
if amount > 0 and deposit_type not in existing_deposits:
self.sudo().env["property.deposit.list"].create({
"contract_id": record.id,
"property_id": property_id,
@@ -125,6 +125,10 @@ class InheritHrPayslip(models.Model):
last_duty = fields.Float(string='上月值班费')
high_subsidy = fields.Float(string='高温补贴')
# 粮储临时项
temporary_pay = fields.Float(string='临时绩效工资')
performance_deduction = fields.Float(string='扣发绩效奖金', compute='_compute_deduction', store=True)
commuting_deduction = fields.Float(string='扣发通信补贴', compute='_compute_deduction', store=True)
base_salary_deduction = fields.Float(string='扣发基本工资', compute='_compute_deduction', store=True)
@@ -273,31 +273,32 @@
<field name="unemployment_insurance" decoration-info="1" optional="show"/>
<field name="housing_provident_fund" decoration-info="1" optional="show"/>
<field name="work_injury_insurance" decoration-info="1" optional="show"/>
<field name="specialized_deduction" decoration-warning="1" optional="show"/>
<field name="specialized_deduction" decoration-warning="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="infant_care" decoration-warning="1" optional="show" column_invisible="1"/>
<field name="child_education" decoration-warning="1" optional="show" column_invisible="1"/>
<field name="elderly_support" decoration-warning="1" optional="show" column_invisible="1"/>
<field name="housing_loan_interest" decoration-warning="1" optional="show" column_invisible="1"/>
<field name="housing_rent" decoration-warning="1" optional="show" column_invisible="1"/>
<field name="continuing_education" decoration-warning="1" optional="show" column_invisible="1"/>
<field name="individual_tax_refund" decoration-danger="1" optional="show"/>
<field name="individual_tax_refund" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="temporary_performance_bonus" decoration-danger="1" optional="show" column_invisible="1"/>
<field name="social_security" decoration-danger="1" optional="show"/>
<field name="social_security" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="liquidation_year" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="year_compute" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="year_jie" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="leave_absence" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="performance_up" decoration-danger="1" optional="show"/>
<field name="leave_absence" decoration-danger="1" optional="show" groups="yuthon_salary.group_wg_user"/>
<field name="performance_up" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="jing_te" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="year_gong" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="study_on" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="temporary_pay" decoration-danger="1" optional="show" groups="yuthon_salary.group_lc_user"/>
<field name="excellent_employees" decoration-danger="1" groups="yuthon_salary.group_wg_user" optional="show"/>
<field name="commuting_deduction" decoration-danger="1" optional="show"/>
<field name="performance_deduction" decoration-danger="1" optional="show"/>
<field name="deduction_standard" decoration-danger="1" optional="show"/>
<field name="safety_incentives" decoration-danger="1" optional="show"/>
<field name="last_year_safety" decoration-danger="1" optional="show"/>
<field name="last_year_performance_evaluation" decoration-danger="1" optional="show"/>
<field name="commuting_deduction" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="performance_deduction" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="deduction_standard" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="safety_incentives" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user" />
<field name="last_year_safety" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="last_year_performance_evaluation" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
<field name="salary_state" optional="show"/>
<field name="company_id" optional="hide"/>
<field name="is_salary_release" column_invisible="1"/>