From 473254e919301831998deba2c7ac1824fe84afc1 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: Tue, 28 Apr 2026 15:08:16 +0800 Subject: [PATCH 1/4] =?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 --- yuthon_issue/views/issue_library_views.xml | 1 + .../models/property_lease_contract.py | 17 ++++++++- .../wizard/choose_contract_wizard_views.xml | 2 +- yuthon_salary/models/salary_field_config.py | 37 +++++-------------- .../views/salary_field_config_views.xml | 2 +- 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/yuthon_issue/views/issue_library_views.xml b/yuthon_issue/views/issue_library_views.xml index f7febdf8d..3816c753e 100644 --- a/yuthon_issue/views/issue_library_views.xml +++ b/yuthon_issue/views/issue_library_views.xml @@ -58,6 +58,7 @@
+ diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 9894ed4a9..f9bda6188 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -2517,11 +2517,26 @@ class PropertyLeaseContractLine(models.Model): address_id = fields.Many2one('yuthon.property', string="物业地址") tax = fields.Float(related='address_id.tax',string="税率") admin_line_id = fields.Many2one(related='address_id.admin_id', string="管理员", store=True) - property_area = fields.Float(related='address_id.rent_area', string="可租面积", store=True) + property_area = fields.Float(string="可租面积", compute="_compute_property_area") message_standard_id = fields.Many2one(related='address_id.message_standard_id', string="管理费标准", store=True) message_unit = fields.Float(related='message_standard_id.amount', string="管理费单价", store=True) evaluate_unit_price = fields.Float(string="评估单价") + @api.depends('address_id', 'address_id.manage_information_ids') + def _compute_property_area(self): + today = fields.Date.today() + for line in self: + rent_area = 0.0 + if line.address_id: + valid_lines = line.address_id.manage_information_ids.filtered( + lambda r: + r.start_time <= today + and (not r.end_date or r.end_date >= today) + ) + if valid_lines: + rent_area = valid_lines[0].rent_area + line.property_area = rent_area + def open_record(self): self.ensure_one() diff --git a/yuthon_property_approval/wizard/choose_contract_wizard_views.xml b/yuthon_property_approval/wizard/choose_contract_wizard_views.xml index 91f324d3a..8402ed937 100644 --- a/yuthon_property_approval/wizard/choose_contract_wizard_views.xml +++ b/yuthon_property_approval/wizard/choose_contract_wizard_views.xml @@ -11,7 +11,7 @@ - + diff --git a/yuthon_salary/models/salary_field_config.py b/yuthon_salary/models/salary_field_config.py index 940c461dd..6a79086a5 100644 --- a/yuthon_salary/models/salary_field_config.py +++ b/yuthon_salary/models/salary_field_config.py @@ -29,7 +29,12 @@ class SalaryFieldConfig(models.TransientModel): ] def action_sync(self): - config_fields = self.env[self._dynamic_field_config].search([('active', 'in', [True, False])]) + # 👇 只获取当前选中的配置行 + record_ids = self.env["salary.field.config"].browse( + self._context.get('active_ids', self._context.get('active_id')) + ) + config_fields = record_ids.filtered(lambda r: r.active in [True, False]) + model_id = self.env['ir.model'].search([('model', '=', self._dynamic_field_model)]) if not config_fields or not model_id: @@ -53,18 +58,6 @@ class SalaryFieldConfig(models.TransientModel): for field in new_config_fields: field.symbol = f'{self._dynamic_field_prefix}{field.id}' - return { - 'type': 'ir.actions.client', - 'tag': 'display_notification', - 'params': { - 'title': _('同步字段'), - 'message': _(f'成功同步 {len(new_fields)} 个薪资自定义字段。'), - 'type': 'success', - 'sticky': False, - 'next': {'type': 'ir.actions.client', 'tag': 'reload'}, - }, - } - def update_dynamic_fields(updated_config_fields): updated_count = 0 for field in updated_config_fields: @@ -80,18 +73,6 @@ class SalaryFieldConfig(models.TransientModel): }) updated_count += 1 - return { - 'type': 'ir.actions.client', - 'tag': 'display_notification', - 'params': { - 'title': _('同步字段'), - 'message': _(f'成功更新 {updated_count} 个薪资自定义字段。'), - 'type': 'success', - 'sticky': False, - 'next': {'type': 'ir.actions.client', 'tag': 'reload'}, - }, - } - exist_dynamic_names = dynamic_fields.mapped('name') exist_ids = [int(e.replace(self._dynamic_field_prefix, '')) for e in exist_dynamic_names if e.replace(self._dynamic_field_prefix, '').isdigit()] @@ -99,19 +80,19 @@ class SalaryFieldConfig(models.TransientModel): # 处理新字段 new_config_ids = [field.id for field in config_fields if field.id not in exist_ids] if new_config_ids: - create_dynamic_fields(self.search([('id', 'in', new_config_ids)])) + create_dynamic_fields(self.browse(new_config_ids)) # 处理更新字段 updated_config_ids = [field.id for field in config_fields if field.id in exist_ids] if updated_config_ids: - update_dynamic_fields(self.search([('id', 'in', updated_config_ids)])) + update_dynamic_fields(self.browse(updated_config_ids)) return { 'type': 'ir.actions.client', 'tag': 'display_notification', 'params': { 'title': _('同步完成'), - 'message': _('所有薪资自定义字段已同步完成!'), + 'message': _('选中的自定义字段已同步完成!'), 'type': 'success', 'sticky': False, 'next': {'type': 'ir.actions.client', 'tag': 'reload'}, diff --git a/yuthon_salary/views/salary_field_config_views.xml b/yuthon_salary/views/salary_field_config_views.xml index 79f765eb2..8737e27af 100644 --- a/yuthon_salary/views/salary_field_config_views.xml +++ b/yuthon_salary/views/salary_field_config_views.xml @@ -6,7 +6,7 @@
-
From fd17ba1ec02aea2b7bcb5c5b5dc42da3dada616a 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: Tue, 28 Apr 2026 15:12:06 +0800 Subject: [PATCH 2/4] =?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 --- yuthon_issue/views/issue_library_views.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/yuthon_issue/views/issue_library_views.xml b/yuthon_issue/views/issue_library_views.xml index 3816c753e..71680d9ef 100644 --- a/yuthon_issue/views/issue_library_views.xml +++ b/yuthon_issue/views/issue_library_views.xml @@ -93,8 +93,6 @@