Browse Source

[IMP] add lang to my account form

pull/134/head
houssine 4 years ago
parent
commit
186ebed453
  1. 9
      easy_my_coop_website_portal/__manifest__.py
  2. 6
      easy_my_coop_website_portal/controllers/main.py
  3. 14
      easy_my_coop_website_portal/views/easy_my_coop_website_portal_templates.xml

9
easy_my_coop_website_portal/__manifest__.py

@ -4,8 +4,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
"name": "Easy My Coop Website Portal", "name": "Easy My Coop Website Portal",
"version": "12.0.1.0.0",
"depends": ["easy_my_coop", "website", "account", "portal"],
"version": "12.0.1.0.1",
"depends": [
"easy_my_coop",
"website",
"account",
"portal"
],
"summary": """ "summary": """
Show cooperator information in the website portal. Show cooperator information in the website portal.
""", """,

6
easy_my_coop_website_portal/controllers/main.py

@ -18,7 +18,7 @@ from odoo.addons.portal.controllers.portal import (
class CooperatorPortalAccount(CustomerPortal): class CooperatorPortalAccount(CustomerPortal):
CustomerPortal.MANDATORY_BILLING_FIELDS.extend( CustomerPortal.MANDATORY_BILLING_FIELDS.extend(
["iban", "birthdate_date", "gender"]
["iban", "birthdate_date", "gender", "lang"]
) )
def _prepare_portal_layout_values(self): def _prepare_portal_layout_values(self):
@ -62,6 +62,7 @@ class CooperatorPortalAccount(CustomerPortal):
"invoice_count": invoice_count, "invoice_count": invoice_count,
"iban": iban, "iban": iban,
"genders": fields_desc["gender"]["selection"], "genders": fields_desc["gender"]["selection"],
"langs": request.env["res.lang"].search([])
} }
) )
return values return values
@ -81,9 +82,10 @@ class CooperatorPortalAccount(CustomerPortal):
@route(["/my/account"], type="http", auth="user", website=True) @route(["/my/account"], type="http", auth="user", website=True)
def account(self, redirect=None, **post): def account(self, redirect=None, **post):
partner = request.env.user.partner_id
res = super(CooperatorPortalAccount, self).account(redirect, **post) res = super(CooperatorPortalAccount, self).account(redirect, **post)
if not res.qcontext.get("error"): if not res.qcontext.get("error"):
partner = request.env.user.partner_id
partner_bank = request.env["res.partner.bank"] partner_bank = request.env["res.partner.bank"]
iban = post.get("iban") iban = post.get("iban")
if iban: if iban:

14
easy_my_coop_website_portal/views/easy_my_coop_website_portal_templates.xml

@ -28,6 +28,20 @@
</t> </t>
</select> </select>
</div> </div>
<div t-attf-class="form-group #{error.get('lang') and 'has-error' or ''} col-xl-6">
<label class="col-form-label" for="lang">Language</label>
<select name="lang"
t-attf-class="form-control #{error.get('lang') or ''}">
<option value=""></option>
<t t-foreach="langs or []"
t-as="langue">
<option t-att-value="langue.code"
t-att-selected="langue.code == partner.lang">
<t t-esc="langue.name"/>
</option>
</t>
</select>
</div>
<div t-attf-class="form-group #{error.get('birthdate_date') and 'o_has_error' or ''} col-xl-6"> <div t-attf-class="form-group #{error.get('birthdate_date') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="birthdate_date">Birthdate <label class="col-form-label" for="birthdate_date">Birthdate
</label> </label>

Loading…
Cancel
Save