summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-08-16 12:38:41 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-08-16 12:38:41 +0200
commitfe78f0db71ac7a9528925492c8521496dc6c36ed (patch)
treefa0614969e604e65396fabf9a48cbd7c97a410e8 /archaeological_operations/models.py
parent5d0750488690ec698857aa40e4e16761d3aae613 (diff)
downloadIshtar-fe78f0db71ac7a9528925492c8521496dc6c36ed.tar.bz2
Ishtar-fe78f0db71ac7a9528925492c8521496dc6c36ed.zip
Manage ope prefixes with the profile
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 828df91e5..9d6264a4d 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -36,7 +36,7 @@ from ishtar_common.models import BaseHistorizedItem, Dashboard, \
HistoricalRecords, IshtarUser, LightHistorizedItem, \
OperationType, Organization, OwnPerms, Person, PersonType, \
post_delete_record_relation, post_save_cache, RelationItem, \
- ShortMenuItem, SourceType, Town, ValueGetter
+ ShortMenuItem, SourceType, Town, ValueGetter, get_current_profile
from ishtar_common.utils import cached_label_changed, \
force_cached_label_changed, mode
@@ -831,15 +831,16 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
return BaseFind.objects.filter(context_record__operation=self)
def get_reference(self, full=False):
+ profile = get_current_profile()
ref = ""
- if settings.COUNTRY == 'fr' and self.code_patriarche:
- ref = settings.ISHTAR_OPE_PREFIX + unicode(self.code_patriarche)
+ if self.code_patriarche:
+ ref = profile.operation_prefix + unicode(self.code_patriarche)
if not full:
return ref
if self.year and self.operation_code:
if ref:
ref += u" - "
- ref += settings.ISHTAR_DEF_OPE_PREFIX
+ ref += profile.default_operation_prefix
ref += u"-".join((unicode(self.year),
unicode(self.operation_code)))
return ref or "00"
@@ -931,15 +932,17 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
return ""
lbl = unicode(self.operation_code)
year = self.year or 0
- lbl = settings.ISHTAR_DEF_OPE_PREFIX \
- + u"%d-%s%s" % (year, (3 - len(lbl)) * "0", lbl)
+ profile = get_current_profile()
+ lbl = profile.default_operation_prefix \
+ + u"%d-%s%s" % (year, (3 - len(lbl)) * "0", lbl)
return lbl
@property
def full_code_patriarche(self):
if not self.code_patriarche:
return ''
- return settings.ISHTAR_OPE_PREFIX + self.code_patriarche
+ profile = get_current_profile()
+ return profile.operation_prefix + self.code_patriarche
def clean(self):
if not self.operation_code: