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 @@
+
+