[IMP] partner_profiles_portal: refactoring of user information
Merge the main and public information edition in /my/account portal page.
This commit is contained in:
committed by
Stéphan Sainléger
parent
4401cfab79
commit
5c16620fe6
@@ -1,15 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="portal_my_home_profile_menu" name="Portal My Home: Profile Menu" inherit_id="portal.portal_layout" priority="40">
|
||||
<template id="portal_my_home_profile_menu" name="Portal My Home: Profile Menu"
|
||||
inherit_id="portal.portal_layout" priority="40">
|
||||
<xpath expr="//div[hasclass('o_portal_my_details')]" position="replace">
|
||||
<div class="o_portal_my_details">
|
||||
<h4>Your Details </h4>
|
||||
<hr class="mt-1 mb-0" />
|
||||
<div class="mb8" t-field="user_id.partner_id" t-options="{"widget": "contact", "fields": ["email", "phone", "address", "name"]}" />
|
||||
<div class="mb8" t-field="user_id.partner_id"
|
||||
t-options="{"widget": "contact", "fields": ["email", "phone", "address", "name"]}" />
|
||||
<div name="profiles_management">
|
||||
<a t-attf-href="/my/account">
|
||||
<button class="btn btn-primary mb8">
|
||||
Modify my account
|
||||
My information
|
||||
</button>
|
||||
</a>
|
||||
<a t-attf-href="/my/profiles">
|
||||
|
234
partner_profiles_portal/views/portal_my_account.xml
Normal file
234
partner_profiles_portal/views/portal_my_account.xml
Normal file
@@ -0,0 +1,234 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="portal_my_details_profiles" inherit_id="portal.portal_my_details"
|
||||
name="User profiles details">
|
||||
<xpath expr="//form" position="replace">
|
||||
<form action="/my/account" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
|
||||
<div class="row o_portal_details">
|
||||
<div class="col-lg-12">
|
||||
<div id="messages" class="col-lg-12">
|
||||
<div t-if="success" class="alert alert-success">
|
||||
<i class="fa fa-fw fa-check-circle" /> Data saved! </div>
|
||||
<div t-if="error_message" class="alert alert-danger" role="alert">
|
||||
<t t-foreach="error_message" t-as="err">
|
||||
<t t-esc="err" />
|
||||
<br />
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="name">
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_name') and 'o_has_error' or ''} col-xl-12">
|
||||
<label class="col-form-label" for="main_name">Your Name</label>
|
||||
<input type="text" name="main_name" required="True"
|
||||
t-attf-class="form-control #{error.get('main_name') and 'is-invalid' or ''}"
|
||||
t-att-value="main_name or partner.name" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="logo">
|
||||
<label class="col-form-label">Image</label>
|
||||
<div class="row">
|
||||
<div t-attf-class="col-xl-2">
|
||||
<i>Current logo/picture:</i>
|
||||
<div name="image" t-field="partner.image"
|
||||
t-options="{"widget": "image", "preview_image": "image_512", "class": "d-block mx-auto mb16"}" />
|
||||
</div>
|
||||
<div class="form-group form-field form-field-binary"
|
||||
data-model-field="false" data-optional="true"
|
||||
t-attf-class="col-xl-2">
|
||||
<i>New logo/picture:</i>
|
||||
<i>
|
||||
<input type="file" name="main_logo" multiple="false"
|
||||
data-show-upload="true" data-show-caption="true"
|
||||
accept="image/*" />
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="contact">
|
||||
<br />
|
||||
<h3>
|
||||
Contact information
|
||||
</h3>
|
||||
<div class="row" id="email">
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_email') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_email">Email</label>
|
||||
<small>- Modification causes log out. Sign in just after!</small>
|
||||
<input type="email" name="main_email" required="True"
|
||||
t-attf-class="form-control #{error.get('main_email') and 'is-invalid' or ''}"
|
||||
t-att-value="main_email or partner.email" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="adress">
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_street') and 'o_has_error' or ''} col-xl-12">
|
||||
<label class="col-form-label" for="main_street">Street</label>
|
||||
<input type="text" name="main_street"
|
||||
t-attf-class="form-control #{error.get('main_street') and 'is-invalid' or ''}"
|
||||
t-att-value="main_street or partner.street" />
|
||||
<input type="text" name="main_street2"
|
||||
t-attf-class="form-control #{error.get('main_street2') and 'is-invalid' or ''}"
|
||||
t-att-value="main_street2 or partner.street2" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_zip') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_zip">Zip / Postal Code</label>
|
||||
<input type="text" name="main_zip"
|
||||
t-attf-class="form-control #{error.get('zip') and 'is-invalid' or ''}"
|
||||
t-att-value="main_zip or partner.zip" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_city') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_city">City</label>
|
||||
<input type="text" name="main_city"
|
||||
t-attf-class="form-control #{error.get('main_city') and 'is-invalid' or ''}"
|
||||
t-att-value="main_city or partner.city" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_country_id') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_country_id">Country</label>
|
||||
<select name="main_country_id" required="True"
|
||||
t-attf-class="form-control #{error.get('main_country_id') and 'is-invalid' or ''}">
|
||||
<option value="">Country...</option>
|
||||
<t t-foreach="countries or []" t-as="country">
|
||||
<option t-att-value="country.id"
|
||||
t-att-selected="country.id == int(main_country_id) if main_country_id else country.id == partner.country_id.id">
|
||||
<t t-esc="country.name" />
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_state_id') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_state_id">State /
|
||||
Province</label>
|
||||
<select name="main_state_id"
|
||||
t-attf-class="form-control #{error.get('state_id') and 'is-invalid' or ''}">
|
||||
<option value="">select...</option>
|
||||
<t t-foreach="states or []" t-as="state">
|
||||
<option t-att-value="state.id" style="display:none;"
|
||||
t-att-data-country_id="state.country_id.id"
|
||||
t-att-selected="state.id == partner.state_id.id">
|
||||
<t t-esc="state.name" />
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="other_contact_data">
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_phone') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_phone">Phone</label>
|
||||
<input type="tel" name="main_phone"
|
||||
t-attf-class="form-control #{error.get('main_phone') and 'is-invalid' or ''}"
|
||||
t-att-value="main_phone or partner.phone" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_mobile') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_mobile">Mobile</label>
|
||||
<input type="tel" name="main_mobile"
|
||||
t-attf-class="form-control #{error.get('main_mobile') and 'is-invalid' or ''}"
|
||||
t-att-value="main_mobile or partner.mobile" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('main_website') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="main_website">Website</label>
|
||||
<input type="text" name="main_website"
|
||||
t-attf-class="form-control #{error.get('main_website') and 'is-invalid' or ''}"
|
||||
t-att-value="main_website or partner.website" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="s_card card bg-white w-100" id="public">
|
||||
<h3 class="card-header">
|
||||
Public information
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<p> The following information are public information that might be
|
||||
used in tierce applications (annuary for instance).<br /> You
|
||||
can customize them (and be anonymous for instance) to publicly
|
||||
show whatever you need or want. </p>
|
||||
<div class="row">
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_name') and 'o_has_error' or ''} col-xl-12">
|
||||
<label class="col-form-label" for="public_name">Name /
|
||||
Nickname</label>
|
||||
<input type="text" name="public_name" required="True"
|
||||
t-attf-class="form-control #{error.get('public_name') and 'is-invalid' or ''}"
|
||||
t-att-value="public_name or public_partner.name" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_street') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="public_street">Street</label>
|
||||
<input type="text" name="public_street"
|
||||
t-attf-class="form-control #{error.get('public_street') and 'is-invalid' or ''}"
|
||||
t-att-value="public_street or public_partner.street" />
|
||||
<input type="text" name="public_street2"
|
||||
t-attf-class="form-control #{error.get('public_street2') and 'is-invalid' or ''}"
|
||||
t-att-value="public_street2 or public_partner.street2" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_zip') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="public_zip">Zip / Postal
|
||||
Code</label>
|
||||
<input type="text" name="public_zip"
|
||||
t-attf-class="form-control #{error.get('public_zip') and 'is-invalid' or ''}"
|
||||
t-att-value="public_zip or public_partner.zip" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_city') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="public_city">City</label>
|
||||
<input type="text" name="public_city"
|
||||
t-attf-class="form-control #{error.get('public_city') and 'is-invalid' or ''}"
|
||||
t-att-value="public_city or public_partner.city" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_phone') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="public_phone">Phone</label>
|
||||
<input type="tel" name="public_phone"
|
||||
t-attf-class="form-control #{error.get('public_phone') and 'is-invalid' or ''}"
|
||||
t-att-value="public_phone or public_partner.phone" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_mobile') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="public_mobile">Mobile</label>
|
||||
<input type="tel" name="public_mobile"
|
||||
t-attf-class="form-control #{error.get('public_mobile') and 'is-invalid' or ''}"
|
||||
t-att-value="public_mobile or public_partner.mobile" />
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_email') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="public_email">Email</label>
|
||||
<input type="email" name="public_email"
|
||||
t-attf-class="form-control #{error.get('public_email') and 'is-invalid' or ''}"
|
||||
t-att-value="public_email or public_partner.email" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
t-attf-class="form-group #{error.get('public_website') and 'o_has_error' or ''} col-xl-6">
|
||||
<label class="col-form-label" for="public_website">Website</label>
|
||||
<input type="text" name="public_website"
|
||||
t-attf-class="form-control #{error.get('public_website') and 'is-invalid' or ''}"
|
||||
t-att-value="public_website or public_partner.website" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="redirect" t-att-value="redirect" />
|
||||
<div style="text-align:right;">
|
||||
<button type="submit"
|
||||
class="btn btn-primary ">Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
Reference in New Issue
Block a user