diff options
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 |
commit | 11390d9e5517d338788aa23fe048d39df962a42c (patch) | |
tree | 7a64c075b68d848cbae91b28e6089223247a3c45 /ishtar_common/utils.py | |
parent | 90c5f10d2de7a1309a8c7d676cc21b019a504630 (diff) | |
download | Ishtar-11390d9e5517d338788aa23fe048d39df962a42c.tar.bz2 Ishtar-11390d9e5517d338788aa23fe048d39df962a42c.zip |
Geo: warehouse and container localization are optionnal
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 11 |
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 |