From c8681b2994b1a57c4601e82d68281901fbcac159 Mon Sep 17 00:00:00 2001 From: tanshu Date: Mon, 9 Nov 2020 12:50:16 +0530 Subject: [PATCH] Fix: Add product was borking as during check_inventories_are_valid the product_id of inventory was Null --- brewman/brewman/models/voucher.py | 1 + brewman/brewman/routers/fingerprint.py | 1 + 2 files changed, 2 insertions(+) diff --git a/brewman/brewman/models/voucher.py b/brewman/brewman/models/voucher.py index 55130cdf..f0d90a86 100644 --- a/brewman/brewman/models/voucher.py +++ b/brewman/brewman/models/voucher.py @@ -315,6 +315,7 @@ class Inventory(Base): self.product_id = product_id else: self.product = product + self.product_id = product.id if batch is None: self.batch_id = batch_id else: diff --git a/brewman/brewman/routers/fingerprint.py b/brewman/brewman/routers/fingerprint.py index c83dd318..c4da18b6 100644 --- a/brewman/brewman/routers/fingerprint.py +++ b/brewman/brewman/routers/fingerprint.py @@ -86,6 +86,7 @@ def read_file(input_file: UploadFile): else: encoding = "ascii" # raise ValidationError("The encoding of the attendance file is not correct") + input_file.file.close() return StringIO(output.decode(encoding))