From d86d38d75b4ad6a0626cc341687347c8950a1c87 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 10 May 2022 13:13:21 +0200 Subject: Operation: fix empty operation prefix in profile (refs #5358) --- archaeological_operations/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'archaeological_operations/models.py') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 2c018ce20..4de3a78e5 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1508,13 +1508,13 @@ class Operation( profile = get_current_profile() ref = "" if self.code_patriarche: - ref = profile.operation_prefix + str(self.code_patriarche) + ref = (profile.operation_prefix or "") + str(self.code_patriarche) if not full: return ref if self.year and self.operation_code: if ref: ref += " - " - ref += profile.default_operation_prefix + ref += profile.default_operation_prefix or "" ref += "-".join((str(self.year), str(self.operation_code))) return ref or "00" @@ -1684,7 +1684,7 @@ class Operation( lbl = str(self.operation_code) year = self.year or 0 profile = get_current_profile() - lbl = profile.default_operation_prefix + "%d-%s%s" % ( + lbl = (profile.default_operation_prefix or "") + "%d-%s%s" % ( year, (3 - len(lbl)) * "0", lbl, @@ -1696,7 +1696,7 @@ class Operation( if not self.code_patriarche: return "" profile = get_current_profile() - return profile.operation_prefix + self.code_patriarche + return (profile.operation_prefix or "") + self.code_patriarche def clean(self): if not self.operation_code: -- cgit v1.2.3