From 96f0b7f0d6381f210aa9fcf40f78d49d88fe38a7 Mon Sep 17 00:00:00 2001 From: robinkeunen Date: Fri, 25 May 2018 14:31:13 +0200 Subject: [PATCH 1/8] [ADD] require data policy approval --- easy_my_coop/controllers/main.py | 3 +++ easy_my_coop/models/coop.py | 6 ++++++ easy_my_coop/models/partner.py | 1 + easy_my_coop/view/subscription_template.xml | 20 ++++++++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/easy_my_coop/controllers/main.py b/easy_my_coop/controllers/main.py index df70ec3..b3acfc9 100644 --- a/easy_my_coop/controllers/main.py +++ b/easy_my_coop/controllers/main.py @@ -340,6 +340,9 @@ class WebsiteSubscription(http.Controller): values["already_cooperator"] = already_coop values["is_company"] = is_company + if kwargs.get('data_policy_approved', 'off') == 'on': + values['data_policy_approved'] = True + lastname = kwargs.get("lastname").upper() firstname = kwargs.get("firstname").title() diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index c11e312..aac6fe7 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -16,6 +16,7 @@ _REQUIRED = ['email', 'city', 'iban', 'no_registre', + 'data_policy_approved', 'gender'] # Could be improved including required from model @@ -329,6 +330,11 @@ class subscription_request(models.Model): default="website", readonly=True, states={'draft': [('readonly', False)]}) + data_policy_approved = fields.Boolean( + string='Data Policy Approved', + default=False, + # required=True, + ) _order = "id desc" def get_person_info(self, partner): diff --git a/easy_my_coop/models/partner.py b/easy_my_coop/models/partner.py index d3699a5..d03fcc7 100644 --- a/easy_my_coop/models/partner.py +++ b/easy_my_coop/models/partner.py @@ -139,6 +139,7 @@ class ResPartner(models.Model): subscription_request_ids = fields.One2many('subscription.request', 'partner_id', string="Subscription request") + data_policy_approved = fields.Boolean(string="Approved Data Policy") @api.multi @api.depends('subscription_request_ids.state') diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index 4cd4c1f..961ac45 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -240,6 +240,26 @@
+
+ +
+ + + + + +
+ + + La lucidité est la blessure la plus rapprochée du soleil. +
+
+
+
From cb4a6ab8be8ef4773993d3c4d4e258f14b85d57b Mon Sep 17 00:00:00 2001 From: robinkeunen Date: Fri, 25 May 2018 14:33:35 +0200 Subject: [PATCH 2/8] [ADD] add website_legal_page and link to legal pages --- easy_my_coop/__openerp__.py | 1 + easy_my_coop/view/subscription_template.xml | 38 +++++++++++++-------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/easy_my_coop/__openerp__.py b/easy_my_coop/__openerp__.py index d9cef39..652dce3 100644 --- a/easy_my_coop/__openerp__.py +++ b/easy_my_coop/__openerp__.py @@ -31,6 +31,7 @@ "partner_contact_address", "website", "website_recaptcha_reloaded", + "website_legal_page", "theme_light", "base_iban", "email_template_config", diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index 961ac45..39c619c 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -242,21 +242,15 @@
-
- - - - - -
- - - La lucidité est la blessure la plus rapprochée du soleil. -
+
+ +
+
+
@@ -522,6 +516,20 @@
+
+ +
+ +
+
+ +
+
+
From afc28114aa56f72d20e0aeb1a0e10042e7f9c647 Mon Sep 17 00:00:00 2001 From: robinkeunen Date: Fri, 25 May 2018 14:37:30 +0200 Subject: [PATCH 3/8] [IMP] align send button --- easy_my_coop/view/subscription_template.xml | 36 ++++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index 39c619c..891fcef 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -70,13 +70,13 @@ -
+
- +
@@ -530,20 +530,24 @@
- - - - - -
-

-
-
-
- -
-
-
+
+
+ + + + + +
+

+
+
+
+ +
+
+
+
+

From d7b431a202d484c850d1ee4010645b752f15851c Mon Sep 17 00:00:00 2001 From: robinkeunen Date: Fri, 25 May 2018 16:02:11 +0200 Subject: [PATCH 4/8] [IMP] align already cooperator checkbox --- easy_my_coop/view/subscription_template.xml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index 891fcef..92956cd 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -70,13 +70,19 @@
-
- -
- +
+
+ +
+ +
+
+
+
From 5911b3e5bcb9f73a5153bb03cef7086260ee3bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 30 May 2019 16:00:38 +0200 Subject: [PATCH 5/8] [IMP] emc: Complete data_policy_approved processing Now data_policy is shown on a subscription request and also on a partner. --- easy_my_coop/models/coop.py | 9 ++++++--- easy_my_coop/view/res_partner_view.xml | 3 +++ easy_my_coop/view/subscription_request_view.xml | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index aac6fe7..f9f1148 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -450,7 +450,8 @@ class subscription_request(models.Model): 'customer': self.share_product_id.customer, 'out_inv_comm_algorithm': 'random', 'country_id': self.country_id.id, - 'lang': self.lang} + 'lang': self.lang, + 'data_policy_approved': self.data_policy_approved} return partner_vals def get_partner_vals(self): @@ -464,7 +465,8 @@ class subscription_request(models.Model): 'out_inv_comm_algorithm': 'random', 'country_id': self.country_id.id, 'lang': self.lang, 'birthdate_date': self.birthdate, - 'customer': self.share_product_id.customer} + 'customer': self.share_product_id.customer, + 'data_policy_approved': self.data_policy_approved} return partner_vals def create_coop_partner(self): @@ -536,7 +538,8 @@ class subscription_request(models.Model): 'parent_id': partner.id, 'representative': True, 'function': self.contact_person_function, - 'type': 'representative'} + 'type': 'representative', + 'data_policy_approved': self.data_policy_approved} contact = partner_obj.create(contact_vals) else: if len(contact) > 1: diff --git a/easy_my_coop/view/res_partner_view.xml b/easy_my_coop/view/res_partner_view.xml index e775cdb..7c75ac7 100644 --- a/easy_my_coop/view/res_partner_view.xml +++ b/easy_my_coop/view/res_partner_view.xml @@ -30,6 +30,9 @@ + + + diff --git a/easy_my_coop/view/subscription_request_view.xml b/easy_my_coop/view/subscription_request_view.xml index 745596a..f6e34b1 100644 --- a/easy_my_coop/view/subscription_request_view.xml +++ b/easy_my_coop/view/subscription_request_view.xml @@ -79,6 +79,7 @@ + From cdc6d083b6d119f39d7eb75e02958819ad290a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 30 May 2019 16:04:54 +0200 Subject: [PATCH 6/8] [REF] emc: Duplicate key 'customer' This remove a duplicate key in a python dictionary. --- easy_my_coop/models/coop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index f9f1148..5b1353a 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -443,7 +443,7 @@ class subscription_request(models.Model): 'last_name': self.company_name, 'is_company': self.is_company, 'company_register_number': self.company_register_number, #noqa - 'customer': False, 'cooperator': True, + 'cooperator': True, 'street': self.address, 'zip': self.zip_code, 'city': self.city, 'email': self.company_email, 'out_inv_comm_type': 'bba', From 123aabf756e97de5282fe359b782f582ffcb9192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 30 May 2019 18:20:43 +0200 Subject: [PATCH 7/8] [CHG] emc: Remove dependence to website_legal_page This commit removes the dependence to website_legal_page by using it's own template for showing text aside the checkbox in the form. Because the template for this text is not editable by the user (in fact, it is but each time the module is updated, this template is overwritten). Of course website_legal_page can always be installed, and the new template for the text can contain link to the pages generated by website_legal_page. --- easy_my_coop/__openerp__.py | 1 - easy_my_coop/view/subscription_template.xml | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/easy_my_coop/__openerp__.py b/easy_my_coop/__openerp__.py index 652dce3..d9cef39 100644 --- a/easy_my_coop/__openerp__.py +++ b/easy_my_coop/__openerp__.py @@ -31,7 +31,6 @@ "partner_contact_address", "website", "website_recaptcha_reloaded", - "website_legal_page", "theme_light", "base_iban", "email_template_config", diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index 92956cd..d26608f 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -256,7 +256,7 @@ t-attf-value="#{data_policy_approved or ''}"/>
- +
@@ -532,7 +532,7 @@ t-attf-value="#{data_policy_approved or ''}"/>
- +
@@ -589,4 +589,11 @@ + + + + From 54dcbd82ffe71ff6aa2aab7928481f08b8a4d53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 30 May 2019 18:30:27 +0200 Subject: [PATCH 8/8] [ADD] emc: Internal Rules Approved The new cooperator needs to approve internal rules. --- easy_my_coop/__openerp__.py | 2 +- easy_my_coop/controllers/main.py | 3 ++ easy_my_coop/models/coop.py | 15 +++++++-- easy_my_coop/models/partner.py | 1 + easy_my_coop/view/res_partner_view.xml | 1 + .../view/subscription_request_view.xml | 1 + easy_my_coop/view/subscription_template.xml | 33 +++++++++++++++++++ 7 files changed, 52 insertions(+), 4 deletions(-) diff --git a/easy_my_coop/__openerp__.py b/easy_my_coop/__openerp__.py index d9cef39..af28c4c 100644 --- a/easy_my_coop/__openerp__.py +++ b/easy_my_coop/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## { "name": "Easy My Coop", - "version": "1.1", + "version": "9.0.1.2.0", "depends": ["base", "sale", "purchase", diff --git a/easy_my_coop/controllers/main.py b/easy_my_coop/controllers/main.py index b3acfc9..4e08da0 100644 --- a/easy_my_coop/controllers/main.py +++ b/easy_my_coop/controllers/main.py @@ -343,6 +343,9 @@ class WebsiteSubscription(http.Controller): if kwargs.get('data_policy_approved', 'off') == 'on': values['data_policy_approved'] = True + if kwargs.get('internal_rules_approved', 'off') == 'on': + values['internal_rules_approved'] = True + lastname = kwargs.get("lastname").upper() firstname = kwargs.get("firstname").title() diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 5b1353a..636b1e5 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -17,6 +17,7 @@ _REQUIRED = ['email', 'iban', 'no_registre', 'data_policy_approved', + 'internal_rules_approved', 'gender'] # Could be improved including required from model @@ -335,6 +336,11 @@ class subscription_request(models.Model): default=False, # required=True, ) + internal_rules_approved = fields.Boolean( + string='Approved Internal Rules', + default=False, + # required=True, + ) _order = "id desc" def get_person_info(self, partner): @@ -451,7 +457,8 @@ class subscription_request(models.Model): 'out_inv_comm_algorithm': 'random', 'country_id': self.country_id.id, 'lang': self.lang, - 'data_policy_approved': self.data_policy_approved} + 'data_policy_approved': self.data_policy_approved, + 'internal_rules_approved': self.internal_rules_approved} return partner_vals def get_partner_vals(self): @@ -466,7 +473,8 @@ class subscription_request(models.Model): 'country_id': self.country_id.id, 'lang': self.lang, 'birthdate_date': self.birthdate, 'customer': self.share_product_id.customer, - 'data_policy_approved': self.data_policy_approved} + 'data_policy_approved': self.data_policy_approved, + 'internal_rules_approved': self.internal_rules_approved} return partner_vals def create_coop_partner(self): @@ -539,7 +547,8 @@ class subscription_request(models.Model): 'representative': True, 'function': self.contact_person_function, 'type': 'representative', - 'data_policy_approved': self.data_policy_approved} + 'data_policy_approved': self.data_policy_approved, + 'internal_rules_approved': self.internal_rules_approved} contact = partner_obj.create(contact_vals) else: if len(contact) > 1: diff --git a/easy_my_coop/models/partner.py b/easy_my_coop/models/partner.py index d03fcc7..20493ed 100644 --- a/easy_my_coop/models/partner.py +++ b/easy_my_coop/models/partner.py @@ -140,6 +140,7 @@ class ResPartner(models.Model): 'partner_id', string="Subscription request") data_policy_approved = fields.Boolean(string="Approved Data Policy") + internal_rules_approved = fields.Boolean(string="Approved Internal Rules") @api.multi @api.depends('subscription_request_ids.state') diff --git a/easy_my_coop/view/res_partner_view.xml b/easy_my_coop/view/res_partner_view.xml index 7c75ac7..2471d04 100644 --- a/easy_my_coop/view/res_partner_view.xml +++ b/easy_my_coop/view/res_partner_view.xml @@ -32,6 +32,7 @@ + diff --git a/easy_my_coop/view/subscription_request_view.xml b/easy_my_coop/view/subscription_request_view.xml index f6e34b1..6ab0be3 100644 --- a/easy_my_coop/view/subscription_request_view.xml +++ b/easy_my_coop/view/subscription_request_view.xml @@ -80,6 +80,7 @@ + diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index d26608f..8e654cd 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -246,6 +246,21 @@
+
+ +
+ +
+
+ +
+
+ +
@@ -522,6 +537,20 @@
+
+ +
+ +
+
+ +
+
+
@@ -595,5 +624,9 @@ name="Internal Rules Approved Text"> I accept the Data Policy. +