diff options
-rw-r--r-- | changelog/en/changelog_2022-06-15.md | 1 | ||||
-rw-r--r-- | changelog/fr/changelog_2023-01-25.md | 1 | ||||
-rw-r--r-- | ishtar_common/utils.py | 8 |
3 files changed, 7 insertions, 3 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md index 27fd43178..98f1c5931 100644 --- a/changelog/en/changelog_2022-06-15.md +++ b/changelog/en/changelog_2022-06-15.md @@ -6,6 +6,7 @@ v4.0.51 - 2099-07-03 ### Bug fixes ### - fix parcel table - wizard summary (inappropriate l10n) +- check of external identifiers when updating cached labels (refs #5603) v4.0.50 - 2023-07-03 diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md index 4e16e2975..7f91da187 100644 --- a/changelog/fr/changelog_2023-01-25.md +++ b/changelog/fr/changelog_2023-01-25.md @@ -6,6 +6,7 @@ v4.0.51 - 2099-07-03 ### Corrections de dysfonctionnements ### - correction de l'affichage des parcelles et du résumé du `wizard` (localisation inappropriée) +- vérification des identifiants externes lors de la mise à jour des libellés en cache (refs #5603) v4.0.50 - 2023-07-03 diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index c6c14422c..673821c14 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -544,6 +544,7 @@ def load_task(task_func, task_name, checks, sender, **kwargs): def cached_label_changed(sender, **kwargs): + load_task(_external_id_changed, "external_id_changed", None, sender, **kwargs) return load_task(_cached_label_changed, "cached_label_changed", None, sender, **kwargs) @@ -633,7 +634,8 @@ def external_id_changed(sender, **kwargs): @task() def _external_id_changed(sender, **kwargs): sender, instance = deserialize_args_for_tasks(sender, kwargs, EXTRA_KWARGS_TRIGGER) - if not instance: + if not instance or not hasattr(instance, "external_id") \ + or not hasattr(instance, "auto_external_id"): return updated = False instance.no_post_process() @@ -643,12 +645,12 @@ def _external_id_changed(sender, **kwargs): updated = True instance.auto_external_id = True instance.external_id = external_id - updated |= instance.regenerate_all_ids(save=False) + if hasattr(instance, "regenerate_all_ids"): + updated |= instance.regenerate_all_ids(save=False) or False if updated: instance.save() - def shortify(lbl, number=20): SHORTIFY_STR = ugettext(" (...)") if not lbl: |