[FIX] studies_base: fix indent error for study name_get #6

Merged
b0g merged 1 commits from fix-study-get-name into 16.0 2025-08-25 14:49:37 +00:00
Showing only changes of commit e5f2c4a500 - Show all commits

View File

@@ -19,7 +19,7 @@ class StudyStudy(models.Model):
"study.progress.status", "study.progress.status",
string="Avancement de l'étude", string="Avancement de l'étude",
domain="[('study_id', '=', id)]", domain="[('study_id', '=', id)]",
compute="_compute_progress_status_id" compute="_compute_progress_status_id",
) )
progress_status = fields.One2many( progress_status = fields.One2many(
"study.progress.status", "study_id", "All progress status" "study.progress.status", "study_id", "All progress status"
@@ -101,20 +101,25 @@ class StudyStudy(models.Model):
@api.depends("progress_status") @api.depends("progress_status")
def _compute_progress_status_id(self): def _compute_progress_status_id(self):
for record in self: for record in self:
unfinished_progress_status = record.progress_status.filtered(lambda x: x.actual == True) unfinished_progress_status = record.progress_status.filtered(
record.progress_status_id = unfinished_progress_status.id if len(unfinished_progress_status) == 1 else None lambda x: x.actual == True
)
record.progress_status_id = (
unfinished_progress_status.id
if len(unfinished_progress_status) == 1
else None
)
def copy(self, default=None): def copy(self, default=None):
default = dict(default or {}, identifier_primary_id=None) default = dict(default or {}, identifier_primary_id=None)
return super().copy(default) return super().copy(default)
@api.depends("title", "name")
@api.depends("title", "name") def name_get(self):
def name_get(self): result = []
result = [] for study in self:
for study in self: if not study.name:
if not study.name: result.append((study.id, study.title))
result.append((study.id, study.title)) else:
else: result.append((study.id, f"[{study.name}] {study.title}"))
result.append((study.id, f"[{study.name}] {study.title}")) return result
return result