diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index fbac96975..14e5e1f7e 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -433,6 +433,9 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, cached_label = settings.JOINT.join(items) return cached_label + def _get_associated_cached_labels(self): + return list(self.context_record.all()) + def get_town_label(self): lbl = unicode(_('Intercommunal')) if self.towns.count() == 1: @@ -747,6 +750,7 @@ def operation_post_save(sender, **kwargs): if not kwargs['instance']: return operation = kwargs['instance'] + operation.skip_history_when_saving = True if operation.fnap_financing and operation.cost: fnap_cost = int(float(operation.cost) / 100 * operation.fnap_financing) if not operation.fnap_cost or operation.fnap_cost != fnap_cost: @@ -754,8 +758,9 @@ def operation_post_save(sender, **kwargs): operation.save() elif operation.fnap_cost and operation.cost: fnap_percent = float(operation.fnap_cost) * 100 / operation.cost - operation.fnap_financing = fnap_percent - operation.save() + if operation.fnap_financing != fnap_percent: + operation.fnap_financing = fnap_percent + operation.save() cached_label_changed(sender, **kwargs) if operation.associated_file: operation.associated_file.update_short_menu_class() |