From 7cdbb30df629409ef9ba8525ad3ea4f10e6f5af5 Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 24 Jan 2019 18:08:18 +0100 Subject: [PATCH] [IMP] make the upload file required when it's displayed --- easy_my_coop/controllers/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/easy_my_coop/controllers/main.py b/easy_my_coop/controllers/main.py index 54cb8b1..6f647ee 100644 --- a/easy_my_coop/controllers/main.py +++ b/easy_my_coop/controllers/main.py @@ -232,7 +232,10 @@ class WebsiteSubscription(http.Controller): return request.website.render(redirect, values) # Check that required field from model subscription_request exists - required_fields = request.env['subscription.request'].sudo().get_required_field() + company = request.website.company_id + required_fields = request.env['subscription.request'].sudo().get_required_field() + if company.allow_id_card_upload: + required_fields.append('file') error = set(field for field in required_fields if not values.get(field)) if error: @@ -259,7 +262,6 @@ class WebsiteSubscription(http.Controller): values["share_product_id"] = product.id # check the subscription's amount - company = request.website.company_id max_amount = company.subscription_maximum_amount total_amount = float(kwargs.get('total_parts'))