diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-24 17:48:18 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-24 17:48:55 +0100 | 
| commit | 6e81fe7da4520cb852ea7cb580317513a4eca76a (patch) | |
| tree | baf65f96b3ab499cf60cb1d7c134ac8c8edd0d3e /archaeological_warehouse/wizards.py | |
| parent | d28045d3cd9147942f11c8c063b9f2b756439572 (diff) | |
| download | Ishtar-6e81fe7da4520cb852ea7cb580317513a4eca76a.tar.bz2 Ishtar-6e81fe7da4520cb852ea7cb580317513a4eca76a.zip | |
Warehouse: divisions forms is readonly if containers are localised in this warehouse (refs #3563)
Diffstat (limited to 'archaeological_warehouse/wizards.py')
| -rw-r--r-- | archaeological_warehouse/wizards.py | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/archaeological_warehouse/wizards.py b/archaeological_warehouse/wizards.py index 9ecc16b3f..571e56b1b 100644 --- a/archaeological_warehouse/wizards.py +++ b/archaeological_warehouse/wizards.py @@ -64,6 +64,20 @@ class WarehouseModificationWizard(Wizard):      model = models.Warehouse      modification = True      wizard_done_window = reverse_lazy('show-warehouse') +    wizard_templates = { +        'divisions-warehouse_modification': +            'ishtar/wizard/wizard_warehouse_divisions.html', +    } + +    def get_form_kwargs(self, step=None): +        kwargs = super(WarehouseModificationWizard, self).get_form_kwargs(step) +        if step == "divisions-warehouse_modification": +            current_warehouse = self.get_current_object() +            q = models.ContainerLocalisation.objects.filter( +                    division__warehouse=current_warehouse) +            if q.count(): +                kwargs['readonly'] = True +        return kwargs  class WarehouseDeletionWizard(DeletionWizard): | 
