diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 5d06d95b2..268fad60d 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -188,6 +188,14 @@ class YuthonProperty(models.Model): evaluation_whole_rent_price = fields.Float(string='评估整租单价(元/m² •月)') evaluation_whole_rent_total = fields.Float(string='评估总价(元•月,整租)') + def update_precinct(self): + property_ids = self.env["yuthon.property"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for rec in property_ids: + if rec.manage_information_ids: + precinct_id = self.env['yuthon.precinct.message'].search([('employee_id', '=', rec.admin_id.employee_ids.id)]) + rec.manage_information_ids[-1].precinct_id = precinct_id.id + def put_declare_approval(self): property_ids = self.env["yuthon.property"].browse( self._context.get('active_ids', self._context.get('active_id'))) @@ -513,7 +521,7 @@ class ManageInformationLine(models.Model): yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息") purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型") - precinct_id = fields.Many2one('yuthon.precinct.message', string="所属片区", readonly=False) + precinct_id = fields.Many2one('yuthon.precinct.message', string="所属片区") tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型') management_area = fields.Float(string="管理面积", digits=(16, 4)) rent_area = fields.Float(string="可租面积", digits=(16, 4)) diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml index 728bc8996..8915d5168 100644 --- a/yuthon_property/views/yuthon_property_views.xml +++ b/yuthon_property/views/yuthon_property_views.xml @@ -470,4 +470,11 @@ action = model.revert_change() + + 更新片区 + + + code + action = model.update_precinct() + \ No newline at end of file