From ff68a61c1bd0d210efedf3fa64a0b82ed68b0d80 Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 28 Nov 2019 15:09:24 +0100 Subject: [PATCH 01/10] [IMP] remove bond issue flag. --- easy_my_coop_loan/models/loan.py | 2 -- easy_my_coop_loan/views/loan_view.xml | 1 - 2 files changed, 3 deletions(-) diff --git a/easy_my_coop_loan/models/loan.py b/easy_my_coop_loan/models/loan.py index 90abdc1..f9f282f 100644 --- a/easy_my_coop_loan/models/loan.py +++ b/easy_my_coop_loan/models/loan.py @@ -20,7 +20,6 @@ class LoanIssue(models.Model): name = fields.Char(string="Name", translate=True) - is_bond = fields.Boolean(string="Is a bond issue?") default_issue = fields.Boolean(string="Default issue") subscription_start_date = fields.Date(string="Start date subscription period") subscription_end_date = fields.Date(string="End date subscription period") @@ -94,7 +93,6 @@ class LoanIssue(models.Model): @api.multi def get_web_issues(self, is_company): bond_issues = self.search([ - ('is_bond', '=', True), ('display_on_website', '=', True), ('state', '=', 'ongoing') ]) diff --git a/easy_my_coop_loan/views/loan_view.xml b/easy_my_coop_loan/views/loan_view.xml index 2544a1d..b287cee 100644 --- a/easy_my_coop_loan/views/loan_view.xml +++ b/easy_my_coop_loan/views/loan_view.xml @@ -56,7 +56,6 @@ - From dcf395f0d5a7355a0c67bfb2af1e83a7fd246149 Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 28 Nov 2019 15:43:11 +0100 Subject: [PATCH 02/10] [IMP] better display of the fields and hide some if not needed --- easy_my_coop_loan/views/loan_view.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/easy_my_coop_loan/views/loan_view.xml b/easy_my_coop_loan/views/loan_view.xml index b287cee..e3786d5 100644 --- a/easy_my_coop_loan/views/loan_view.xml +++ b/easy_my_coop_loan/views/loan_view.xml @@ -61,12 +61,12 @@ - - - - + + + + From 33fcefffd3db75b8b15a8f3b41a1cc641b355b9a Mon Sep 17 00:00:00 2001 From: houssine Date: Fri, 29 Nov 2019 10:35:35 +0100 Subject: [PATCH 03/10] [IMP] allow cancel when sub request is in waiting state --- easy_my_coop/views/subscription_request_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easy_my_coop/views/subscription_request_view.xml b/easy_my_coop/views/subscription_request_view.xml index 6e724a6..e6ecc23 100644 --- a/easy_my_coop/views/subscription_request_view.xml +++ b/easy_my_coop/views/subscription_request_view.xml @@ -34,7 +34,7 @@
From 1d9bde18ad2807fa401702ea02fe8ba0ef75f954 Mon Sep 17 00:00:00 2001 From: houssine Date: Fri, 29 Nov 2019 16:53:04 +0100 Subject: [PATCH 04/10] [FIX] get mail template should been done on newly created sub request --- easy_my_coop/models/coop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 6e39080..e67b60c 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -58,7 +58,6 @@ class SubscriptionRequest(models.Model): @api.model def create(self, vals): partner_obj = self.env['res.partner'] - mail_template_notif = self.get_mail_template_notif(False) if not vals.get('partner_id'): cooperator = False @@ -81,13 +80,13 @@ class SubscriptionRequest(models.Model): cooperator.write({'cooperator': True}) subscr_request = super(SubscriptionRequest, self).create(vals) + mail_template_notif = subscr_request.get_mail_template_notif(False) mail_template_notif.send_mail(subscr_request.id) return subscr_request @api.model def create_comp_sub_req(self, vals): - confirmation_mail_template = self.get_mail_template_notif(True) vals["name"] = vals['company_name'] if not vals.get('partner_id'): cooperator = self.env['res.partner'].get_cooperator_from_crn(vals.get('company_register_number')) @@ -97,6 +96,7 @@ class SubscriptionRequest(models.Model): vals['already_cooperator'] = True subscr_request = super(SubscriptionRequest, self).create(vals) + confirmation_mail_template = subscr_request.get_mail_template_notif(True) confirmation_mail_template.send_mail(subscr_request.id) return subscr_request From 6953379a57dddd3ac9040d9220b7daa9bb0a0f0c Mon Sep 17 00:00:00 2001 From: houssine Date: Tue, 3 Dec 2019 18:47:14 +0100 Subject: [PATCH 05/10] [FIX] remove uneeded buggy assignation --- easy_my_coop/models/coop.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index e67b60c..88ae64a 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -553,9 +553,6 @@ class SubscriptionRequest(models.Model): if domain: partner = partner_obj.search(domain) - if not partner.cooperator: - partner.cooperator = True - if not partner: partner = self.create_coop_partner() else: From 228820b458a991f776cf4bc06dd1a365e3ce316f Mon Sep 17 00:00:00 2001 From: houssine Date: Tue, 3 Dec 2019 18:51:57 +0100 Subject: [PATCH 06/10] [FIX] assign created partner to self if created --- easy_my_coop/models/coop.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 88ae64a..bbf94f0 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -555,6 +555,7 @@ class SubscriptionRequest(models.Model): if not partner: partner = self.create_coop_partner() + self.partner_id = partner else: partner = partner[0] @@ -585,7 +586,7 @@ class SubscriptionRequest(models.Model): 'representative': True}) invoice = self.create_invoice(partner) - self.write({'partner_id': partner.id, 'state': 'done'}) + self.write({'state': 'done'}) self.set_membership() return invoice From 90f6bd776fb4234e12ec07809e6545f3db880718 Mon Sep 17 00:00:00 2001 From: houssine Date: Tue, 3 Dec 2019 21:14:01 +0100 Subject: [PATCH 07/10] [FIX] fix wrong attribute name --- 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 bbf94f0..6d8f71a 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -502,7 +502,7 @@ class SubscriptionRequest(models.Model): 'out_inv_comm_algorithm': 'random', 'lang': self.lang, 'birthdate_date': self.birthdate, - 'parent_id': self.partner.id, + 'parent_id': self.partner_id.id, 'representative': True, 'function': self.contact_person_function, 'type': 'representative', From 3995b17a33f15c220917cbe3ef4b3c0924a7b8dc Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 5 Dec 2019 16:48:51 +0100 Subject: [PATCH 08/10] [IMP] set noupdate false to allow update --- easy_my_coop_loan/data/mail_template_data.xml | 226 +++++++++--------- 1 file changed, 113 insertions(+), 113 deletions(-) diff --git a/easy_my_coop_loan/data/mail_template_data.xml b/easy_my_coop_loan/data/mail_template_data.xml index 4c708c9..354b828 100644 --- a/easy_my_coop_loan/data/mail_template_data.xml +++ b/easy_my_coop_loan/data/mail_template_data.xml @@ -1,113 +1,113 @@ - - - - - - Loan Subscription Confirmation Email - ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} - ${object.company_id.name} Loan subscription confirmation (Ref ${object.loan_issue_id.name or 'n/a'}) - ${object.partner_id.email} - ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} - - - ${object.partner_id.lang} - - - -

Hello ${object.partner_id.name},

- -

Your request will be soon processed by our team. If all the provided info are correct you will soon receive the payment information in another email

- -
-

If you have any question, do not hesitate to contact us.

-
- -

Sustainably your,

-

${object.company_id.name}.

- - % if object.company_id.street: - ${object.company_id.street} - % endif - % if object.company_id.street2: - ${object.company_id.street2}
- % endif - % if object.company_id.city or object.company_id.zip: - ${object.company_id.zip} ${object.company_id.city}
- % endif - % if object.company_id.country_id: - ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
- % endif - % if object.company_id.phone: - Phone:  ${object.company_id.phone} - % endif - - % if object.company_id.website: - - %endif - -
- -
- - ]]>
-
- - - Loan Issue Payment Request - Send by Email - ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} - ${object.company_id.name} Payment request (Ref ${object.loan_issue_id.name or 'n/a'}) - ${object.partner_id.id} - ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} - - - ${object.partner_id.lang} - - - -

Hello ${object.partner_id.name},

- -

Find here after the necessary information for the payment. We kindly remind you that your subscription will be effective only once we received the payment.

- -

Amount: ${object.amount} ${object.loan_issue_id.company_currency_id.symbol}

-

Account number: ${object.company_id.bank_ids[0].sanitized_acc_number}

-

Communication: ${object.loan_issue_id.name} + ${object.partner_id.name}

- -

Sustainably your,

-

${object.company_id.name}.

- - % if object.company_id.street: - ${object.company_id.street} - % endif - % if object.company_id.street2: - ${object.company_id.street2}
- % endif - % if object.company_id.city or object.company_id.zip: - ${object.company_id.zip} ${object.company_id.city}
- % endif - % if object.company_id.country_id: - ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
- % endif - % if object.company_id.phone: - Phone:  ${object.company_id.phone} - % endif - - % if object.company_id.website: - - %endif - -
- -
- - ]]>
-
- -
-
+ + + + + + Loan Subscription Confirmation Email + ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} + ${object.company_id.name} Loan subscription confirmation (Ref ${object.loan_issue_id.name or 'n/a'}) + ${object.partner_id.email} + ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} + + + ${object.partner_id.lang} + + + +

Hello ${object.partner_id.name},

+ +

Your request will be soon processed by our team. If all the provided info are correct you will soon receive the payment information in another email

+ +
+

If you have any question, do not hesitate to contact us.

+
+ +

Sustainably your,

+

${object.company_id.name}.

+ + % if object.company_id.street: + ${object.company_id.street} + % endif + % if object.company_id.street2: + ${object.company_id.street2}
+ % endif + % if object.company_id.city or object.company_id.zip: + ${object.company_id.zip} ${object.company_id.city}
+ % endif + % if object.company_id.country_id: + ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
+ % endif + % if object.company_id.phone: + Phone:  ${object.company_id.phone} + % endif + + % if object.company_id.website: + + %endif + +
+ +
+ + ]]>
+
+ + + Loan Issue Payment Request - Send by Email + ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} + ${object.company_id.name} Payment request (Ref ${object.loan_issue_id.name or 'n/a'}) + ${object.partner_id.id} + ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe} + + + ${object.partner_id.lang} + + + +

Hello ${object.partner_id.name},

+ +

Find here after the necessary information for the payment. We kindly remind you that your subscription will be effective only once we received the payment.

+ +

Amount: ${object.amount} ${object.loan_issue_id.company_currency_id.symbol}

+

Account number: ${object.company_id.bank_ids[0].sanitized_acc_number}

+

Communication: ${object.loan_issue_id.name} + ${object.partner_id.name}

+ +

Sustainably your,

+

${object.company_id.name}.

+ + % if object.company_id.street: + ${object.company_id.street} + % endif + % if object.company_id.street2: + ${object.company_id.street2}
+ % endif + % if object.company_id.city or object.company_id.zip: + ${object.company_id.zip} ${object.company_id.city}
+ % endif + % if object.company_id.country_id: + ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
+ % endif + % if object.company_id.phone: + Phone:  ${object.company_id.phone} + % endif + + % if object.company_id.website: + + %endif + +
+ +
+ + ]]>
+
+ +
+
From 6a923f8e3b7913b597a5169de8a66923585d0a98 Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 5 Dec 2019 21:54:39 +0100 Subject: [PATCH 09/10] [IMP] remove commented code --- easy_my_coop/models/mail_template.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/easy_my_coop/models/mail_template.py b/easy_my_coop/models/mail_template.py index f346a21..b78c7f7 100644 --- a/easy_my_coop/models/mail_template.py +++ b/easy_my_coop/models/mail_template.py @@ -1,12 +1,7 @@ -from odoo import models, fields - - -class MailTemplate(models.Model): - _inherit = "mail.template" - -# def init(self): -# for template_id in EMAIL_TEMPLATE_IDS: -# mail_template = self.env.ref(template_id) -# mail_template.easy_my_coop = True - - easy_my_coop = fields.Boolean(string="Easy my coop mail template") +from odoo import models, fields + + +class MailTemplate(models.Model): + _inherit = "mail.template" + + easy_my_coop = fields.Boolean(string="Easy my coop mail template") From 007057d839efcffc6e4ad41f13b258edf19950af Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 5 Dec 2019 21:55:58 +0100 Subject: [PATCH 10/10] [IMP] set it back to noupdate True --- easy_my_coop_loan/data/mail_template_data.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easy_my_coop_loan/data/mail_template_data.xml b/easy_my_coop_loan/data/mail_template_data.xml index 354b828..85641ae 100644 --- a/easy_my_coop_loan/data/mail_template_data.xml +++ b/easy_my_coop_loan/data/mail_template_data.xml @@ -2,7 +2,7 @@ - + Loan Subscription Confirmation Email ${(object.company_id.coop_email_contact or object.loan_issue_id.user_id.email)|safe}