summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-04-08 11:22:33 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-04-24 19:42:35 +0200
commitbc470e8759a77bb8ab150403232596598dcf3b4c (patch)
tree7a64c075b68d848cbae91b28e6089223247a3c45 /ishtar_common/utils.py
parentdc5909e6545c9014c1b8676bed6a9c8927965cc7 (diff)
downloadIshtar-bc470e8759a77bb8ab150403232596598dcf3b4c.tar.bz2
Ishtar-bc470e8759a77bb8ab150403232596598dcf3b4c.zip
Geo: warehouse and container localization are optionnal
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index 49730b496..3054d4a19 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -502,14 +502,21 @@ def post_save_geo(sender, **kwargs):
from ishtar_common.models import get_current_profile # not clean but utils
# is loaded before models
+ profile = get_current_profile()
+ if not profile.mapping:
+ return
instance = kwargs.get('instance')
+ kls_name = instance.__class__.__name__
+
+ if not profile.locate_warehouses and ("Container" in kls_name
+ or "Warehouse" in kls_name):
+ return
+
current_source = "default"
if hasattr(instance.__class__, "_meta"):
current_source = unicode(instance.__class__._meta.verbose_name)
- profile = get_current_profile()
modified = False
-
if hasattr(instance, 'multi_polygon'):
if instance.multi_polygon_source_item and \
instance.multi_polygon_source_item != current_source: # refetch