diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-11 17:10:43 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-11 17:10:43 +0100 | 
| commit | 0373340c3f02eb22401380e643f0a698f756fb3a (patch) | |
| tree | c3bb4111f2aa2299533383650495e31ef6988998 /archaeological_warehouse/models.py | |
| parent | df582ec0a708cfac96351fc4521509fef7054dbf (diff) | |
| parent | cde6d2c13a479c24b6a93929938b06c353e7c2c4 (diff) | |
| download | Ishtar-0373340c3f02eb22401380e643f0a698f756fb3a.tar.bz2 Ishtar-0373340c3f02eb22401380e643f0a698f756fb3a.zip  | |
Merge branch 'v0.9' into wheezy
Diffstat (limited to 'archaeological_warehouse/models.py')
| -rw-r--r-- | archaeological_warehouse/models.py | 9 | 
1 files changed, 7 insertions, 2 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index c3c159550..7f7fbeb91 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -158,7 +158,7 @@ class Container(LightHistorizedItem):          related_name='containers')      responsible = models.ForeignKey(          Warehouse, verbose_name=_(u"Responsible warehouse"), -        related_name='owned_containers', blank=True, null=True) +        related_name='owned_containers')      container_type = models.ForeignKey(ContainerType,                                         verbose_name=_("Container type"))      reference = models.CharField(_(u"Container ref."), max_length=40) @@ -216,7 +216,7 @@ class Container(LightHistorizedItem):          if not self.index:              self.skip_history_when_saving = True -            q = Container.objects.filter(location=self.location).order_by( +            q = Container.objects.filter(responsible=self.responsible).order_by(                  '-index')              if q.count():                  self.index = q.all()[0].index + 1 @@ -224,6 +224,11 @@ class Container(LightHistorizedItem):                  self.index = 1              self._cached_label_checked = False              self.save() +        # remove old location in warehouse +        q = ContainerLocalisation.objects.filter(container=self).exclude( +            division__warehouse=self.location) +        for loca in q.all(): +            loca.delete()  post_save.connect(cached_label_changed, sender=Container)  | 
