diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index cf2dcc0d6..8f69dd2e0 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -436,6 +436,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, if self.start_date and not self.year: self.year = self.start_date.year # manage parcel association + """ if FILES_AVAILABLE and self.associated_file: for parcel in self.associated_file.parcels.exclude( operation=self).all(): @@ -452,7 +453,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, parcel.merge(parcels[keys]) else: parcels[keys] = parcel - + """ return super(Operation, self).save(*args, **kwargs) m2m_changed.connect(cached_label_changed, sender=Operation.towns.through) @@ -800,9 +801,11 @@ def parcel_post_save(sender, **kwargs): parcel.external_id = (parcel.section or "") + (parcel.parcel_number or "") parcel.save() return - if parcel.operation and parcel.town not in list(parcel.operation.towns.all()): + if parcel.operation and parcel.operation.pk and \ + parcel.town not in list(parcel.operation.towns.all()): parcel.operation.towns.add(parcel.town) if FILES_AVAILABLE and parcel.associated_file and \ + parcel.associated_file.pk and \ parcel.town not in list(parcel.associated_file.towns.all()): parcel.associated_file.towns.add(parcel.town) if not FILES_AVAILABLE: |