From 9fa96c3d3b10ca0e69a09432731dcaf50a15d7a5 Mon Sep 17 00:00:00 2001 From: nad Date: Tue, 25 Aug 2020 15:57:17 +0200 Subject: [PATCH] Revert "Changing devices transfer_states on delivery note PATCH" This reverts commit 5c562752 --- .../resources/deliverynote/views.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ereuse_devicehub/resources/deliverynote/views.py b/ereuse_devicehub/resources/deliverynote/views.py index 61545b5a..b22e999e 100644 --- a/ereuse_devicehub/resources/deliverynote/views.py +++ b/ereuse_devicehub/resources/deliverynote/views.py @@ -6,7 +6,6 @@ from teal.resource import View from ereuse_devicehub.db import db from ereuse_devicehub.resources.deliverynote.models import Deliverynote -from ereuse_devicehub.resources.device.models import Computer from ereuse_devicehub.resources.lot.models import Lot @@ -33,17 +32,17 @@ class DeliverynoteView(View): 'ethereum_address'), partial=True) d = request.get_json(schema=patch_schema) dlvnote = Deliverynote.query.filter_by(id=id).one() - device_fields = ['transfer_state', 'deliverynote_address'] - computers = [x for x in dlvnote.transferred_devices if isinstance(x, Computer)] + # device_fields = ['transfer_state', 'deliverynote_address'] + # computers = [x for x in dlvnote.transferred_devices if isinstance(x, Computer)] for key, value in d.items(): setattr(dlvnote, key, value) # Transalate ethereum_address attribute - devKey = key - if key == 'ethereum_address': - devKey = 'deliverynote_address' - if devKey in device_fields: - for dev in computers: - setattr(dev, devKey, value) + # devKey = key + # if key == 'ethereum_address': + # devKey = 'deliverynote_address' + # if devKey in device_fields: + # for dev in computers: + # setattr(dev, devKey, value) db.session.commit() return Response(status=204)