Browse Source

Merge pull request #105 from coopiteasy/12.0-some-fix-and-financial-risk

12.0 some fix and financial risk
pull/122/head
Rémy Taymans 4 years ago
committed by GitHub
parent
commit
f59c45a40c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      easy_my_coop/__manifest__.py
  2. 16
      easy_my_coop/models/company.py
  3. 11
      easy_my_coop/models/coop.py
  4. 1
      easy_my_coop/models/partner.py
  5. 9
      easy_my_coop/views/res_company_view.xml
  6. 8
      easy_my_coop/views/res_partner_view.xml
  7. 2
      easy_my_coop/views/subscription_request_view.xml
  8. 10
      easy_my_coop_website/controllers/main.py
  9. 39
      easy_my_coop_website/views/subscription_template.xml

2
easy_my_coop/__manifest__.py

@ -7,7 +7,7 @@
{ {
"name": "Easy My Coop", "name": "Easy My Coop",
"summary": "Manage your cooperative shares", "summary": "Manage your cooperative shares",
"version": "12.0.3.0.1",
"version": "12.0.3.0.2",
"depends": [ "depends": [
"base", "base",
"web", "web",

16
easy_my_coop/models/company.py

@ -81,6 +81,17 @@ class ResCompany(models.Model):
translate=True, translate=True,
help="Text to display aside the checkbox to approve internal rules.", 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") @api.onchange("data_policy_approval_required")
def onchange_data_policy_approval_required(self): def onchange_data_policy_approval_required(self):
@ -91,3 +102,8 @@ class ResCompany(models.Model):
def onchange_internal_rules_approval_required(self): def onchange_internal_rules_approval_required(self):
if self.internal_rules_approval_required: if self.internal_rules_approval_required:
self.display_internal_rules_approval = True 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

11
easy_my_coop/models/coop.py

@ -2,7 +2,6 @@
# Houssine Bakkali <houssine@coopiteasy.be> # Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime from datetime import datetime
# pylint: disable=missing-manifest-dependency # pylint: disable=missing-manifest-dependency
@ -44,6 +43,8 @@ class SubscriptionRequest(models.Model):
required_fields.append("data_policy_approved") required_fields.append("data_policy_approved")
if company.internal_rules_approval_required: if company.internal_rules_approval_required:
required_fields.append("internal_rules_approved") required_fields.append("internal_rules_approved")
if company.financial_risk_approval_required:
required_fields.append('financial_risk_approved')
return required_fields return required_fields
def get_mail_template_notif(self, is_company=False): def get_mail_template_notif(self, is_company=False):
@ -430,6 +431,11 @@ class SubscriptionRequest(models.Model):
internal_rules_approved = fields.Boolean( internal_rules_approved = fields.Boolean(
string="Approved Internal Rules", default=False string="Approved Internal Rules", default=False
) )
financial_risk_approved = fields.Boolean(
string='Financial Risk Approved',
default=False,
)
_order = "id desc" _order = "id desc"
def get_person_info(self, partner): def get_person_info(self, partner):
@ -574,6 +580,7 @@ class SubscriptionRequest(models.Model):
"lang": self.lang, "lang": self.lang,
"data_policy_approved": self.data_policy_approved, "data_policy_approved": self.data_policy_approved,
"internal_rules_approved": self.internal_rules_approved, "internal_rules_approved": self.internal_rules_approved,
'financial_risk_approved': self.financial_risk_approved
} }
return partner_vals return partner_vals
@ -595,6 +602,7 @@ class SubscriptionRequest(models.Model):
"customer": self.share_product_id.customer, "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, "internal_rules_approved": self.internal_rules_approved,
"financial_risk_approved": self.financial_risk_approved
} }
return partner_vals return partner_vals
@ -623,6 +631,7 @@ class SubscriptionRequest(models.Model):
"type": "representative", "type": "representative",
"data_policy_approved": self.data_policy_approved, "data_policy_approved": self.data_policy_approved,
"internal_rules_approved": self.internal_rules_approved, "internal_rules_approved": self.internal_rules_approved,
"financial_risk_approved": self.financial_risk_approved,
} }
return contact_vals return contact_vals

1
easy_my_coop/models/partner.py

@ -178,6 +178,7 @@ class ResPartner(models.Model):
legal_form = fields.Selection([("", "")], string="Legal form") legal_form = fields.Selection([("", "")], string="Legal form")
data_policy_approved = fields.Boolean(string="Approved Data Policy") data_policy_approved = fields.Boolean(string="Approved Data Policy")
internal_rules_approved = fields.Boolean(string="Approved Internal Rules") internal_rules_approved = fields.Boolean(string="Approved Internal Rules")
financial_risk_approved = fields.Boolean(string="Approved Financial Risk")
@api.multi @api.multi
@api.depends("subscription_request_ids.state") @api.depends("subscription_request_ids.state")

9
easy_my_coop/views/res_company_view.xml

@ -22,12 +22,15 @@
<field name="default_lang_id"/> <field name="default_lang_id"/>
<field name="board_representative"/> <field name="board_representative"/>
<field name="signature_scan"/> <field name="signature_scan"/>
<field name="display_data_policy_approval"/>
<field name="data_policy_approval_required"/>
<field name="data_policy_approval_text"/>
<field name="display_internal_rules_approval"/> <field name="display_internal_rules_approval"/>
<field name="internal_rules_approval_required"/> <field name="internal_rules_approval_required"/>
<field name="internal_rules_approval_text"/> <field name="internal_rules_approval_text"/>
<field name="display_data_policy_approval"/>
<field name="data_policy_approval_required"/>
<field name="data_policy_approval_text"/>
<field name="display_financial_risk_approval"/>
<field name="financial_risk_approval_required"/>
<field name="financial_risk_approval_text"/>
</group> </group>
</group> </group>
</field> </field>

8
easy_my_coop/views/res_partner_view.xml

@ -53,8 +53,12 @@
attrs="{'invisible':[('is_company','=',True)]}"/> attrs="{'invisible':[('is_company','=',True)]}"/>
</group> </group>
<group name="approvals"> <group name="approvals">
<field name="internal_rules_approved"/>
<field name="data_policy_approved"/>
<field name="internal_rules_approved"
attrs="{'invisible':[('member','=',False)]}"/>
<field name="data_policy_approved"
attrs="{'invisible':[('member','=',False)]}"/>
<field name="financial_risk_approved"
attrs="{'invisible':[('member','=',False)]}"/>
</group> </group>
</group> </group>
</xpath> </xpath>

2
easy_my_coop/views/subscription_request_view.xml

@ -101,7 +101,9 @@
<field name="type"/> <field name="type"/>
<field name="lang"/> <field name="lang"/>
<field name="skip_control_ng"/> <field name="skip_control_ng"/>
<field name="internal_rules_approved"/>
<field name="data_policy_approved"/> <field name="data_policy_approved"/>
<field name="financial_risk_approved"/>
</group> </group>
</group> </group>
<notebook> <notebook>

10
easy_my_coop_website/controllers/main.py

@ -199,12 +199,12 @@ class WebsiteSubscription(http.Controller):
if company.default_country_id: if company.default_country_id:
values["country_id"] = company.default_country_id.id values["country_id"] = company.default_country_id.id
else: else:
values["country_id"] = "21"
values["country_id"] = "20"
if not values.get("activities_country_id"): if not values.get("activities_country_id"):
if company.default_country_id: if company.default_country_id:
values["activities_country_id"] = company.default_country_id.id values["activities_country_id"] = company.default_country_id.id
else: else:
values["activities_country_id"] = "21"
values["activities_country_id"] = "20"
if not values.get("lang"): if not values.get("lang"):
if company.default_lang_id: if company.default_lang_id:
values["lang"] = company.default_lang_id.code values["lang"] = company.default_lang_id.code
@ -218,6 +218,9 @@ class WebsiteSubscription(http.Controller):
"display_internal_rules": comp.display_internal_rules_approval, "display_internal_rules": comp.display_internal_rules_approval,
"internal_rules_required": comp.internal_rules_approval_required, "internal_rules_required": comp.internal_rules_approval_required,
"internal_rules_text": comp.internal_rules_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,
} }
) )
return values return values
@ -439,6 +442,9 @@ class WebsiteSubscription(http.Controller):
if kwargs.get("internal_rules_approved", "off") == "on": if kwargs.get("internal_rules_approved", "off") == "on":
values["internal_rules_approved"] = True values["internal_rules_approved"] = True
if kwargs.get("financial_risk_approved", "off") == "on":
values["financial_risk_approved"] = True
lastname = kwargs.get("lastname").upper() lastname = kwargs.get("lastname").upper()
firstname = kwargs.get("firstname").title() firstname = kwargs.get("firstname").title()

39
easy_my_coop_website/views/subscription_template.xml

@ -309,6 +309,7 @@
</label> </label>
<select name="country_id" <select name="country_id"
class="col-md-7 col-sm-8 form-control " class="col-md-7 col-sm-8 form-control "
required="True"
t-att-readonly="logged" t-att-readonly="logged"
style="width:54%;margin-left:15px"> style="width:54%;margin-left:15px">
<option value="">Country...</option> <option value="">Country...</option>
@ -431,6 +432,26 @@
<br/> <br/>
<div id="internal_rules_approved"
t-if="display_internal_rules"
t-attf-class="form-group">
<label class="col-md-3 col-sm-4 control-label"
for="internal_rules_approved">
Internal Rules
</label>
<div class="col-md-9 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox"
name="internal_rules_approved"
t-att-required="internal_rules_required"
t-att-checked="internal_rules_approved"/>
<t t-raw="internal_rules_text"/>
</label>
</div>
</div>
</div>
<div id="data_policy_approved" <div id="data_policy_approved"
t-if="display_data_policy" t-if="display_data_policy"
t-attf-class="form-group"> t-attf-class="form-group">
@ -451,25 +472,26 @@
</div> </div>
</div> </div>
<div id="internal_rules_approved"
t-if="display_internal_rules"
<div id="financial_risk_approved"
t-if="display_financial_risk"
t-attf-class="form-group"> t-attf-class="form-group">
<label class="col-md-3 col-sm-4 control-label" <label class="col-md-3 col-sm-4 control-label"
for="internal_rules_approved">
Internal Rules
for="financial_risk_approved">
Financial Risk
</label> </label>
<div class="col-md-9 col-sm-8"> <div class="col-md-9 col-sm-8">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" <input type="checkbox"
name="internal_rules_approved"
t-att-required="internal_rules_required"
t-att-checked="internal_rules_approved"/>
<t t-raw="internal_rules_text"/>
name="financial_risk_approved"
t-att-required="financial_risk_required"
t-att-checked="financial_risk_approved"/>
<t t-raw="financial_risk_text"/>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<table style="margin-left:195px"> <table style="margin-left:195px">
<tr> <tr>
<td width="80%"> <td width="80%">
@ -699,6 +721,7 @@
</label> </label>
<select name="country_id" <select name="country_id"
class="col-md-7 col-sm-8 form-control" class="col-md-7 col-sm-8 form-control"
required="True"
t-att-readonly="logged" t-att-readonly="logged"
style="width:54%;margin-left:15px"> style="width:54%;margin-left:15px">
<option value="">Country...</option> <option value="">Country...</option>

Loading…
Cancel
Save