Browse Source

[IMP] Change approval order for internal rules, data policy and financial risk

pull/31/head
Elouan Le Bars 5 years ago
committed by Elouan Le Bars
parent
commit
ac153d748a
  1. 12
      easy_my_coop/controllers/main.py
  2. 35
      easy_my_coop/models/company.py
  3. 18
      easy_my_coop/models/coop.py
  4. 2
      easy_my_coop/models/partner.py
  5. 6
      easy_my_coop/view/res_company_view.xml
  6. 2
      easy_my_coop/view/res_partner_view.xml
  7. 2
      easy_my_coop/view/subscription_request_view.xml
  8. 49
      easy_my_coop/view/subscription_template.xml

12
easy_my_coop/controllers/main.py

@ -166,12 +166,12 @@ class WebsiteSubscription(http.Controller):
comp = request.env['res.company']._company_default_get() comp = request.env['res.company']._company_default_get()
values.update({ values.update({
'display_data_policy': comp.display_data_policy_approval,
'data_policy_required': comp.data_policy_approval_required,
'data_policy_text': comp.data_policy_approval_text,
'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_data_policy': comp.display_data_policy_approval,
'data_policy_required': comp.data_policy_approval_required,
'data_policy_text': comp.data_policy_approval_text,
'display_financial_risk': comp.display_financial_risk_approval, 'display_financial_risk': comp.display_financial_risk_approval,
'financial_risk_required': comp.financial_risk_approval_required, 'financial_risk_required': comp.financial_risk_approval_required,
'financial_risk_text': comp.financial_risk_approval_text, 'financial_risk_text': comp.financial_risk_approval_text,
@ -362,12 +362,12 @@ class WebsiteSubscription(http.Controller):
values["already_cooperator"] = already_coop values["already_cooperator"] = already_coop
values["is_company"] = is_company values["is_company"] = is_company
if kwargs.get('data_policy_approved', 'off') == 'on':
values['data_policy_approved'] = True
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('data_policy_approved', 'off') == 'on':
values['data_policy_approved'] = True
if kwargs.get('financial_risk_approved', 'off') == 'on': if kwargs.get('financial_risk_approved', 'off') == 'on':
values['financial_risk_approved'] = True values['financial_risk_approved'] = True

35
easy_my_coop/models/company.py

@ -44,17 +44,7 @@ class ResCompany(models.Model):
bottom_logo2 = fields.Binary(string="Bottom logo 2") bottom_logo2 = fields.Binary(string="Bottom logo 2")
logo_url = fields.Char(string="logo url", logo_url = fields.Char(string="logo url",
compute="_get_base_logo") compute="_get_base_logo")
display_data_policy_approval = fields.Boolean(
help="Choose to display a data policy checkbox on the cooperator"
" website form."
)
data_policy_approval_required = fields.Boolean(
string="Is data policy approval required?"
)
data_policy_approval_text = fields.Html(
translate=True,
help="Text to display aside the checkbox to approve data policy."
)
display_internal_rules_approval = fields.Boolean( display_internal_rules_approval = fields.Boolean(
help="Choose to display an internal rules checkbox on the" help="Choose to display an internal rules checkbox on the"
" cooperator website form." " cooperator website form."
@ -66,6 +56,19 @@ 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_data_policy_approval = fields.Boolean(
help="Choose to display a data policy checkbox on the cooperator"
" website form."
)
data_policy_approval_required = fields.Boolean(
string="Is data policy approval required?"
)
data_policy_approval_text = fields.Html(
translate=True,
help="Text to display aside the checkbox to approve data policy."
)
display_financial_risk_approval = fields.Boolean( display_financial_risk_approval = fields.Boolean(
help="Choose to display a financial risk checkbox on the" help="Choose to display a financial risk checkbox on the"
" cooperator website form." " cooperator website form."
@ -78,16 +81,16 @@ class ResCompany(models.Model):
help="Text to display aside the checkbox to approve financial risk." help="Text to display aside the checkbox to approve financial risk."
) )
@api.onchange('data_policy_approval_required')
def onchange_data_policy_approval_required(self):
if self.data_policy_approval_required:
self.display_data_policy_approval = True
@api.onchange('internal_rules_approval_required') @api.onchange('internal_rules_approval_required')
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('data_policy_approval_required')
def onchange_data_policy_approval_required(self):
if self.data_policy_approval_required:
self.display_data_policy_approval = True
@api.onchange('financial_risk_approval_required') @api.onchange('financial_risk_approval_required')
def onchange_financial_risk_approval_required(self): def onchange_financial_risk_approval_required(self):
if self.financial_risk_approval_required: if self.financial_risk_approval_required:

18
easy_my_coop/models/coop.py

@ -31,10 +31,10 @@ class subscription_request(models.Model):
def get_required_field(self): def get_required_field(self):
required_fields = _REQUIRED required_fields = _REQUIRED
company = self.env['res.company']._company_default_get() company = self.env['res.company']._company_default_get()
if company.data_policy_approval_required:
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.data_policy_approval_required:
required_fields.append('data_policy_approved')
if company.financial_risk_approval_required: if company.financial_risk_approval_required:
required_fields.append('financial_risk_approved') required_fields.append('financial_risk_approved')
return required_fields return required_fields
@ -308,14 +308,14 @@ class subscription_request(models.Model):
default="website", default="website",
readonly=True, readonly=True,
states={'draft': [('readonly', False)]}) states={'draft': [('readonly', False)]})
data_policy_approved = fields.Boolean(
string='Data Policy Approved',
default=False,
)
internal_rules_approved = fields.Boolean( internal_rules_approved = fields.Boolean(
string='Internal Rules Approved ', string='Internal Rules Approved ',
default=False, default=False,
) )
data_policy_approved = fields.Boolean(
string='Data Policy Approved',
default=False,
)
financial_risk_approved = fields.Boolean( financial_risk_approved = fields.Boolean(
string='Financial Risk Approved', string='Financial Risk Approved',
default=False, default=False,
@ -436,8 +436,8 @@ class subscription_request(models.Model):
'out_inv_comm_algorithm': 'random', 'out_inv_comm_algorithm': 'random',
'country_id': self.country_id.id, 'country_id': self.country_id.id,
'lang': self.lang, 'lang': self.lang,
'data_policy_approved': self.data_policy_approved,
'internal_rules_approved': self.internal_rules_approved, 'internal_rules_approved': self.internal_rules_approved,
'data_policy_approved': self.data_policy_approved,
'financial_risk_approved': self.financial_risk_approved 'financial_risk_approved': self.financial_risk_approved
} }
return partner_vals return partner_vals
@ -453,8 +453,8 @@ class subscription_request(models.Model):
'country_id': self.country_id.id, 'lang': self.lang, 'country_id': self.country_id.id, 'lang': self.lang,
'birthdate_date': self.birthdate, 'birthdate_date': self.birthdate,
'customer': self.share_product_id.customer, 'customer': self.share_product_id.customer,
'data_policy_approved': self.data_policy_approved,
'internal_rules_approved': self.internal_rules_approved, 'internal_rules_approved': self.internal_rules_approved,
'data_policy_approved': self.data_policy_approved,
'financial_risk_approved': self.financial_risk_approved 'financial_risk_approved': self.financial_risk_approved
} }
return partner_vals return partner_vals
@ -528,8 +528,8 @@ class subscription_request(models.Model):
'representative': True, 'representative': True,
'function': self.contact_person_function, 'function': self.contact_person_function,
'type': 'representative', 'type': 'representative',
'data_policy_approved': self.data_policy_approved,
'internal_rules_approved': self.internal_rules_approved, 'internal_rules_approved': self.internal_rules_approved,
'data_policy_approved': self.data_policy_approved,
'financial_risk_approved': self.financial_risk_approved 'financial_risk_approved': self.financial_risk_approved
} }
contact = partner_obj.create(contact_vals) contact = partner_obj.create(contact_vals)

2
easy_my_coop/models/partner.py

@ -144,8 +144,8 @@ class ResPartner(models.Model):
string="Subscription request") string="Subscription request")
legal_form = fields.Selection([('', '')], legal_form = fields.Selection([('', '')],
string="Legal form") string="Legal form")
data_policy_approved = fields.Boolean(string="Data Policy Approved ")
internal_rules_approved = fields.Boolean(string="Internal Rules Approved ") internal_rules_approved = fields.Boolean(string="Internal Rules Approved ")
data_policy_approved = fields.Boolean(string="Data Policy Approved ")
financial_risk_approved = fields.Boolean(string="Financial Risk Approved ") financial_risk_approved = fields.Boolean(string="Financial Risk Approved ")
@api.multi @api.multi

6
easy_my_coop/view/res_company_view.xml

@ -21,12 +21,12 @@
<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="display_financial_risk_approval"/>
<field name="financial_risk_approval_required"/> <field name="financial_risk_approval_required"/>
<field name="financial_risk_approval_text"/> <field name="financial_risk_approval_text"/>

2
easy_my_coop/view/res_partner_view.xml

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

2
easy_my_coop/view/subscription_request_view.xml

@ -74,8 +74,8 @@
<field name="lang"/> <field name="lang"/>
<field name="validated"/> <field name="validated"/>
<field name="skip_control_ng"/> <field name="skip_control_ng"/>
<field name="data_policy_approved"/>
<field name="internal_rules_approved"/> <field name="internal_rules_approved"/>
<field name="data_policy_approved"/>
<field name="financial_risk_approved"/> <field name="financial_risk_approved"/>
</group> </group>
</group> </group>

49
easy_my_coop/view/subscription_template.xml

@ -263,31 +263,31 @@
<br/> <br/>
<div id="data_policy_approved" t-if="display_data_policy" t-attf-class="form-group" >
<label class="col-md-3 col-sm-4 control-label" for="data_policy_approved">Privacy Policy</label>
<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="col-md-9 col-sm-8">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" <input type="checkbox"
name="data_policy_approved"
t-att-required="data_policy_required"
t-att-checked="data_policy_approved"/>
<t t-raw="data_policy_text"/>
name="internal_rules_approved"
t-att-required="internal_rules_required"
t-att-checked="internal_rules_approved"/>
<t t-raw="internal_rules_text"/>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<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 id="data_policy_approved" t-if="display_data_policy" t-attf-class="form-group" >
<label class="col-md-3 col-sm-4 control-label" for="data_policy_approved">Privacy Policy</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="data_policy_approved"
t-att-required="data_policy_required"
t-att-checked="data_policy_approved"/>
<t t-raw="data_policy_text"/>
</label> </label>
</div> </div>
</div> </div>
@ -608,32 +608,31 @@
<br/> <br/>
<div id="data_policy_approved" t-if="display_data_policy" t-attf-class="form-group" >
<label class="col-md-3 col-sm-4 control-label" for="data_policy_approved">Privacy Policy</label>
<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="col-md-9 col-sm-8">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" <input type="checkbox"
name="data_policy_approved"
t-att-required="data_policy_required"
t-att-checked="data_policy_approved"/>
<t t-raw="data_policy_text"/>
name="internal_rules_approved"
t-att-required="internal_rules_required"
t-att-checked="internal_rules_approved"/>
<t t-raw="internal_rules_text"/>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<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 id="data_policy_approved" t-if="display_data_policy" t-attf-class="form-group" >
<label class="col-md-3 col-sm-4 control-label" for="data_policy_approved">Privacy Policy</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="data_policy_approved"
t-att-required="data_policy_required"
t-att-checked="data_policy_approved"/>
<t t-raw="data_policy_text"/>
</label> </label>
</div> </div>
</div> </div>

Loading…
Cancel
Save