From bc470e8759a77bb8ab150403232596598dcf3b4c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 8 Apr 2019 11:22:33 +0200 Subject: Geo: warehouse and container localization are optionnal --- ishtar_common/utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ishtar_common/utils.py') 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 -- cgit v1.2.3