From 8c8f383769bb8bc763607237626074a66850d57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Mon, 8 Jun 2026 16:10:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_report/models/yuthon_dashboard.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yuthon_report/models/yuthon_dashboard.py b/yuthon_report/models/yuthon_dashboard.py index db9bb22b9..adb14d0f2 100644 --- a/yuthon_report/models/yuthon_dashboard.py +++ b/yuthon_report/models/yuthon_dashboard.py @@ -258,11 +258,15 @@ class YuthonDashboard(models.Model): return '未知' def _get_admin_display(self, partner_id): + """根据片区ID获取管理员显示名 + partner_id 是 yuthon.precinct.message 的 ID(前端 Many2XAutocomplete 绑定该模型) + display_name 已自动拼接为 "{片区名称}{管理员姓名}",如 "二B梁嘉辉" + """ if not partner_id: return '全部' try: - user = self.env['res.users'].browse(int(partner_id)) - return user.name if user else '未知' + precinct = self.env['yuthon.precinct.message'].browse(int(partner_id)) + return precinct.display_name if precinct else '未知' except Exception: return '未知'