From 1e5548d3c2c5c00d7811f716f97755848661ea40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Thu, 28 May 2026 17:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_official/models/yuthon_official.py | 36 +++++++++++++++++++ .../views/yuthon_official_views.xml | 2 ++ 2 files changed, 38 insertions(+) diff --git a/yuthon_official/models/yuthon_official.py b/yuthon_official/models/yuthon_official.py index 941f1658d..3a7aea583 100644 --- a/yuthon_official/models/yuthon_official.py +++ b/yuthon_official/models/yuthon_official.py @@ -37,6 +37,14 @@ class YuthonOfficial(models.Model): 'flat_id', string="抄送单位" ) + main_unit_type = fields.Selection([ + ('gov', '行政事业单位'), + ('other', '其他单位') + ], string='主送单位类型') + copy_unit_type = fields.Selection([ + ('gov', '行政事业单位'), + ('other', '其他单位') + ], string='抄送单位类型') department_ids = fields.Many2many('hr.department', string='部门范围') employee_ids = fields.Many2many('hr.employee', string='人员范围') users_role_ids = fields.Many2many('soong.user.role', string='角色范围') @@ -183,6 +191,20 @@ class YuthonOfficial(models.Model): else: self.reference_cold = False + @api.onchange('main_flats_ids') + def _onchange_main_flats_ids(self): + if self.main_flats_ids: + self.main_unit_type = self.main_flats_ids[0].unit_type + else: + self.main_unit_type = False + + @api.onchange('copy_flats_ids') + def _onchange_copy_flats_ids(self): + if self.copy_flats_ids: + self.copy_unit_type = self.copy_flats_ids[0].unit_type + else: + self.copy_unit_type = False + @api.onchange('company_id1') def onchange_company_id1(self): current_year = fields.Date.today().year @@ -422,6 +444,20 @@ class YuthonPropertyOfficial(models.Model): else: self.reference_cold = False + @api.onchange('main_flats_ids') + def _onchange_main_flats_ids(self): + if self.main_flats_ids: + self.main_unit_type = self.main_flats_ids[0].unit_type + else: + self.main_unit_type = False + + @api.onchange('copy_flats_ids') + def _onchange_copy_flats_ids(self): + if self.copy_flats_ids: + self.copy_unit_type = self.copy_flats_ids[0].unit_type + else: + self.copy_unit_type = False + @api.onchange('company_id1') def onchange_company_id1(self): current_year = fields.Date.today().year diff --git a/yuthon_official/views/yuthon_official_views.xml b/yuthon_official/views/yuthon_official_views.xml index b169585ae..55c1bd818 100644 --- a/yuthon_official/views/yuthon_official_views.xml +++ b/yuthon_official/views/yuthon_official_views.xml @@ -78,6 +78,8 @@ + +