Merge pull request #5419 from expsa/feature/hr-department-correct-display-20251113-233449
fix: correct HR department and branch name display logic
This commit is contained in:
commit
2d76a307ef
|
|
@ -26,24 +26,25 @@ class HrDepartment(models.Model):
|
|||
def name_get(self):
|
||||
result = []
|
||||
for department in self:
|
||||
# إذا كان السياق يطلب المسار الكامل
|
||||
if self.env.context.get('show_full_path'):
|
||||
name = super(HrDepartment, department).name_get()[0][1]
|
||||
else:
|
||||
# الاسم المختصر (الافتراضي)
|
||||
name = department.name
|
||||
name = department.name
|
||||
|
||||
# إضافة اسم الفرع فقط للأقسام (ليس للفروع)
|
||||
if not department.is_branch and department.branch_name:
|
||||
name = f"{department.name} - {department.branch_name.name}"
|
||||
|
||||
result.append((department.id, name))
|
||||
return result
|
||||
|
||||
@property
|
||||
def display_name(self):
|
||||
"""Override display_name to show short name for all departments"""
|
||||
# إذا كان السياق يطلب المسار الكامل
|
||||
if self.env.context.get('show_full_path'):
|
||||
return super().display_name
|
||||
else:
|
||||
# الاسم المختصر (الافتراضي)
|
||||
return self.name
|
||||
"""Override display_name to show department name with branch"""
|
||||
name = self.name
|
||||
|
||||
# إضافة اسم الفرع فقط للأقسام (ليس للفروع)
|
||||
if not self.is_branch and self.branch_name:
|
||||
name = f"{self.name} - {self.branch_name.name}"
|
||||
|
||||
return name
|
||||
|
||||
@api.depends('is_branch','parent_id')
|
||||
def get_is_branch(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue