[IMP] partner_profiles_portal: new portal structures data management

refactors the way a portal user can edit the data of the structures he
is affiliated with.
All main, public and position profiles data are gathered in one
"structure" form.
Adds several navigation improvement (back to structures list,
validation message, ...)
This commit is contained in:
Stéphan Sainléger
2023-04-20 21:59:06 +02:00
committed by Stéphan Sainléger
parent 5c16620fe6
commit 859d672633
13 changed files with 629 additions and 493 deletions

View File

@@ -14,9 +14,10 @@
My information
</button>
</a>
<a t-attf-href="/my/profiles">
<br />
<a t-attf-href="/my/structures">
<button class="btn btn-primary mb8">
Consult my profiles
My structures
</button>
</a>
</div>

View File

@@ -1,97 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_profiles" name="My Profiles">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">Profiles</t>
</t>
<div class="oe_structure" id="oe_structure_portal_my_profiles_1" />
<t t-if="not profiles">
<div class="alert alert-warning mt8" role="alert">
There are no profiles.
</div>
</t>
<h3>
<br />
My profiles
</h3>
<t t-if="profiles" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>
<span class='d-none d-md-inline'>Profile name</span>
</th>
<th class="text-right">Profile type</th>
<th class="text-right">Position</th>
<th class="text-right">Company</th>
</tr>
</thead>
<tbody>
<tr t-foreach="profiles" t-as="profile">
<t t-if="not profile.is_company">
<td>
<a t-attf-href="/my/profile/#{profile.id}?{{ keep_query() }}">
<span t-field="profile.name" />
</a>
</td>
<td class="text-right">
<span t-field="profile.partner_profile" />
</td>
<td class="text-right">
<span t-field="profile.function" />
</td>
<td class="text-right">
<span t-field="profile.parent_id" />
</td>
</t>
</tr>
</tbody>
</t>
<p style="font-style:italic; font-size:smaller">
<b>Public profile :</b>
profiles that might be available to tierce applications (annuary for instance).
<br />
<b>Position profiles :</b>
profiles that indicate your belonging to an organization, and the role you have in.
</p>
<h3>
<br />
My organizations' profiles
</h3>
<t t-if="profiles" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>
<span class='d-none d-md-inline'>Profile name</span>
</th>
<th class="text-right">Profile type</th>
</tr>
</thead>
<tbody>
<tr t-foreach="profiles" t-as="profile">
<t t-if="profile.is_company">
<td>
<a t-attf-href="/my/profile/#{profile.id}?{{ keep_query() }}">
<span t-field="profile.name" />
</a>
</td>
<td class="text-right">
<span t-field="profile.partner_profile" />
</td>
</t>
</tr>
</tbody>
</t>
<p style="font-style:italic; font-size:smaller">
<b>Main profiles :</b>
internal and private profiles, used for membership management and internal communication.
<br />
<b>Public profiles :</b>
profiles that might be available to tierce applications (annuary for instance).
</p>
<div class="oe_structure" id="oe_structure_portal_my_profiles_2" />
</t>
</template>
</odoo>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_structures" name="My Structures">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">My Structures</t>
</t>
<h3>
My structures
</h3>
<div class="oe_structure" id="oe_structure_portal_my_structures_1" />
<t t-if="not structures">
<div class="alert alert-warning mt8" role="alert">
You are not linked with any structure.
</div>
</t>
<t t-if="structures" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>
<span class='d-none d-md-inline'>Structure name</span>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="structures" t-as="structure">
<td>
<a t-attf-href="/my/structure/#{structure.id}?{{ keep_query() }}">
<span t-field="structure.name" />
</a>
</td>
</tr>
</tbody>
</t>
</t>
</template>
</odoo>

View File

@@ -1,189 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_profile" name="My Profile">
<t t-call="portal.portal_layout">
<t t-set="o_portal_fullwidth_alert" groups="profile.group_profile_user">
<t t-call="portal.portal_back_in_edit_mode">
<t t-set="backend_url" t-value="'/web#return_label=Website&amp;model=res.partner&amp;id=%s&amp;view_type=form' % (profile.id)" />
</t>
</t>
<t t-call="portal.portal_record_layout">
<t t-set="card_header">
<h5 class="mb-0">
<strong>
<span t-field="profile.name" />
</strong>
<small class="text-muted">
-
<span t-field="profile.partner_profile" />
</small>
</h5>
<div t-if="profile.is_position_profile">
<h5 class="mb-0">
<span t-field="profile.parent_id" />
</h5>
<br />
<ul class="col-12 col-md-6 pb-2" style="list-style-type:none">
<li>
<span t-field="profile.street" />
</li>
<li>
<span t-field="profile.zip" />
</li>
<li>
<span t-field="profile.city" />
</li>
<li>
<span t-field="profile.country_id" />
</li>
</ul>
</div>
</t>
<t t-set="card_body">
<div class="oe_structure" id="oe_structure_portal_my_profile_1" />
<!-- Body for Position partner profiles-->
<div t-if="profile.is_position_profile">
<form action="/my/profile/save" method="post">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<div class="row o_portal_details">
<div class="col-lg-12">
<div class="col-lg-12">
<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>
<h3>
<br />
Job position
</h3>
<div class="row">
<div t-attf-class="form-group #{error.get('function') and 'o_has_error' or ''} col-xl-12">
<input type="text" name="function" t-attf-class="form-control #{error.get('function') and 'is-invalid' or ''}" t-att-value="function or profile.function" />
</div>
</div>
<h3>
<br />
Contact information
</h3>
<div class="row">
<div t-attf-class="form-group #{error.get('phone') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="phone">Phone</label>
<input type="tel" name="phone" t-attf-class="form-control #{error.get('phone') and 'is-invalid' or ''}" t-att-value="phone or profile.phone" />
</div>
<div t-attf-class="form-group #{error.get('mobile') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="mobile">Mobile</label>
<input type="tel" name="mobile" t-attf-class="form-control #{error.get('mobile') and 'is-invalid' or ''}" t-att-value="mobile or profile.mobile" />
</div>
<div t-attf-class="form-group #{error.get('email') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="email">Email</label>
<input type="email" name="email" t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}" t-att-value="email or profile.email" />
</div>
<div t-attf-class="form-group #{error.get('website_url') and 'o_has_error' or ''}col-xl-6">
<label class="col-form-label" for="website_url">Website</label>
<input type="text" name="website_url" t-attf-class="form-control #{error.get('website') and 'is-invalid' or ''}" t-att-value="website_url or profile.website" />
</div>
</div>
<input type="hidden" name="profile_id" t-att-value="profile_id" />
<input type="hidden" name="redirect" t-att-value="redirect" />
<div class="clearfix">
<button type="submit" class="btn btn-primary float-right mb32 ">
Save
<span class="fa fa-long-arrow-right" />
</button>
</div>
</div>
</div>
</form>
</div>
<!-- Body for Public partner profiles-->
<div t-if="profile.is_main_profile or profile.is_public_profile">
<form action="/my/profile/save" method="post">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<div class="row o_portal_details">
<div class="col-lg-12">
<div name="errors" class="col-lg-12">
<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 name="nickname" class="row">
<div t-attf-class="form-group #{error.get('nickname') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="nickname">Name / Nickname</label>
<input type="text" name="nickname" t-attf-class="form-control #{error.get('nickname') and 'is-invalid' or ''}" t-att-value="nickname or profile.name" />
</div>
</div>
<h3>
<br />
Contact information
</h3>
<div name="contact_info_1" class="row">
<div name="street" t-attf-class="form-group #{error.get('street') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="street">Street</label>
<input type="text" name="street" t-attf-class="form-control #{error.get('street') and 'is-invalid' or ''}" t-att-value="street or profile.street" />
</div>
<div name="street2" t-attf-class="form-group #{error.get('street2') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="street2">Street 2</label>
<input type="text" name="street2" t-attf-class="form-control #{error.get('street2') and 'is-invalid' or ''}" t-att-value="street2 or profile.street2" />
</div>
<div name="zip" t-attf-class="form-group #{error.get('zipcode') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="zipcode">Zip / Postal Code</label>
<input type="text" name="zipcode" t-attf-class="form-control #{error.get('zipcode') and 'is-invalid' or ''}" t-att-value="zipcode or profile.zip" />
</div>
<div name="city" t-attf-class="form-group #{error.get('city') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="city">City</label>
<input type="text" name="city" t-attf-class="form-control #{error.get('city') and 'is-invalid' or ''}" t-att-value="city or profile.city" />
</div>
<div name="country" t-attf-class="form-group #{error.get('country_id') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="country_id">Country</label>
<select name="country_id" t-attf-class="form-control">
<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) if country_id else country.id == profile.country_id.id">
<t t-esc="country.name" />
</option>
</t>
</select>
</div>
</div>
<div name="contact_info_2" class="row">
<div name="phone" t-attf-class="form-group #{error.get('phone') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="phone">Phone</label>
<input type="tel" name="phone" t-attf-class="form-control #{error.get('phone') and 'is-invalid' or ''}" t-att-value="phone or profile.phone" />
</div>
<div name="mobile" t-attf-class="form-group #{error.get('mobile') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="mobile">Mobile</label>
<input type="tel" name="mobile" t-attf-class="form-control #{error.get('mobile') and 'is-invalid' or ''}" t-att-value="mobile or profile.mobile" />
</div>
<div name="email" t-attf-class="form-group #{error.get('email') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="email">Email</label>
<input type="email" name="email" t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}" t-att-value="email or profile.email" />
</div>
<div name="website" t-attf-class="form-group #{error.get('website_url') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="website_url">Website</label>
<input type="text" name="website_url" t-attf-class="form-control #{error.get('website_url') and 'is-invalid' or ''}" t-att-value="website_url or profile.website" />
</div>
</div>
<input type="hidden" name="profile_id" t-att-value="profile_id" />
<input type="hidden" name="redirect" t-att-value="redirect" />
<div class="clearfix">
<button type="submit" class="btn btn-primary float-right mb32 ">
Save
<span class="fa fa-long-arrow-right" />
</button>
</div>
</div>
</div>
</form>
</div>
<div class="oe_structure" id="oe_structure_portal_my_profile_2" />
</t>
</t>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,316 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_structure" name="Structure Details">
<t t-call="portal.portal_layout">
<t t-set="o_portal_fullwidth_alert" groups="profile.group_profile_user">
<t t-call="portal.portal_back_in_edit_mode">
<t t-set="backend_url"
t-value="'/web#return_label=Website&amp;model=res.partner&amp;id=%s&amp;view_type=form' % (structure.id)" />
</t>
</t>
<t t-set="additional_title">My Structure Details</t>
<div style="text-align:right">
<br />
<a href="/my/structures">
<span class="fa fa-arrow-left" /> Back to my structures list </a>
</div>
<form action="/my/structure/save" 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">
<h1 style="text-align: center;">
<span t-field="structure.name" /> details </h1>
<div t-if="success" class="alert alert-success py-1 mb-2">
<i class="fa fa-fw fa-check-circle" /> Data saved! </div>
<div t-if="error_message" role="alert" class="col-lg-12 alert alert-danger">
<t t-foreach="error_message" t-as="err">
<t t-esc="err" />
<br />
</t>
</div>
<!-- ################# -->
<!-- MAIN PROFILE DATA -->
<!-- ################# -->
<div class="row">
<div id="name"
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">Name: </label>
<input t-if="can_edit_structure" 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 structure.name" />
<span t-if="not can_edit_structure" t-field="structure.name" />
</div>
<div t-attf-class="col-xl-12" id="logo">
<label class="col-form-label">Logo: </label>
<div class="row">
<div t-attf-class="col-xl-2">
<i>Current logo:</i>
<div name="image" t-field="structure.image"
t-options="{&quot;widget&quot;: &quot;image&quot;, &quot;preview_image&quot;: &quot;image_512&quot;, &quot;class&quot;: &quot;d-block mx-auto mb16&quot;}" />
</div>
<div class="form-group form-field form-field-binary"
data-model-field="false" data-optional="true"
t-attf-class="col-xl-2" t-if="can_edit_structure">
<i>New logo:</i>
<i>
<input type="file" name="logo" multiple="false"
data-show-upload="true" data-show-caption="true"
accept="image/*" />
</i>
</div>
</div>
</div>
</div>
<div id="contact">
<br />
<h3>
Contact information
</h3>
<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 t-if="can_edit_structure" type="text" name="main_street"
placeholder="Street"
t-attf-class="form-control #{error.get('main_street') and 'is-invalid' or ''}"
t-att-value="main_street or structure.street" />
<span t-if="not can_edit_structure" t-field="structure.street" />
<input t-if="can_edit_structure" type="text" name="main_street2"
placeholder="Street 2 "
t-attf-class="form-control #{error.get('main_street2') and 'is-invalid' or ''}"
t-att-value="main_street2 or structure.street2" />
<span t-if="not can_edit_structure"> - </span>
<span t-if="not can_edit_structure" t-field="structure.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 t-if="can_edit_structure" type="text" name="main_zip"
t-attf-class="form-control #{error.get('main_zip') and 'is-invalid' or ''}"
t-att-value="main_zip or structure.zip" />
<span t-if="not can_edit_structure" t-field="structure.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 t-if="can_edit_structure" type="text" name="main_city"
t-attf-class="form-control #{error.get('main_city') and 'is-invalid' or ''}"
t-att-value="main_city or structure.city" />
<span t-if="not can_edit_structure" t-field="structure.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 t-if="can_edit_structure" name="main_country_id"
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 == structure.country_id.id">
<t t-esc="country.name" />
</option>
</t>
</select>
<span t-if="not can_edit_structure"
t-field="structure.country_id" />
</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 t-if="can_edit_structure" type="tel" name="main_phone"
t-attf-class="form-control #{error.get('main_phone') and 'is-invalid' or ''}"
t-att-value="main_phone or structure.phone" />
<span t-if="not can_edit_structure" t-field="structure.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 t-if="can_edit_structure" type="tel" name="main_mobile"
t-attf-class="form-control #{error.get('main_mobile') and 'is-invalid' or ''}"
t-att-value="main_mobile or structure.mobile" />
<span t-if="not can_edit_structure" t-field="structure.mobile" />
</div>
<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>
<input t-if="can_edit_structure" 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 structure.email" />
<span t-if="not can_edit_structure" t-field="structure.email" />
</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 t-if="can_edit_structure" type="text" name="main_website"
placeholder="e.g. https://odoo.com"
t-attf-class="form-control #{error.get('main_website') and 'is-invalid' or ''}"
t-att-value="main_website or structure.website" />
<span t-if="not can_edit_structure" t-field="structure.website" />
</div>
</div>
</div>
<!-- ##################### -->
<!-- POSITION PROFILE DATA -->
<!-- ##################### -->
<div id="position_data">
<br />
<h3>
Your position in the structure
</h3>
<div class="row" id="position_function">
<div
t-attf-class="form-group #{error.get('position_function') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="position_function">Function: </label>
<input type="text" name="position_function"
t-attf-class="form-control #{error.get('position_function') and 'is-invalid' or ''}"
t-att-value="position_function or position_profile.function" />
</div>
</div>
<div class="row" id="position_contact">
<div
t-attf-class="form-group #{error.get('position_email') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="position_email">Email Pro: </label>
<input type="email" name="position_email"
t-attf-class="form-control #{error.get('position_email') and 'is-invalid' or ''}"
t-att-value="position_email or position_profile.email" />
</div>
<div
t-attf-class="form-group #{error.get('position_phone') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="position_phone">Phone Pro: </label>
<input type="tel" name="position_phone"
t-attf-class="form-control #{error.get('position_phone') and 'is-invalid' or ''}"
t-att-value="position_phone or position_profile.phone" />
</div>
</div>
</div>
<br />
<!-- ################### -->
<!-- PUBLIC PROFILE DATA -->
<!-- ################### -->
<div class="s_card card bg-white w-100" id="public">
<h3 class="card-header">
Public contact 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">Public name: </label>
<input t-if="can_edit_structure" 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_profile.name" />
<span t-if="not can_edit_structure"
t-field="public_profile.name" />
</div>
<div
t-attf-class="form-group #{error.get('public_street') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="public_street">Street: </label>
<input t-if="can_edit_structure" type="text"
name="public_street" placeholder="Street"
t-attf-class="form-control #{error.get('public_street') and 'is-invalid' or ''}"
t-att-value="public_street or public_profile.street" />
<span t-if="not can_edit_structure"
t-field="public_profile.street" />
<input t-if="can_edit_structure" type="text"
name="public_street2"
placeholder="Street 2"
t-attf-class="form-control #{error.get('public_street2') and 'is-invalid' or ''}"
t-att-value="public_street2 or public_profile.street2" />
<span t-if="not can_edit_structure"> - </span>
<span t-if="not can_edit_structure"
t-field="public_profile.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 t-if="can_edit_structure" 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_profile.zip" />
<span t-if="not can_edit_structure"
t-field="public_profile.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 t-if="can_edit_structure" 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_profile.city" />
<span t-if="not can_edit_structure"
t-field="public_profile.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 t-if="can_edit_structure" 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_profile.phone" />
<span t-if="not can_edit_structure"
t-field="public_profile.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 t-if="can_edit_structure" 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_profile.mobile" />
<span t-if="not can_edit_structure"
t-field="public_profile.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 t-if="can_edit_structure" 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_profile.email" />
<span t-if="not can_edit_structure"
t-field="public_profile.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 t-if="can_edit_structure" 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_profile.website" />
<span t-if="not can_edit_structure"
t-field="public_profile.website" />
</div>
</div>
</div>
</div>
<input type="hidden" name="structure_id" t-att-value="structure_id" />
<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>
<div style="text-align:right">
<br />
<a href="/my/structures">
<span class="fa fa-arrow-left" /> Back to my structures list </a>
</div>
</t>
</template>
</odoo>

View File

@@ -9,22 +9,26 @@
<field name="arch" type="xml">
<!-- Main display -->
<xpath expr="//group[@name='profile_status']" position="after">
<group name="structure_access_rights" attrs="{'invisible': ['|', ('is_position_profile','=',False), ('parent_id','=',False)]}">
<field name="edit_structure_main_profile" />
<field name="edit_structure_public_profile" />
<group name="structure_access_rights"
attrs="{'invisible': ['|', ('is_position_profile','=',False), ('parent_id','=',False)]}">
<field name="edit_structure_profiles" />
</group>
</xpath>
<!-- page Contacts & Adresses -->
<xpath expr="//field[@name='child_ids']/form/sheet/group/group/field[@name='comment']" position="before">
<field name="edit_structure_main_profile" attrs="{'invisible': [('is_position_profile','=',False)]}" />
<field name="edit_structure_public_profile" attrs="{'invisible': [('is_position_profile','=',False)]}" />
<xpath
expr="//field[@name='child_ids']/form/sheet/group/group/field[@name='comment']"
position="before">
<field name="edit_structure_profiles"
attrs="{'invisible': [('is_position_profile','=',False)]}" />
</xpath>
<!-- page Other Positions -->
<xpath expr="//field[@name='other_contact_ids']/form/sheet/group/group/field[@name='parent_id']" position="after">
<field name="edit_structure_main_profile" attrs="{'invisible': [('is_position_profile','=',False)]}" />
<field name="edit_structure_public_profile" attrs="{'invisible': [('is_position_profile','=',False)]}" />
<xpath
expr="//field[@name='other_contact_ids']/form/sheet/group/group/field[@name='parent_id']"
position="after">
<field name="edit_structure_profiles"
attrs="{'invisible': [('is_position_profile','=',False)]}" />
</xpath>
</field>
</record>