From 5b10bd706501e59e071f710f421f31a2b47b06aa Mon Sep 17 00:00:00 2001 From: Mohamed Eltayar Date: Thu, 13 Nov 2025 15:33:55 +0300 Subject: [PATCH] fix: ensure branch departments always display short names - Modified name_get method to prioritize is_branch flag - Branch departments (is_branch=True) now always show name only - Maintains context support for other cases - Fixes issue where branch names showed full hierarchical path - Ensures consistent short name display across all related fields Files modified: - odex25_hr/hr_base/models/hr_department.py This resolves the issue where branch names appeared with full path even when context was provided for short display. --- odex25_hr/hr_base/models/hr_department.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/odex25_hr/hr_base/models/hr_department.py b/odex25_hr/hr_base/models/hr_department.py index 49a8effb6..e78057df3 100644 --- a/odex25_hr/hr_base/models/hr_department.py +++ b/odex25_hr/hr_base/models/hr_department.py @@ -26,11 +26,15 @@ class HrDepartment(models.Model): def name_get(self): result = [] for department in self: - # إذا كان السياق من branch_name field أو طلب عرض مختصر - if self.env.context.get('from_branch_field') or self.env.context.get('show_branch_short'): + # إذا كان هذا القسم فرع، اعرض الاسم فقط بدون مسار + if department.is_branch: + name = department.name # الاسم فقط بدون مسار للفروع + # إذا كان السياق يطلب عرض مختصر + elif (self.env.context.get('from_branch_field') or + self.env.context.get('show_branch_short')): name = department.name # الاسم فقط بدون مسار else: - # العرض الافتراضي (مع المسار الهرمي) + # العرض الافتراضي (مع المسار الهرمي) للأقسام العادية name = super(HrDepartment, department).name_get()[0][1] result.append((department.id, name)) return result