From eaa91c4864c942d9b0f91dcaab21c9d5bbdd3073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Sat, 29 Nov 2025 19:51:55 +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 --- .../models/financial_sheet_collection.py | 1 + yuthon_account_report/models/table_setting.py | 22 ++++++++++++++-- .../financial_sheet_collection_views.xml | 10 ++++---- .../views/information_summary_table_views.xml | 12 ++++----- .../views/table_setting_views.xml | 6 +++-- .../wizard/penalty_line_wizard.py | 19 +++++++++++--- .../wizard/property_reconciliation_wizard.py | 25 +++++++++++-------- 7 files changed, 65 insertions(+), 30 deletions(-) diff --git a/yuthon_account_report/models/financial_sheet_collection.py b/yuthon_account_report/models/financial_sheet_collection.py index 4c9463398..0b63e8eb5 100644 --- a/yuthon_account_report/models/financial_sheet_collection.py +++ b/yuthon_account_report/models/financial_sheet_collection.py @@ -42,6 +42,7 @@ class FinancialSheetLine(models.Model): _name = 'financial.sheet.line' _description = '财务数据表行' + employee_ids = fields.Many2many('hr.employee', string='人员') sheet_id = fields.Many2one('financial.sheet.collection', string='关联财务数据表') collection_id = fields.Many2one('sheet.collection.setting', string='项目名称') this_issue_number = fields.Integer(string='本期数') diff --git a/yuthon_account_report/models/table_setting.py b/yuthon_account_report/models/table_setting.py index 297c8fde1..15ff6bb61 100644 --- a/yuthon_account_report/models/table_setting.py +++ b/yuthon_account_report/models/table_setting.py @@ -10,7 +10,8 @@ class SheetCollectionSetting(models.Model): sequence = fields.Integer(string='序号') name = fields.Char(string='名称') - user_role_id = fields.Many2one('soong.user.role', string="角色") + employee_ids = fields.Many2many('hr.employee', string='员工') + user_role_ids = fields.Many2many('soong.user.role', string="角色") start_date = fields.Date(string="生效日期", default=fields.Datetime.today()) end_date = fields.Date(string="失效日期") is_enable = fields.Boolean(string="是否启用", compute="compute_is_enable") @@ -26,6 +27,14 @@ class SheetCollectionSetting(models.Model): else: record.is_enable = record.start_date <= today <= record.end_date + @api.onchange('user_role_ids') + def _onchange_user_role_ids(self): + for rec in self: + domain = ['|', ('user_role_id', 'in', rec.user_role_ids.ids), + ('user_role_ids', 'in', rec.user_role_ids.ids)] + new_employees = self.env['hr.employee'].search(domain) + all_employees = rec.employee_ids | new_employees + rec.employee_ids = all_employees class SummaryTableSetting(models.Model): _name = 'summary.table.setting' @@ -34,7 +43,8 @@ class SummaryTableSetting(models.Model): sequence = fields.Integer(string='序号') name = fields.Char(string='名称') - company_id = fields.Many2one('res.company', string="公司") + employee_ids = fields.Many2many('hr.employee', string='员工') + user_role_ids = fields.Many2many('soong.user.role', string="角色") start_date = fields.Date(string="生效日期", default=fields.Datetime.today()) end_date = fields.Date(string="失效日期") is_enable = fields.Boolean(string="是否启用", compute="compute_is_enable") @@ -50,3 +60,11 @@ class SummaryTableSetting(models.Model): else: record.is_enable = record.start_date <= today <= record.end_date + @api.onchange('user_role_ids') + def _onchange_user_role_ids(self): + for rec in self: + domain = ['|', ('user_role_id', 'in', rec.user_role_ids.ids), + ('user_role_ids', 'in', rec.user_role_ids.ids)] + new_employees = self.env['hr.employee'].search(domain) + all_employees = rec.employee_ids | new_employees + rec.employee_ids = all_employees diff --git a/yuthon_account_report/views/financial_sheet_collection_views.xml b/yuthon_account_report/views/financial_sheet_collection_views.xml index 72dfad475..eeb1bb607 100644 --- a/yuthon_account_report/views/financial_sheet_collection_views.xml +++ b/yuthon_account_report/views/financial_sheet_collection_views.xml @@ -28,13 +28,13 @@ - - - + + + - - + + diff --git a/yuthon_account_report/views/information_summary_table_views.xml b/yuthon_account_report/views/information_summary_table_views.xml index 31da6cff8..7e29fa8dc 100644 --- a/yuthon_account_report/views/information_summary_table_views.xml +++ b/yuthon_account_report/views/information_summary_table_views.xml @@ -13,7 +13,7 @@ - +