From 3e235cdcf9436c4dccd8346f022cf26660a2ddc5 Mon Sep 17 00:00:00 2001 From: Vincent Van Rossem Date: Tue, 9 Jun 2020 18:38:24 +0200 Subject: [PATCH] [FIX] website_portal_restrict_modification: generic field order --- website_portal_restrict_modification/controllers/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website_portal_restrict_modification/controllers/main.py b/website_portal_restrict_modification/controllers/main.py index 68da976..d1d0c34 100644 --- a/website_portal_restrict_modification/controllers/main.py +++ b/website_portal_restrict_modification/controllers/main.py @@ -22,13 +22,13 @@ class CustomerPortalRestrictModification(CustomerPortal): # since we override mandatory and optional billing fields, # parent method will insert the following key/value in `error` dict and `error_message` list, - # preventing from saving the form. Workaround is to clear both dict and list. + # preventing from saving the form. Workaround is to remove them from both dict and list. if ( error.get("common") - and error["common"] == "Unknown field" - and "Unknown field 'name,email,company_name,vat'" in error_message + and error["common"].lower() == "unknown field" + and any("unknown field" in s.lower() for s in error_message) ): error.pop("common") - error_message.remove("Unknown field 'name,email,company_name,vat'") + error_message = [s for s in error_message if "unknown field" not in s.lower()] return error, error_message