Compare commits

...

39 Commits

Author SHA1 Message Date
houssine 26b0b320e9 [IMP] add extract for company fields. 5 years ago
houssine ebadfd5ad0 [FIX] fix gender list 5 years ago
houssine 498ce40cee [IMP] add button signup company or individual 5 years ago
houssine 39d69aab62 [IMP] filling selection fields and signup for company 5 years ago
houssine ad2b8f377e [IMP] put fields on sign on form 5 years ago
houssine f3d696deda [IMP] add firstname and change label for lastname 5 years ago
houssine b5fdd66be9 [IMP] add fields on the create sign on form 5 years ago
Houssine BAKKALI cb17a9c51b
Merge pull request #6 from coopiteasy/9.0_fix_operation_conversion 6 years ago
houssine 83ec48edfe [FIX] company_email doesn't exist on res partner 6 years ago
houssine 80e58389f1 [IMP] remove state dield from there 6 years ago
Houssine BAKKALI ac8e7c1e92
Merge pull request #5 from coopiteasy/9.0-fix-new_coop_form 6 years ago
houssine 53aca0ee6e [IMP] add check in validate function 6 years ago
Rémy Taymans 0ef913acae [FIX] emc: Error casting str to int 6 years ago
Rémy Taymans a5f633b384 [FIX] emc: Data policy and internal rules configuration 6 years ago
Rémy Taymans e494befa02
Merge pull request #4 6 years ago
Rémy Taymans a749c558f9 [IMP] emc: Data policy and internal rules approval 6 years ago
houssine f2597b3220 [PEP8] fix pep8 warning 6 years ago
houssine 0a3fe10446 [FIX] invoice payment information have been moved to another field 6 years ago
houssine 837ed8deaf [IMP] add checkbox already coop on company form 6 years ago
houssine 032b731e5a [FIX] fix checkbox not filled when logged and already coop 6 years ago
Rémy Taymans 623fef4f08 [FIX] emc: Order of approvals checkbox in new cooperator form 6 years ago
Rémy Taymans 03776220e3
Merge pull request #2 6 years ago
Rémy Taymans 54dcbd82ff [ADD] emc: Internal Rules Approved 6 years ago
Rémy Taymans 123aabf756 [CHG] emc: Remove dependence to website_legal_page 6 years ago
Rémy Taymans cdc6d083b6 [REF] emc: Duplicate key 'customer' 6 years ago
Rémy Taymans 5911b3e5bc [IMP] emc: Complete data_policy_approved processing 6 years ago
robinkeunen d7b431a202 [IMP] align already cooperator checkbox 7 years ago
robinkeunen afc28114aa [IMP] align send button 7 years ago
robinkeunen cb4a6ab8be [ADD] add website_legal_page and link to legal pages 7 years ago
robinkeunen 96f0b7f0d6 [ADD] require data policy approval 7 years ago
houssine 91dc06fc4e [IMP] take hard coded value from company field 6 years ago
houssine d909c3d32c [FIX] fix wrong field name 6 years ago
houssine 20dad701d6 [IMP] make release capital tree view use the customer invoice view tree 6 years ago
houssine ee6463c0dc [FIX] fix export. removing an old field 6 years ago
houssine f2478c9312 [IMP] make validation on iban only if iban is not empty 6 years ago
houssine ab62e69d6d [IMP] make iban field non required 6 years ago
houssine 18dce65cdc [IMP] set iban non required for this localisation 6 years ago
houssine e7cbc31932 [FIX] check no_registre only if it's required for the localisation 6 years ago
houssine 90969b1fef [FIX] fix undeclared variable domain is a special case 6 years ago
  1. 5
      easy_my_coop/__openerp__.py
  2. 131
      easy_my_coop/controllers/AuthSignupHome.py
  3. 1
      easy_my_coop/controllers/__init__.py
  4. 23
      easy_my_coop/controllers/main.py
  5. 2
      easy_my_coop/models/account_invoice.py
  6. 34
      easy_my_coop/models/company.py
  7. 39
      easy_my_coop/models/coop.py
  8. 10
      easy_my_coop/models/operation_request.py
  9. 2
      easy_my_coop/models/partner.py
  10. 1
      easy_my_coop/view/account_invoice_view.xml
  11. 348
      easy_my_coop/view/auth_signup_template.xml
  12. 1
      easy_my_coop/view/operation_request_view.xml
  13. 6
      easy_my_coop/view/res_company_view.xml
  14. 4
      easy_my_coop/view/res_partner_view.xml
  15. 2
      easy_my_coop/view/subscription_request_view.xml
  16. 81
      easy_my_coop/view/subscription_template.xml
  17. 7
      easy_my_coop_ch/models/coop.py
  18. 16
      easy_my_coop_ch/views/subscription_template.xml
  19. 8
      easy_my_coop_export_xlsx/wizard/export_global_wizard.py

5
easy_my_coop/__openerp__.py

@ -20,8 +20,9 @@
##############################################################################
{
"name": "Easy My Coop",
"version": "1.1",
"version": "9.1.0.0.1",
"depends": ["base",
'auth_signup',
"sale",
"purchase",
"account_accountant",
@ -29,6 +30,7 @@
"partner_firstname",
"partner_contact_birthdate",
"partner_contact_address",
"web",
"website",
"website_recaptcha_reloaded",
"theme_light",
@ -56,6 +58,7 @@
'view/cooperator_register_view.xml',
'view/operation_request_view.xml',
'view/account_invoice_view.xml',
'view/auth_signup_template.xml',
'view/subscription_template.xml',
'view/product_view.xml',
'view/res_company_view.xml',

131
easy_my_coop/controllers/AuthSignupHome.py

@ -0,0 +1,131 @@
# -*- coding: utf-8 -*-
# © 2019 Coop IT Easy (http://www.coopiteasy.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from openerp import tools
from openerp.tools.translate import _
from openerp import http
from openerp.http import request
from openerp.addons.auth_signup.res_users import SignupError
from openerp.addons.auth_signup.controllers.main import AuthSignupHome
from openerp.addons.base_iban import base_iban
from openerp.exceptions import ValidationError
_logger = logging.getLogger(__name__)
FORM_FIELDS = ['login', 'firstname', 'password', 'phone', 'street',
'city', 'zip_code', 'country_id', 'gender', 'birthdate']
class AuthSignupHome(AuthSignupHome):
def _signup_with_values(self, token, values):
user_obj = request.env['res.users']
db, login, password = user_obj.sudo().signup(values, token)
# as authenticate will use its own cursor we need to commit
# the current transaction
request.cr.commit()
uid = request.session.authenticate(db, login, password)
if not uid:
raise SignupError(_('Authentication Failed.'))
return uid
def do_signup(self, qcontext):
""" Shared helper that creates a res.partner out of a token """
bank_obj = request.env['res.partner.bank']
lang_obj = request.env['res.lang']
values = dict((key, qcontext.get(key)) for key in FORM_FIELDS)
assert any([k for k in values.values()]),"The form was not properly filled in."
assert values.get('password') == qcontext.get('confirm_password'), "Passwords do not match; please retype them."
supported_langs = [lang['code'] for lang
in lang_obj.sudo().search_read([], ['code'])]
values['lang'] = qcontext.get("lang")
firstname = qcontext.get("firstname").title()
lastname = qcontext.get('name').upper()
values['lastname'] = lastname
values['name'] = firstname + ' ' + lastname
values['zip'] = values['zip_code']
uid = self._signup_with_values(qcontext.get('token'), values)
iban = qcontext.get('iban')
user = request.env['res.users'].sudo().search([('id', '=', uid)])
bank_obj.sudo().create({'partner_id': user.partner_id.id,
'acc_number': iban})
request.cr.commit()
@http.route('/web/company_signup', type='http', auth='public',
website=True)
def web_auth_company_signup(self, *args, **kw):
vals = {}
vals['company'] = True
return self.web_auth_signup(**vals)
@http.route('/web/individual_signup', type='http', auth='public',
website=True)
def web_auth_individua_signup(self, *args, **kw):
vals = {}
vals['company'] = False
return self.web_auth_signup(**vals)
@http.route('/web/signup', type='http', auth='public', website=True)
def web_auth_signup(self, *args, **kw):
qcontext = self.get_auth_signup_qcontext()
users_obj = request.env["res.users"]
country_obj = request.env['res.country']
lang_obj = request.env['res.lang']
sub_req_obj = request.env['subscription.request']
render_template = 'auth_signup.signup'
if kw.get('company', False):
render_template = 'easy_my_coop.company_signup'
qcontext['is_company'] = True
qcontext['name'] = self.company_name
qcontext['last_name'] = self.company_name
qcontext['company_register_number'] = self.company_register_number
qcontext['email'] = self.company_email
qcontext['out_inv_comm_type'] = 'bba'
qcontext['cooperator'] = True
qcontext['out_inv_comm_algorithm'] = 'random'
if qcontext.get("login") != qcontext.get("confirm_email"):
qcontext["error"] = _("The email address doesn't seem to match"
" the email confirmation.")
if qcontext.get("login", False) and not tools.single_email_re.match(qcontext.get("login", "")):
qcontext["error"] = _("That does not seem to be an email address.")
if qcontext.get("iban", False):
try:
base_iban.validate_iban(qcontext.get("iban"))
except ValidationError:
qcontext["error"] = _("Please give a correct IBAN number.")
if not qcontext.get('token') and not qcontext.get('signup_enabled'):
raise werkzeug.exceptions.NotFound()
if 'error' not in qcontext and request.httprequest.method == 'POST':
try:
self.do_signup(qcontext)
return super(AuthSignupHome, self).web_login(*args, **kw)
except (SignupError, AssertionError), e:
domain = [("login", "=", qcontext.get("login"))]
if users_obj.sudo().search(domain):
qcontext["error"] = _("Another user is already registered "
"using this email address.")
else:
_logger.error(e.message)
qcontext['error'] = _("Could not create a new account.")
qcontext['langs'] = lang_obj.sudo().search([])
qcontext['countries'] = country_obj.sudo().search([])
qcontext['country_id'] = '21'
fields_desc = sub_req_obj.sudo().fields_get(['company_type', 'gender'])
qcontext['company_types'] = fields_desc['company_type']['selection']
qcontext['genders'] = fields_desc['gender']['selection']
return request.render(render_template, qcontext)
def get_partner_company_vals(self):
partner_vals = {
'data_policy_approved': self.data_policy_approved,
'internal_rules_approved': self.internal_rules_approved
}
return partner_vals

1
easy_my_coop/controllers/__init__.py

@ -1 +1,2 @@
from . import main
from . import AuthSignupHome

23
easy_my_coop/controllers/main.py

@ -163,6 +163,16 @@ class WebsiteSubscription(http.Controller):
if not values.get('lang'):
if company.default_lang_id:
values['lang'] = company.default_lang_id.code
cmp = request.env['res.company']._company_default_get()
values.update({
'display_data_policy': cmp.display_data_policy_approval,
'data_policy_required': cmp.data_policy_approval_required,
'data_policy_text': cmp.data_policy_approval_text,
'display_internal_rules': cmp.display_internal_rules_approval,
'internal_rules_required': cmp.internal_rules_approval_required,
'internal_rules_text': cmp.internal_rules_approval_text,
})
return values
def get_products_share(self, is_company):
@ -248,7 +258,7 @@ class WebsiteSubscription(http.Controller):
"is not valid")
return request.website.render(redirect, values)
if not is_company:
if not is_company and 'no_registre' in required_fields:
no_registre = re.sub('[^0-9a-zA-Z]+', '',
kwargs.get("no_registre"))
valid = sub_req_obj.check_belgian_identification_id(no_registre)
@ -267,7 +277,7 @@ class WebsiteSubscription(http.Controller):
max_amount = max_amount - partner.total_value
if company.unmix_share_type:
share = self.get_selected_share(kwargs)
if int(partner.cooperator_type) != share.id:
if partner.cooperator_type != share.short_name:
values = self.fill_values(values, is_company, logged)
values["error_msg"] = (_("You can't subscribe two "
"different types of share"))
@ -304,6 +314,8 @@ class WebsiteSubscription(http.Controller):
def share_subscription(self, **kwargs):
sub_req_obj = request.env['subscription.request']
attach_obj = request.env['ir.attachment']
required_fields = sub_req_obj.sudo().get_required_field()
# List of file to add to ir_attachment once we have the ID
post_file = []
# Info to add after the message
@ -338,6 +350,12 @@ 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
if kwargs.get('internal_rules_approved', 'off') == 'on':
values['internal_rules_approved'] = True
lastname = kwargs.get("lastname").upper()
firstname = kwargs.get("firstname").title()
@ -357,6 +375,7 @@ class WebsiteSubscription(http.Controller):
kwargs.get("company_register_number"))
subscription_id = sub_req_obj.sudo().create_comp_sub_req(values)
else:
if 'no_registre' in required_fields:
no_registre = re.sub('[^0-9a-zA-Z]+', '',
kwargs.get("no_registre"))
values["no_registre"] = no_registre

2
easy_my_coop/models/account_invoice.py

@ -24,8 +24,6 @@ class account_invoice(models.Model):
def create_user(self, partner):
user_obj = self.env['res.users']
email = partner.email
if partner.is_company:
email = partner.company_email
user = user_obj.search([('login', '=', email)])
if not user:

34
easy_my_coop/models/company.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from openerp import fields, models
from openerp import api, fields, models
class ResCompany(models.Model):
@ -44,3 +44,35 @@ class ResCompany(models.Model):
bottom_logo2 = fields.Binary(string="Bottom logo 2")
logo_url = fields.Char(string="logo url",
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(
help="Choose to display an internal rules checkbox on the"
" cooperator website form."
)
internal_rules_approval_required = fields.Boolean(
string="Is internal rules approval required?"
)
internal_rules_approval_text = fields.Html(
translate=True,
help="Text to display aside the checkbox to approve internal rules."
)
@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')
def onchange_internal_rules_approval_required(self):
if self.internal_rules_approval_required:
self.display_internal_rules_approval = True

39
easy_my_coop/models/coop.py

@ -30,7 +30,13 @@ class subscription_request(models.Model):
_description = 'Subscription Request'
def get_required_field(self):
return _REQUIRED
required_fields = _REQUIRED
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:
required_fields.append('internal_rules_approved')
return required_fields
@api.model
def create(self, vals):
@ -254,8 +260,11 @@ class subscription_request(models.Model):
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
default=lambda self: datetime.strftime(datetime.now(), '%Y-%m-%d'))
company_id = fields.Many2one('res.company', string='Company', required=True,
default=lambda self: datetime.strftime(datetime.now(),
'%Y-%m-%d'))
company_id = fields.Many2one('res.company',
string='Company',
required=True,
change_default=True,
readonly=True,
default=lambda self: self.env['res.company']._company_default_get())
@ -326,6 +335,14 @@ class subscription_request(models.Model):
default="website",
readonly=True,
states={'draft': [('readonly', False)]})
data_policy_approved = fields.Boolean(
string='Data Policy Approved',
default=False,
)
internal_rules_approved = fields.Boolean(
string='Approved Internal Rules',
default=False,
)
_order = "id desc"
def get_person_info(self, partner):
@ -434,14 +451,16 @@ 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',
'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,
'internal_rules_approved': self.internal_rules_approved}
return partner_vals
def get_partner_vals(self):
@ -455,7 +474,9 @@ 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,
'internal_rules_approved': self.internal_rules_approved}
return partner_vals
def create_coop_partner(self):
@ -486,6 +507,7 @@ class subscription_request(models.Model):
partner = self.partner_id
else:
partner = None
domain = []
if self.already_cooperator:
raise UserError(_('The checkbox already cooperator is'
' checked please select a cooperator.'))
@ -494,6 +516,7 @@ class subscription_request(models.Model):
elif not self.is_company and self.no_registre:
domain = [('national_register_number', '=', self.no_registre)]
if domain:
partner = partner_obj.search(domain)
if not partner:
@ -525,7 +548,9 @@ 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,
'internal_rules_approved': self.internal_rules_approved}
contact = partner_obj.create(contact_vals)
else:
if len(contact) > 1:

10
easy_my_coop/models/operation_request.py

@ -115,7 +115,8 @@ class operation_request(models.Model):
def get_total_share_dic(self, partner):
total_share_dic = {}
share_products = self.env['product.template'].search([('is_share', '=', True)])
prod_template_obj = self.env['product.template']
share_products = prod_template_obj.search([('is_share', '=', True)])
for share_product in share_products:
total_share_dic[share_product.id] = 0
@ -174,6 +175,13 @@ class operation_request(models.Model):
" shares that he/she owns."))
if self.operation_type == 'convert':
amount_to_convert = self.share_unit_price * self.quantity
share_price = self.share_to_product_id.list_price
remainder = amount_to_convert % share_price
if remainder != 0:
raise ValidationError(_("The conversion must give a whole"
" number for quantity"))
if self.company_id.unmix_share_type:
if self.share_product_id.code == self.share_to_product_id.code:
raise ValidationError(_("You can't convert the share to"

2
easy_my_coop/models/partner.py

@ -139,6 +139,8 @@ 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")
internal_rules_approved = fields.Boolean(string="Approved Internal Rules")
@api.multi
@api.depends('subscription_request_ids.state')

1
easy_my_coop/view/account_invoice_view.xml

@ -38,6 +38,7 @@
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>

348
easy_my_coop/view/auth_signup_template.xml

@ -0,0 +1,348 @@
<odoo>
<data>
<!--<template id="easy_my_coop_login_layout" inherit_id="web.login_layout"
name="Login Layout"> <xpath expr="//t[@t-set='head']" position="inside">
<script type="text/javascript" src="/easy_my_coop/static/src/js/jquery.inputmask.bundle.js"></script>
</xpath> </template> -->
<template id="easy_my_coop_assets_backend"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript"
src="/easy_my_coop/static/src/js/jquery.inputmask.bundle.js"></script>
</xpath>
</template>
<!--<template id="easy_my_coop_assets_common" inherit_id="web.assets_common">
<xpath expr="." position="inside"> <script type="text/javascript" src="/easy_my_coop/static/src/js/jquery.inputmask.bundle.js"></script>
</xpath> </template> -->
<template id="easy_my_coop_signup"
inherit_id="auth_signup.signup" name="Easy My Coop Sign up login">
<xpath expr="//t[@t-call='auth_signup.fields']" position="before">
<div t-attf-class="form-group">
<a class='btn btn-primary' href="/web/company_signup">You are a company? Click here.</a>
<br/>
</div>
</xpath>
<xpath expr="//t[@t-esc='error']/.." position="replace" />
<xpath expr="//input[@name='csrf_token']" position="after">
<p class="alert alert-danger" t-if="error">
<t t-esc="error" />
</p>
</xpath>
</template>
<template id="easy_my_coop_auth_fields"
inherit_id="auth_signup.fields"
name="Auth Signup/ResetPassword form fields">
<xpath expr="//input[@name='name']/.." position="before">
<div class="form-group field-login">
<label for="confirm_email" class="control-label">Confirm your email</label>
<input type="text" name="confirm_email"
t-att-value="confirm_email" id="confirm_email"
class="form-control" required="required"
t-att-invisible="'invisible' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="firstname" class="control-label">Your firstname</label>
<input type="text" name="firstname" t-att-value="firstname"
id="firstname" class="form-control" placeholder="John"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
</xpath>
<xpath expr="//label[@for='name']" position="replace">
<label for="name" class="control-label">Your lastname</label>
</xpath>
<xpath expr="//input[@name='name']" position="attributes">
<attribute name="placeholder">Doe</attribute>
</xpath>
<xpath expr="//input[@name='name']/.." position="after">
<div class="form-group field-name">
<label for="gender" class="control-label">Your Gender</label>
<select name="gender" id="gender" class="form-control"
required="True" style="width:54%"
t-att-disabled="'disabled' if only_passwords else None">
<option value=""></option>
<t t-foreach="genders or []" t-as="type">
<option t-att-value="type[0]"
t-att-selected="type[0] == gender">
<t t-esc="type[1]" />
</option>
</t>
</select>
</div>
<div class="form-group field-name">
<label class="control-label" for="birthdate">Birthdate</label>
<input type="text" data-inputmask="'alias': 'date'"
class="form-control mandatory-field" name="birthdate"
required="True" t-attf-value="#{birthdate or ''}"
placeholder="05/03/1978" />
</div>
<div class="form-group field-name">
<label for="lang" class="control-label">Your Language</label>
<select name="lang" id="lang"
class="form-control" style="width:54%;" required="required"
t-att-disabled="'disabled' if only_passwords else None">
<option value="">Lang...</option>
<t t-foreach="langs or []" t-as="langue">
<option t-att-value="langue.code"
t-att-selected="langue.code == lang">
<t t-esc="langue.name" />
</option>
</t>
</select>
</div>
<div class="form-group field-name">
<label for="iban" class="control-label">IBAN number</label>
<input type="text" name="iban" t-att-value="iban" id="iban"
class="form-control" placeholder="BE645215965478"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="phone" class="control-label">Your Phone</label>
<input type="text" name="phone" t-att-value="phone"
id="phone" class="form-control" placeholder="+325552365"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="street" class="control-label">Your Street and Number</label>
<input type="text" name="street" t-att-value="street"
id="street" class="form-control"
placeholder="Rue de la transition, 63" required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="zip_code" class="control-label">Your Zip Code</label>
<input type="text" name="zip_code" t-att-value="zip_code"
id="zip_code" class="form-control" placeholder="1040"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="city" class="control-label">Your City</label>
<input type="text" name="city" t-att-value="city" id="city"
class="form-control" placeholder="Bruxelles" required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="country_id" class="control-label">Your Country</label>
<select name="country_id" id="country_id"
class="form-control" style="width:54%;" required="required"
t-att-disabled="'disabled' if only_passwords else None">
<option value="">Country...</option>
<t t-foreach="countries or []" t-as="country">
<option t-att-value="country.id"
t-att-selected="country.id == int(country_id)">
<t t-esc="country.name" />
</option>
</t>
</select>
</div>
</xpath>
</template>
<template id="company_signup" name="Company sign up login">
<t t-call="web.login_layout">
<div t-attf-class="form-group">
<a class='btn btn-primary' href="/web/individual_signup">You are a individual? Click here.</a>
<br/>
</div>
<form class="oe_signup_form" role="form" method="post"
t-if="not message">
<input type="hidden" name="csrf_token"
t-att-value="request.csrf_token()" />
<div t-attf-class="form-group" style="display: none;">
<label>
<input type="checkbox" t-att-value="is_company"
checked="checked" name="is_company" />
Is a company?
</label>
</div>
<p class="alert alert-danger" t-if="error">
<t t-esc="error" />
</p>
<div class="form-group field-name">
<label for="name" class="control-label">Company Name</label>
<input type="text" name="company_name" t-att-value="company_name" id="name"
class="form-control" placeholder="The Universal Cooperative"
required="required"
t-att-readonly="'readonly' if only_passwords else None"
t-att-autofocus="'autofocus' if login and not only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="name" class="control-label">Company register number</label>
<input type="text" name="company_register_number" t-att-value="company_register_number" id="company_register_number"
class="form-control" placeholder="0647980091"
required="required"
t-att-readonly="'readonly' if only_passwords else None"
t-att-autofocus="'autofocus' if login and not only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="name" class="control-label">Company email</label>
<input type="text" name="company_email" t-att-value="company_email" id="company_email"
class="form-control"
required="required"
t-att-readonly="'readonly' if only_passwords else None"
t-att-autofocus="'autofocus' if login and not only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="iban" class="control-label">IBAN number</label>
<input type="text" name="iban" t-att-value="iban" id="iban"
class="form-control" placeholder="BE645215965478"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="phone" class="control-label">Phone</label>
<input type="text" name="phone" t-att-value="phone"
id="phone" class="form-control" placeholder="+325552365"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group">
<label>
Main Address
</label>
</div>
<div class="form-group field-name">
<label for="street" class="control-label">Street and Number</label>
<input type="text" name="street" t-att-value="street"
id="street" class="form-control"
placeholder="Rue de la transition, 63" required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="zip_code" class="control-label">Zip Code</label>
<input type="text" name="zip_code" t-att-value="zip_code"
id="zip_code" class="form-control" placeholder="1040"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="city" class="control-label">City</label>
<input type="text" name="city" t-att-value="city" id="city"
class="form-control" placeholder="Bruxelles" required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="country_id" class="control-label">Country</label>
<select name="country_id" id="country_id"
class="form-control" style="width:54%;" required="required"
t-att-disabled="'disabled' if only_passwords else None">
<option value="">Country...</option>
<t t-foreach="countries or []" t-as="country">
<option t-att-value="country.id"
t-att-selected="country.id == int(country_id)">
<t t-esc="country.name" />
</option>
</t>
</select>
</div>
<!-- <br/>-->
<div class="form-group field-name">
<label>
Contact Person
</label>
</div>
<div class="form-group field-name">
<label for="name" class="control-label">Your Name</label>
<input type="text" name="name" t-att-value="name"
id="name" class="form-control" placeholder="Doe"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="firstname" class="control-label">Your firstname</label>
<input type="text" name="firstname" t-att-value="firstname"
id="firstname" class="form-control" placeholder="John"
required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-login">
<label for="login" class="control-label">Your Email</label>
<input type="text" name="login" t-att-value="login"
id="login" class="form-control" autofocus="autofocus"
autocapitalize="off" required="required"
t-att-readonly="'readonly' if only_passwords else None" />
</div>
<div class="form-group field-login">
<label for="confirm_email" class="control-label">Confirm your email</label>
<input type="text" name="confirm_email"
t-att-value="confirm_email" id="confirm_email"
class="form-control" required="required"
t-att-invisible="'invisible' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="gender" class="control-label">Gender</label>
<select name="gender" id="gender" class="form-control"
required="True" style="width:54%"
t-att-disabled="'disabled' if only_passwords else None">
<option value=""></option>
<t t-foreach="genders or []" t-as="type">
<option t-att-value="type[0]"
t-att-selected="type[0] == gender">
<t t-esc="type[1]" />
</option>
</t>
</select>
</div>
<div class="form-group field-name">
<label class="control-label" for="birthdate">Birthdate</label>
<input type="text" data-inputmask="'alias': 'date'"
class="form-control mandatory-field" name="birthdate"
required="True" t-attf-value="#{birthdate or ''}"
placeholder="05/03/1978" />
</div>
<div class="form-group field-name">
<label for="lang" class="control-label">Your Language</label>
<select name="lang" id="lang"
class="form-control" style="width:54%;" required="required"
t-att-disabled="'disabled' if only_passwords else None">
<option value="">Lang...</option>
<t t-foreach="langs or []" t-as="langue">
<option t-att-value="langue.code"
t-att-selected="langue.code == lang">
<t t-esc="langue.name" />
</option>
</t>
</select>
</div>
<div class="form-group field-password">
<label for="password" class="control-label">Password</label>
<input type="password" name="password" id="password"
class="form-control" required="required"
t-att-autofocus="'autofocus' if only_passwords else None" />
</div>
<div class="form-group field-confirm_password">
<label for="confirm_password" class="control-label">Confirm Password</label>
<input type="password" name="confirm_password"
id="confirm_password" class="form-control" required="required" />
</div>
<input type="hidden" name="redirect" t-att-value="redirect" />
<input type="hidden" name="token" t-att-value="token" />
<div class="clearfix oe_login_buttons">
<a t-attf-href="/web/login?{{ keep_query() }}"
class="btn btn-link pull-right">Back to Login</a>
<button type="submit" class="btn btn-primary pull-left">Sign up</button>
</div>
</form>
</t>
</template>
</data>
</odoo>

1
easy_my_coop/view/operation_request_view.xml

@ -32,7 +32,6 @@
<sheet>
<group>
<group>
<field name="state"/>
<field name="request_date" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="operation_type" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="receiver_not_member" attrs="{'invisible':[('operation_type','!=','transfer')]}"/>

6
easy_my_coop/view/res_company_view.xml

@ -21,6 +21,12 @@
<field name="default_lang_id"/>
<field name="board_representative"/>
<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="internal_rules_approval_required"/>
<field name="internal_rules_approval_text"/>
</group>
</xpath>
</field>

4
easy_my_coop/view/res_partner_view.xml

@ -30,6 +30,10 @@
<group>
<field name="gender" attrs="{'invisible':[('is_company','=',True)]}"/>
</group>
<group name="approvals">
<field name="data_policy_approved" />
<field name="internal_rules_approved" />
</group>
</xpath>
<xpath expr="//page[@name='sales_purchases']" position='after'>

2
easy_my_coop/view/subscription_request_view.xml

@ -79,6 +79,8 @@
<field name="lang"/>
<field name="validated"/>
<field name="skip_control_ng"/>
<field name="data_policy_approved"/>
<field name="internal_rules_approved"/>
</group>
</group>
<notebook>

81
easy_my_coop/view/subscription_template.xml

@ -70,11 +70,11 @@
</label>
</div>
<div t-attf-class="form-group">
<label>
<input type="checkbox" t-att-value="already_cooperator" name="already_cooperator" />
<div t-attf-class="form-group" style="display: none;">
Already cooperator?
</label>
<input type="checkbox"
name="already_cooperator"
t-att-checked="already_cooperator"/>
</div>
<div name="email_from_container" t-attf-class="form-group #{error and 'email_from' in error and 'has-error' or ''}">
@ -219,7 +219,7 @@
<td width="20%">
<div style="margin-top:12px" t-attf-class="form-group #{error and 'total_parts' in error and 'has-error' or ''}">
<div>
<input type="text" class="form-control total" name="total_parts" value="25" data-max="5000"
<input type="text" class="form-control total" name="total_parts" value="25" t-att-data-max="company.subscription_maximum_amount"
t-att-readonly="'readonly'"
/>
</div>
@ -240,6 +240,36 @@
<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 class="col-md-9 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox"
name="data_policy_approved"
t-att="{'required': 'required'} if data_policy_required else {}"
t-attf-value="#{data_policy_approved or ''}"/>
<t t-raw="data_policy_text"/>
</label>
</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 class="col-md-9 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox"
name="internal_rules_approved"
t-att="{'required': 'required'} if internal_rules_required else {}"
t-attf-value="#{internal_rules_approved or ''}"/>
<t t-raw="internal_rules_text"/>
</label>
</div>
</div>
</div>
<table style="margin-left:195px">
<tr>
<td width="80%">
@ -285,6 +315,12 @@
<label>
<input type="checkbox" t-att-value="is_company" checked="checked" name="is_company" />
Is a company?
</label>
<label>
Already cooperator?
<input type="checkbox"
name="already_cooperator"
t-att-checked="already_cooperator"/>
</label>
</div>
@ -502,6 +538,39 @@
<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 class="col-md-9 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox"
name="data_policy_approved"
t-att="{'required': 'required'} if data_policy_required else {}"
t-attf-value="#{data_policy_approved or ''}"/>
<t t-raw="data_policy_text"/>
</label>
</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 class="col-md-9 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox"
name="internal_rules_approved"
t-att="{'required': 'required'} if internal_rules_required else {}"
t-attf-value="#{internal_rules_approved or ''}"/>
<t t-raw="internal_rules_text"/>
</label>
</div>
</div>
</div>
<div t-attf-class="form-group" >
<div class="col-md-7 col-sm-8">
<table style="margin-left:195px">
<tr>
<td width="80%">
@ -516,6 +585,8 @@
</td>
</tr>
</table>
</div>
</div>
<br/>
</form>

7
easy_my_coop_ch/models/coop.py

@ -18,9 +18,16 @@ class subscription_request(models.Model):
req_fields = super(subscription_request, self).get_required_field()
if 'no_registre' in req_fields:
req_fields.remove('no_registre')
if 'iban' in req_fields:
req_fields.remove('iban')
return req_fields
def check_belgian_identification_id(self, nat_register_num):
# deactivate number validation for swiss localization
return True
def check_iban(self, iban):
if iban:
return super(subscription_request, self).check_iban(iban)
return True

16
easy_my_coop_ch/views/subscription_template.xml

@ -3,10 +3,26 @@
<data>
<template id="subscription_i18n_ch" inherit_id="easy_my_coop.becomecooperator" name="Removing fields">
<xpath expr="//label[@for='no_registre']/.." position="replace"/>
<xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="iban">Bank Account Number</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control mandatory-field" name="iban" t-attf-value="#{iban or ''}" placeholder="BE48523080767127"/>
</div>
</div>
</xpath>
</template>
<template id="company_subscription_i18n_ch" inherit_id="easy_my_coop.becomecompanycooperator" name="Company Removing fields">
<xpath expr="//label[@for='no_registre']/.." position="replace"/>
<xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="iban">Bank Account Number</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control mandatory-field" name="iban" t-attf-value="#{iban or ''}" placeholder="BE48523080767127"/>
</div>
</div>
</xpath>
</template>
</data>
</odoo>

8
easy_my_coop_export_xlsx/wizard/export_global_wizard.py

@ -22,8 +22,6 @@ HEADER = [
'Pays',
'Nombre de part total',
'Montant total des parts',
# 'Numero de demande',
# 'Statut',
'Demande de liberation de capital',
'Communication',
'Nombre de part',
@ -126,8 +124,8 @@ class export_global_report(models.TransientModel):
i += 1
worksheet1.write(j, i, line.price_subtotal)
i += 1
if invoice.payment_ids:
worksheet1.write(j, i, invoice.payment_ids[0].date)
if invoice.payment_move_line_ids:
worksheet1.write(j, i, invoice.payment_move_line_ids[0].date)
i += 1
if invoice.subscription_request:
ind = len(invoice.subscription_request)-1
@ -225,7 +223,7 @@ class export_global_report(models.TransientModel):
amount = quantity * sub_request.share_unit_price
worksheet1bis.write(j, i, amount)
i += 2
worksheet1bis.write(j, i, sub_request.sync_date)
worksheet1bis.write(j, i, sub_request.date)
j += 1
worksheet2 = workbook.add_worksheet()

Loading…
Cancel
Save