diff options
author | Valérie-Emma Leroux <emma@iggdrasil.net> | 2017-04-07 11:40:31 +0200 |
---|---|---|
committer | Valérie-Emma Leroux <emma@iggdrasil.net> | 2017-04-07 11:40:31 +0200 |
commit | 7f22d3c20cc24debfe123425efa63ec5293e4b4c (patch) | |
tree | f773b80964981c231c892ee5255b94285bc5620a /archaeological_operations/views.py | |
parent | 9127307734c85b816ac7dbb539b565ffb106d60f (diff) | |
parent | da4af2ab5d105f6d2ce442b517e532b7570616e3 (diff) | |
download | Ishtar-7f22d3c20cc24debfe123425efa63ec5293e4b4c.tar.bz2 Ishtar-7f22d3c20cc24debfe123425efa63ec5293e4b4c.zip |
Merge branch 'master' of git.iggdrasil.net:/srv/git/ishtar
Conflicts:
archaeological_operations/templates/ishtar/sheet_operation.html
Diffstat (limited to 'archaeological_operations/views.py')
-rw-r--r-- | archaeological_operations/views.py | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index c4e4acb5e..9b420f594 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -185,20 +185,29 @@ wizard_steps = [ ('final-operation_creation', FinalForm)] -def check_files_for_operation(self): - if not check_rights_condition(['view_file'])(self): - return False - return get_current_profile().files +def get_check_files_for_operation(other_check=None): + def func(self): + if not get_current_profile().files or \ + not check_rights_condition(['view_file'])(self): + return False + if not other_check: + return True + return other_check(self) + return func + +check_files_for_operation = get_check_files_for_operation() + ope_crea_condition_dict = { - 'filechoice-operation_creation': - check_files_for_operation, + 'filechoice-operation_creation': check_files_for_operation, 'preventive-operation_creation': - is_preventive('general-operation_creation', models.OperationType, - 'operation_type', 'prev_excavation'), + get_check_files_for_operation( + is_preventive('general-operation_creation', models.OperationType, + 'operation_type', 'prev_excavation')), 'preventivediag-operation_creation': - is_preventive('general-operation_creation', models.OperationType, - 'operation_type', 'arch_diagnostic'), + get_check_files_for_operation( + is_preventive('general-operation_creation', models.OperationType, + 'operation_type', 'arch_diagnostic')), 'townsgeneral-operation_creation': has_associated_file( 'filechoice-operation_creation', negate=True), 'towns-operation_creation': has_associated_file( @@ -232,25 +241,31 @@ operation_modif_wizard_steps = [ ('final-operation_modification', FinalForm) ] + +ope_modif_condition_dict = { + 'preventive-operation_modification': + get_check_files_for_operation( + is_preventive('general-operation_modification', models.OperationType, + 'operation_type', 'prev_excavation')), + 'preventivediag-operation_modification': + get_check_files_for_operation( + is_preventive('general-operation_modification', models.OperationType, + 'operation_type', 'arch_diagnostic')), + 'townsgeneral-operation_modification': has_associated_file( + 'general-operation_modification', negate=True), + 'towns-operation_modification': has_associated_file( + 'general-operation_modification'), + 'parcelsgeneral-operation_modification': has_associated_file( + 'general-operation_modification', negate=True), + 'parcels-operation_modification': has_associated_file( + 'general-operation_modification'), + +} + operation_modification_wizard = OperationModificationWizard.as_view( operation_modif_wizard_steps, label=_(u"Operation modification"), - condition_dict={ - 'preventive-operation_modification': is_preventive( - 'general-operation_modification', models.OperationType, - 'operation_type', 'prev_excavation'), - 'preventivediag-operation_modification': is_preventive( - 'general-operation_modification', models.OperationType, - 'operation_type', 'arch_diagnostic'), - 'townsgeneral-operation_modification': has_associated_file( - 'general-operation_modification', negate=True), - 'towns-operation_modification': has_associated_file( - 'general-operation_modification'), - 'parcelsgeneral-operation_modification': has_associated_file( - 'general-operation_modification', negate=True), - 'parcels-operation_modification': has_associated_file( - 'general-operation_modification'), -}, + condition_dict=ope_modif_condition_dict, url_name='operation_modification',) |