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 '未知'