Browse Source

[ADD] emc: Internal Rules Approved

The new cooperator needs to approve internal rules.
pull/2/head
Rémy Taymans 6 years ago
parent
commit
54dcbd82ff
  1. 2
      easy_my_coop/__openerp__.py
  2. 3
      easy_my_coop/controllers/main.py
  3. 15
      easy_my_coop/models/coop.py
  4. 1
      easy_my_coop/models/partner.py
  5. 1
      easy_my_coop/view/res_partner_view.xml
  6. 1
      easy_my_coop/view/subscription_request_view.xml
  7. 33
      easy_my_coop/view/subscription_template.xml

2
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",

3
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()

15
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:

1
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')

1
easy_my_coop/view/res_partner_view.xml

@ -32,6 +32,7 @@
</group>
<group name="approvals">
<field name="data_policy_approved" />
<field name="internal_rules_approved" />
</group>
</xpath>

1
easy_my_coop/view/subscription_request_view.xml

@ -80,6 +80,7 @@
<field name="validated"/>
<field name="skip_control_ng"/>
<field name="data_policy_approved"/>
<field name="internal_rules_approved"/>
</group>
</group>
<notebook>

33
easy_my_coop/view/subscription_template.xml

@ -246,6 +246,21 @@
<br/>
<div 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-1 col-sm-2">
<input type="checkbox"
class="form-control"
name="internal_rules_approved"
required="True"
t-attf-value="#{internal_rules_approved or ''}"/>
</div>
<div class="col-md-6 col-sm-6">
<t t-call="easy_my_coop.internal_rules_approved_text"/>
</div>
</div>
<div 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-1 col-sm-2">
@ -522,6 +537,20 @@
<br/>
<div 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-1 col-sm-2">
<input type="checkbox"
class="form-control"
name="internal_rules_approved"
required="True"
t-attf-value="#{internal_rules_approved or ''}"/>
</div>
<div class="col-md-6 col-sm-6">
<t t-call="easy_my_coop.internal_rules_approved_text"/>
</div>
</div>
<div 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-1 col-sm-2">
@ -595,5 +624,9 @@
name="Internal Rules Approved Text">
I accept the Data Policy.
</template>
<template id="internal_rules_approved_text"
name="Internal Rules Approved Text">
I accept the Internal Rules.
</template>
</data>
</openerp>
Loading…
Cancel
Save