From 4a49311eb13ccefb5b51a72e4331512a4f8256d7 Mon Sep 17 00:00:00 2001 From: "mark.j0hnst0n" Date: Wed, 3 Jul 2024 10:40:54 +0100 Subject: [PATCH] amend function --- mail/libraries/lite_to_edifact_converter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mail/libraries/lite_to_edifact_converter.py b/mail/libraries/lite_to_edifact_converter.py index 24b38140..60173294 100644 --- a/mail/libraries/lite_to_edifact_converter.py +++ b/mail/libraries/lite_to_edifact_converter.py @@ -137,11 +137,11 @@ def generate_lines_for_licence(licence: LicencePayload) -> Iterable[chieftypes._ controlled_by = "Q" # usage is controlled by quantity only quantity = commodity.get("quantity") - try: - qunit = UnitMapping[commodity["unit"]] - except KeyError: + if commodity["unit"] in LegacyUnitCodeMapping: qunit = LegacyUnitCodeMapping[commodity["unit"]] - + else: + qunit = UnitMapping[commodity["unit"]] + if qunit == UnitMapping.NAR: quantity = int(quantity) yield chieftypes.LicenceDataLine(