diff --git a/easy_my_coop_loan_website/__manifest__.py b/easy_my_coop_loan_website/__manifest__.py index 2962857..1f489ca 100644 --- a/easy_my_coop_loan_website/__manifest__.py +++ b/easy_my_coop_loan_website/__manifest__.py @@ -5,7 +5,11 @@ { "name": "Easy My Coop Loan Issues Website", "version": "12.0.1.0.1", - "depends": ["easy_my_coop_loan", "easy_my_coop_website", "website"], + "depends": [ + "easy_my_coop_loan", + "easy_my_coop_website", + "website", + ], "author": "Coop IT Easy SCRLfs", "category": "Cooperative management", "website": "http://www.coopiteasy.be", @@ -14,6 +18,9 @@ This module implements the subscription page for bonds and subordinated loans. """, - "data": ["data/website_loan_data.xml", "template/loan_issue_template.xml"], + "data": [ + "data/website_loan_data.xml", + "template/loan_issue_template.xml" + ], "installable": True, } diff --git a/easy_my_coop_loan_website/controllers/main.py b/easy_my_coop_loan_website/controllers/main.py index e16271e..6e31b0b 100644 --- a/easy_my_coop_loan_website/controllers/main.py +++ b/easy_my_coop_loan_website/controllers/main.py @@ -26,6 +26,21 @@ class WebsiteLoanIssueSubscription(http.Controller): else: return False + def missing_mandatory_info(self): + partner = request.env.user.partner_id + if ( + not partner.bank_ids + or not partner.birthdate_date + or not partner.street + or not partner.city + or not partner.zip + or not partner.country_id + or not partner.gender + or not partner.phone + ): + return False + return True + @http.route( ["/subscription/loan_issue_form"], type="http", @@ -34,8 +49,9 @@ class WebsiteLoanIssueSubscription(http.Controller): ) def display_loan_issue_subscription_page(self, **kwargs): values = {} - partner = request.env.user.partner_id - is_company = partner.is_company + if not self.missing_mandatory_info(): + return request.redirect("/my/account") + is_company = request.env.user.partner_id.is_company values = self.fill_values(values, is_company) values.update(kwargs=kwargs.items()) diff --git a/easy_my_coop_website/__manifest__.py b/easy_my_coop_website/__manifest__.py index fcc6f4c..07656db 100644 --- a/easy_my_coop_website/__manifest__.py +++ b/easy_my_coop_website/__manifest__.py @@ -6,7 +6,11 @@ { "name": "Easy My Coop Website", "version": "12.0.1.0.4", - "depends": ["easy_my_coop", "website", "website_recaptcha_reloaded"], + "depends": [ + "easy_my_coop", + "website", + "website_recaptcha_reloaded", + ], "author": "Coop IT Easy SCRLfs", "category": "Cooperative management", "website": "https://coopiteasy.be",