From e3483a49c99de90210b489b030929c0458fdc3ea Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 11 Jun 2020 19:43:33 +0200 Subject: [PATCH 1/8] [IMP] hide if not taken in charge by emc --- easy_my_coop/views/res_partner_view.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/easy_my_coop/views/res_partner_view.xml b/easy_my_coop/views/res_partner_view.xml index 44b9659..76d0b98 100644 --- a/easy_my_coop/views/res_partner_view.xml +++ b/easy_my_coop/views/res_partner_view.xml @@ -53,8 +53,10 @@ attrs="{'invisible':[('is_company','=',True)]}"/> - - + + From d6377530bdd827de7de17c6c6e17950a79ce743a Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 11 Jun 2020 19:44:27 +0200 Subject: [PATCH 2/8] [IMP] add internal rules approved field to view --- easy_my_coop/views/subscription_request_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/easy_my_coop/views/subscription_request_view.xml b/easy_my_coop/views/subscription_request_view.xml index 018b556..1cd14b4 100644 --- a/easy_my_coop/views/subscription_request_view.xml +++ b/easy_my_coop/views/subscription_request_view.xml @@ -102,6 +102,7 @@ + From caa27bb20bddb6da4c1451949c6771899114fb8e Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 11 Jun 2020 19:58:02 +0200 Subject: [PATCH 3/8] [IMP] add financial risk approval feature from dedicated PR. https://github.com/coopiteasy/vertical-cooperative/pull/20/files --- easy_my_coop/__manifest__.py | 2 +- easy_my_coop/models/company.py | 16 ++++++++++++++++ easy_my_coop/models/coop.py | 11 ++++++++++- easy_my_coop/models/partner.py | 1 + easy_my_coop/views/res_company_view.xml | 3 +++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/easy_my_coop/__manifest__.py b/easy_my_coop/__manifest__.py index f53712b..15b1ae9 100644 --- a/easy_my_coop/__manifest__.py +++ b/easy_my_coop/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Easy My Coop", "summary": "Manage your cooperative shares", - "version": "12.0.3.0.1", + "version": "12.0.3.0.2", "depends": [ "base", "web", diff --git a/easy_my_coop/models/company.py b/easy_my_coop/models/company.py index 15cc03e..ee27535 100644 --- a/easy_my_coop/models/company.py +++ b/easy_my_coop/models/company.py @@ -81,6 +81,17 @@ class ResCompany(models.Model): translate=True, help="Text to display aside the checkbox to approve internal rules.", ) + display_financial_risk_approval = fields.Boolean( + help="Choose to display a financial risk checkbox on the" + " cooperator website form." + ) + financial_risk_approval_required = fields.Boolean( + string="Is financial risk approval required?" + ) + financial_risk_approval_text = fields.Html( + translate=True, + help="Text to display aside the checkbox to approve financial risk." + ) @api.onchange("data_policy_approval_required") def onchange_data_policy_approval_required(self): @@ -91,3 +102,8 @@ class ResCompany(models.Model): def onchange_internal_rules_approval_required(self): if self.internal_rules_approval_required: self.display_internal_rules_approval = True + + @api.onchange('financial_risk_approval_required') + def onchange_financial_risk_approval_required(self): + if self.financial_risk_approval_required: + self.display_financial_risk_approval = True diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 45ad68c..5037490 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -2,7 +2,6 @@ # Houssine Bakkali # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). - from datetime import datetime # pylint: disable=missing-manifest-dependency @@ -44,6 +43,8 @@ class SubscriptionRequest(models.Model): required_fields.append("data_policy_approved") if company.internal_rules_approval_required: required_fields.append("internal_rules_approved") + if company.financial_risk_approval_required: + required_fields.append('financial_risk_approved') return required_fields def get_mail_template_notif(self, is_company=False): @@ -430,6 +431,11 @@ class SubscriptionRequest(models.Model): internal_rules_approved = fields.Boolean( string="Approved Internal Rules", default=False ) + financial_risk_approved = fields.Boolean( + string='Financial Risk Approved', + default=False, + ) + _order = "id desc" def get_person_info(self, partner): @@ -574,6 +580,7 @@ class SubscriptionRequest(models.Model): "lang": self.lang, "data_policy_approved": self.data_policy_approved, "internal_rules_approved": self.internal_rules_approved, + 'financial_risk_approved': self.financial_risk_approved } return partner_vals @@ -595,6 +602,7 @@ class SubscriptionRequest(models.Model): "customer": self.share_product_id.customer, "data_policy_approved": self.data_policy_approved, "internal_rules_approved": self.internal_rules_approved, + "financial_risk_approved": self.financial_risk_approved } return partner_vals @@ -623,6 +631,7 @@ class SubscriptionRequest(models.Model): "type": "representative", "data_policy_approved": self.data_policy_approved, "internal_rules_approved": self.internal_rules_approved, + "financial_risk_approved": self.financial_risk_approved, } return contact_vals diff --git a/easy_my_coop/models/partner.py b/easy_my_coop/models/partner.py index b4b1752..4af1da0 100644 --- a/easy_my_coop/models/partner.py +++ b/easy_my_coop/models/partner.py @@ -178,6 +178,7 @@ class ResPartner(models.Model): legal_form = fields.Selection([("", "")], string="Legal form") data_policy_approved = fields.Boolean(string="Approved Data Policy") internal_rules_approved = fields.Boolean(string="Approved Internal Rules") + financial_risk_approved = fields.Boolean(string="Approved Financial Risk") @api.multi @api.depends("subscription_request_ids.state") diff --git a/easy_my_coop/views/res_company_view.xml b/easy_my_coop/views/res_company_view.xml index 3ee14a5..1ae5efe 100644 --- a/easy_my_coop/views/res_company_view.xml +++ b/easy_my_coop/views/res_company_view.xml @@ -28,6 +28,9 @@ + + + From 45ab75d2be2a8f866081cdf352cb0e1e7beb23fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 25 Jun 2020 23:04:09 +0200 Subject: [PATCH 4/8] [FIX] emc_website: financial risk not shown in form --- easy_my_coop_website/controllers/main.py | 8 ++++++- .../views/subscription_template.xml | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/easy_my_coop_website/controllers/main.py b/easy_my_coop_website/controllers/main.py index 20e07c4..bcdad5b 100644 --- a/easy_my_coop_website/controllers/main.py +++ b/easy_my_coop_website/controllers/main.py @@ -217,7 +217,10 @@ class WebsiteSubscription(http.Controller): "data_policy_text": comp.data_policy_approval_text, "display_internal_rules": comp.display_internal_rules_approval, "internal_rules_required": comp.internal_rules_approval_required, - "internal_rules_text": comp.internal_rules_approval_text, + "internal_rules_text": comp.financial_risk_approval_text, + "display_financial_risk": comp.display_financial_risk_approval, + "financial_risk_required": comp.financial_risk_approval_required, + "financial_risk_text": comp.financial_risk_approval_text, } ) return values @@ -437,6 +440,9 @@ class WebsiteSubscription(http.Controller): if kwargs.get("internal_rules_approved", "off") == "on": values["internal_rules_approved"] = True + if kwargs.get("financial_risk_approved", "off") == "on": + values["financial_risk_approved"] = True + lastname = kwargs.get("lastname").upper() firstname = kwargs.get("firstname").title() diff --git a/easy_my_coop_website/views/subscription_template.xml b/easy_my_coop_website/views/subscription_template.xml index f12f8b6..70d2fbb 100644 --- a/easy_my_coop_website/views/subscription_template.xml +++ b/easy_my_coop_website/views/subscription_template.xml @@ -470,6 +470,27 @@ + +
+ +
+
+ +
+
+
+
From 388022ed0f12098642bb44f77705023434b6b1d9 Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Fri, 31 Jul 2020 16:31:20 +0200 Subject: [PATCH 5/8] [ADD] easy_my_coop: financial_risk_approved in partner view and subscription view --- easy_my_coop/views/res_partner_view.xml | 4 +++- easy_my_coop/views/subscription_request_view.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/easy_my_coop/views/res_partner_view.xml b/easy_my_coop/views/res_partner_view.xml index 76d0b98..8b4c3cf 100644 --- a/easy_my_coop/views/res_partner_view.xml +++ b/easy_my_coop/views/res_partner_view.xml @@ -53,9 +53,11 @@ attrs="{'invisible':[('is_company','=',True)]}"/> + - diff --git a/easy_my_coop/views/subscription_request_view.xml b/easy_my_coop/views/subscription_request_view.xml index 1cd14b4..1647629 100644 --- a/easy_my_coop/views/subscription_request_view.xml +++ b/easy_my_coop/views/subscription_request_view.xml @@ -103,6 +103,7 @@ + From 71a618a4533975470b6107b223030d8fdfc43c4c Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Fri, 31 Jul 2020 16:42:56 +0200 Subject: [PATCH 6/8] [FIX] easy_my_coop_website: country field mandatory, fix default id of 'Belgium' when not found --- easy_my_coop_website/controllers/main.py | 4 ++-- easy_my_coop_website/views/subscription_template.xml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/easy_my_coop_website/controllers/main.py b/easy_my_coop_website/controllers/main.py index bcdad5b..648cf1d 100644 --- a/easy_my_coop_website/controllers/main.py +++ b/easy_my_coop_website/controllers/main.py @@ -199,12 +199,12 @@ class WebsiteSubscription(http.Controller): if company.default_country_id: values["country_id"] = company.default_country_id.id else: - values["country_id"] = "21" + values["country_id"] = "20" if not values.get("activities_country_id"): if company.default_country_id: values["activities_country_id"] = company.default_country_id.id else: - values["activities_country_id"] = "21" + values["activities_country_id"] = "20" if not values.get("lang"): if company.default_lang_id: values["lang"] = company.default_lang_id.code diff --git a/easy_my_coop_website/views/subscription_template.xml b/easy_my_coop_website/views/subscription_template.xml index 70d2fbb..8cf57a4 100644 --- a/easy_my_coop_website/views/subscription_template.xml +++ b/easy_my_coop_website/views/subscription_template.xml @@ -309,6 +309,7 @@ From 2dd0a8a3c9a3a83d30fee42f5e23fa16b1b668cd Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Tue, 4 Aug 2020 17:04:26 +0200 Subject: [PATCH 7/8] [REF] easy_my_coop_website: order Internal rules, Data policy, Financial risk --- easy_my_coop/views/res_company_view.xml | 6 ++-- easy_my_coop/views/res_partner_view.xml | 4 +-- .../views/subscription_request_view.xml | 2 +- .../views/subscription_template.xml | 32 +++++++++---------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/easy_my_coop/views/res_company_view.xml b/easy_my_coop/views/res_company_view.xml index 1ae5efe..f113dee 100644 --- a/easy_my_coop/views/res_company_view.xml +++ b/easy_my_coop/views/res_company_view.xml @@ -22,12 +22,12 @@ - - - + + + diff --git a/easy_my_coop/views/res_partner_view.xml b/easy_my_coop/views/res_partner_view.xml index 8b4c3cf..be1c97f 100644 --- a/easy_my_coop/views/res_partner_view.xml +++ b/easy_my_coop/views/res_partner_view.xml @@ -53,10 +53,10 @@ attrs="{'invisible':[('is_company','=',True)]}"/> - + diff --git a/easy_my_coop/views/subscription_request_view.xml b/easy_my_coop/views/subscription_request_view.xml index 1647629..a44d7f5 100644 --- a/easy_my_coop/views/subscription_request_view.xml +++ b/easy_my_coop/views/subscription_request_view.xml @@ -101,8 +101,8 @@ - + diff --git a/easy_my_coop_website/views/subscription_template.xml b/easy_my_coop_website/views/subscription_template.xml index 8cf57a4..5bfeb3c 100644 --- a/easy_my_coop_website/views/subscription_template.xml +++ b/easy_my_coop_website/views/subscription_template.xml @@ -432,41 +432,41 @@
-
-
From 3ee3eb077dcd563b5b6a5198d45b99390bc14f45 Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Wed, 5 Aug 2020 11:46:00 +0200 Subject: [PATCH 8/8] fixup! [REF] easy_my_coop_website: order Internal rules, Data policy, Financial risk --- easy_my_coop_website/controllers/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easy_my_coop_website/controllers/main.py b/easy_my_coop_website/controllers/main.py index 648cf1d..0e37dde 100644 --- a/easy_my_coop_website/controllers/main.py +++ b/easy_my_coop_website/controllers/main.py @@ -217,7 +217,7 @@ class WebsiteSubscription(http.Controller): "data_policy_text": comp.data_policy_approval_text, "display_internal_rules": comp.display_internal_rules_approval, "internal_rules_required": comp.internal_rules_approval_required, - "internal_rules_text": comp.financial_risk_approval_text, + "internal_rules_text": comp.internal_rules_approval_text, "display_financial_risk": comp.display_financial_risk_approval, "financial_risk_required": comp.financial_risk_approval_required, "financial_risk_text": comp.financial_risk_approval_text, @@ -259,7 +259,7 @@ class WebsiteSubscription(http.Controller): redirect = "easy_my_coop_website.becomecompanycooperator" email = kwargs.get("company_email") # TODO: Use a overloaded function with the captcha implementation - if request.website.company_id.captcha_type == 'google': + if request.website.company_id.captcha_type == "google": if ( "g-recaptcha-response" not in kwargs or kwargs["g-recaptcha-response"] == ""