diff --git a/yuthon_property/models/yuthon_precinct_message.py b/yuthon_property/models/yuthon_precinct_message.py index d55ac92ee..5a017baba 100644 --- a/yuthon_property/models/yuthon_precinct_message.py +++ b/yuthon_property/models/yuthon_precinct_message.py @@ -8,4 +8,17 @@ class YuthonPrecinctMessage(models.Model): _order = 'sequence' name = fields.Char(string='片区名称') - sequence = fields.Integer(string='片区序号') \ No newline at end of file + employee_id = fields.Many2one('hr.employee', string='管理员') + sequence = fields.Integer(string='片区序号') + + @api.depends('name', 'employee_id.name') + def _compute_display_name(self): + for record in self: + if record.name and record.employee_id: + record.display_name = f"{record.name}{record.employee_id.name}" + elif record.name: + record.display_name = record.name + elif record.employee_id: + record.display_name = f"由{record.employee_id.name}管理的片区" + else: + record.display_name = f"片区 #{record.id}" \ No newline at end of file diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 2869ee6d8..40eab4c03 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -299,12 +299,6 @@ class YuthonProperty(models.Model): } } - @api.depends('precinct_id', 'admin_id') - def _compute_display_name(self): - for record in self: - if record.precinct_id and record.admin_id: - record.display_name = record.precinct_id.name + record.admin_id.name - def put_assessment_approval(self): for record in self: self.env['property.evaluation.plan'].create({ diff --git a/yuthon_property/views/yuthon_precinct_message_views.xml b/yuthon_property/views/yuthon_precinct_message_views.xml index e228be19f..c72eadf54 100644 --- a/yuthon_property/views/yuthon_precinct_message_views.xml +++ b/yuthon_property/views/yuthon_precinct_message_views.xml @@ -6,6 +6,7 @@ +