From bb2d0bd69d32717e69fd6a4dcc524cb89f8c38a4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 10 Dec 2018 16:55:17 +0100 Subject: Treatments: manage loan, loan return and packaging by parameters --- archaeological_finds/models_treatments.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'archaeological_finds/models_treatments.py') diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 3d3827596..ee4fde0f0 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -477,7 +477,7 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, # manage loan return for tp in treatment_types: - if tp.txt_idx == 'loan-return': + if tp.restore_reference_location: for find in q.all(): if find.container_ref: find.container = find.container_ref @@ -485,6 +485,7 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, # don't record twice history find.skip_history_when_saving = True find.save() + break # manage containers if not self.container: @@ -492,13 +493,13 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, container_attr = None for tp in treatment_types: - if tp.txt_idx == 'loan': - if container_attr: + if tp.change_current_location: + if container_attr == 'container_ref': # non consistent treatment return container_attr = 'container' - if tp.txt_idx == 'packaging': - if container_attr: + if tp.change_reference_location: + if container_attr == 'container': # non consistent treatment return container_attr = 'container_ref' -- cgit v1.2.3