From e6ab24e7be4ee2588d8f9dff1f1c2a2ed7db75df Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Wed, 18 Jun 2025 18:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soong_workflow/models/soong_workflow_mixin.py | 27 ++++++------------- .../views/inherit_yuthon_property_views.xml | 2 +- .../wizard/property_rental_wizard.py | 13 ++++++--- yuthon_salary/models/inherit_hr_payslip.py | 4 +++ .../views/inherit_hr_payslip_views.xml | 23 ++++++++-------- 5 files changed, 34 insertions(+), 35 deletions(-) diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 69918d67e..28a454ea7 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -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 diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml index dac9f5e24..729ac0d63 100644 --- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml +++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml @@ -56,7 +56,7 @@ 租金列表 property.rent.list tree,search - + [('is_push', '=', False)] {'search_default_group_contract_id': 1} diff --git a/yuthon_property_approval/wizard/property_rental_wizard.py b/yuthon_property_approval/wizard/property_rental_wizard.py index 84274d9a7..7cdbd64bf 100644 --- a/yuthon_property_approval/wizard/property_rental_wizard.py +++ b/yuthon_property_approval/wizard/property_rental_wizard.py @@ -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, diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py index 971c6a32a..c0158817a 100644 --- a/yuthon_salary/models/inherit_hr_payslip.py +++ b/yuthon_salary/models/inherit_hr_payslip.py @@ -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) diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index 225f2e5a7..cfd8cc07c 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -273,31 +273,32 @@ - + - + - + - - + + + - - - - - - + + + + + +