[IMP] partner_profiles_portal: add positions details in portal

Adds several portal views to consult all the positions of a structure,
and their details.
This commit is contained in:
Stéphan Sainléger
2023-06-13 16:06:47 +02:00
committed by Stéphan Sainléger
parent 95ddef62c3
commit 43d21befbf
9 changed files with 500 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "partner_profiles_portal",
"version": "12.0.2.3.0",
"version": "12.0.2.4.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Stéphan Sainléger",
@@ -27,7 +27,9 @@
"security/members_security.xml",
"views/portal_home_template.xml",
"views/portal_my_structures_template.xml",
"views/portal_my_positions_template.xml",
"views/portal_partner_structure_template.xml",
"views/portal_partner_position_template.xml",
"views/portal_my_account.xml",
"views/res_partner_view.xml",
"wizard/create_position_profile.xml",

View File

@@ -2,4 +2,6 @@
from . import portal_my_structures
from . import portal_structure_profile
from . import portal_my_positions
from . import portal_position_profile
from . import portal_my_account

View File

@@ -0,0 +1,80 @@
# Copyright 2020 Lokavaluto ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import http, _
from odoo.http import request
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager
class CustomerPortalMyPositions(CustomerPortal):
def _get_domain_my_positions(self, user):
if user.partner_id.structure_position_ids:
return [("id", "in", user.partner_id.structure_position_ids.ids),
("is_company", "=", False),
("is_position_profile", "=", True),
]
else:
return None
def _prepare_portal_layout_values(self):
values = super(CustomerPortalMyPositions, self)._prepare_portal_layout_values()
domain = self._get_domain_my_structures(request.env.user)
values["structure_count"] = request.env["res.partner"].search_count(domain) if domain else 0
return values
@http.route(
["/my/positions", "/my/positions/page/<int:page>"],
type="http",
auth="user",
website=True,
)
def portal_my_positions(
self, page=1, date_begin=None, date_end=None, sortby=None, **kw
):
values = self._prepare_portal_layout_values()
position = request.env["res.partner"]
domain = self._get_domain_my_positions(request.env.user)
searchbar_sortings = {
"name": {"label": _("Name"), "order": "name"},
"parent_id": {"label": _("Company"), "order": "parent_id"},
}
if not sortby:
sortby = "name"
order = searchbar_sortings[sortby]["order"]
# archive groups - Default Group By 'create_date'
archive_groups = self._get_archive_groups("res.partner", domain)
# structures count
position_count = position.search_count(domain) if domain else 0
# pager
pager = portal_pager(
url="/my/positions",
url_args={"sortby": sortby},
total=position_count,
page=page,
step=self._items_per_page,
)
# content according to pager and archive selected
positions = position.search(
domain,
order=order,
limit=self._items_per_page,
offset=pager["offset"],
) if domain else None
request.session["my_positions_history"] = positions.ids[:100] if positions else None
values.update(
{
"positions": positions,
"page_name": "position",
"archive_groups": archive_groups,
"default_url": "/my/positions",
"pager": pager,
"searchbar_sortings": searchbar_sortings,
"sortby": sortby,
}
)
return request.render("partner_profiles_portal.portal_my_positions", values)

View File

@@ -0,0 +1,120 @@
# Copyright 2020 Lokavaluto ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import base64
from odoo import http, tools, _
from odoo.exceptions import AccessError, MissingError
from odoo.http import request
from odoo.addons.portal.controllers.portal import CustomerPortal
class CustomerPortalPositionProfile(CustomerPortal):
def _position_get_page_view_values(self, position, access_token, **kwargs):
values = {
"page_name": "position",
"position": position,
}
return self._get_page_view_values(
position, access_token, values, "my_positions_history", False, **kwargs
)
def _details_position_form_validate(self, data, position_id):
error = dict()
error_message = []
# email validation
if data.get("email") and not tools.single_email_re.match(data.get("email")):
error["email"] = "error"
error_message.append(
_("Invalid Email! Please enter a valid email address.")
)
return error, error_message
def _get_position_profile_fields(self):
'''Provides all the fields that must fill the structure's position profile of the user.
All of them MUST start with "position_".'''
fields = [
"function",
"phone",
"email",
"edit_structure_profiles",
]
return fields
def _get_position_boolean_fields(self):
'''Provides the fields for which we must check the presence
in form's kw to know the value to save in the partner field.'''
fields = ["edit_structure_profiles"]
return fields
def _transform_fields(self, kw, profile_fields):
'''Transforms kw's values in res_partner fields and values'''
return {key: kw[key] for key in profile_fields if key in kw}
def _get_page_saving_position_values(self, kw):
profile_fields = self._get_position_profile_fields()
values = self._transform_fields(kw, profile_fields)
# Boolean fields are not returned in "kw" if their value in the form is False.
# Then we have to check their presence to determine which value to save in the partner.
boolean_fields = self._get_position_boolean_fields()
for key in boolean_fields:
values.update(
{
key: kw.get(key, "off") == "on"
}
)
return values
@http.route(
["/my/position/<int:position_id>", "/my/position/save"],
type="http",
auth="user",
website=True,
)
def portal_my_position(
self,position_id=None, access_token=None, redirect=None, **kw
):
# The following condition is to transform profile_id to an int, as it is sent as a string from the templace "portal_my_profile"
# TODO: find a better way to retrieve the profile_id at form submit step
if not isinstance(position_id, int):
position_id = int(position_id)
# Check that the user has the right to see this profile
try:
position_sudo = self._document_check_access(
"res.partner", position_id, access_token
)
except (AccessError, MissingError):
return request.redirect("/my/positions")
position_profile = request.env["res.partner"].browse(position_id)
values = self._position_get_page_view_values(position_sudo, access_token, **kw)
values.update(
{
"error": {},
"error_message": [],
}
)
if kw and request.httprequest.method == "POST":
# the user has clicked in the Save button to save new data
error, error_message = self._details_position_form_validate(kw, position_id)
values.update({"error": error, "error_message": error_message})
values.update(kw)
if not error:
# Update position profile
new_values = self._get_page_saving_position_values(kw)
position_profile.sudo().write(new_values)
# End of updates
if redirect:
return request.redirect(redirect)
return request.redirect("/my/positions")
# This is just the form page opening. We send all the data needed for the form fields
values.update(
{
"position_id": position_id, # Sent in order to retrieve it at submit time
"position": position_profile,
"redirect": "/my/position/" + str(position_id) + "?success=True"
}
)
return request.render("partner_profiles_portal.portal_position", values)

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-23 15:14+0000\n"
"PO-Revision-Date: 2023-05-23 15:14+0000\n"
"POT-Creation-Date: 2023-06-13 14:02+0000\n"
"PO-Revision-Date: 2023-06-13 14:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -15,8 +15,14 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "'s position in the structure"
msgstr " - Poste dans la structure"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "<i class=\"fa fa-fw fa-check-circle\"/> Data saved!"
msgstr "<i class=\"fa fa-fw fa-check-circle\"/> Données enregistrées!"
@@ -46,16 +52,36 @@ msgstr "<i>Nouveau logo :</i>"
msgid "<small>- Modification causes log out. Sign in just after!</small>"
msgstr "<small>- La modification entraîne une déconnexion. Reconnectez-vous ensuite !</small>"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "<span class=\"d-none d-md-inline\">Function</span>"
msgstr "<span class=\"d-none d-md-inline\">Poste occupé</span>"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "<span class=\"d-none d-md-inline\">Person name</span>"
msgstr "<span class=\"d-none d-md-inline\">Nom</span>"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_structures
msgid "<span class=\"d-none d-md-inline\">Structure name</span>"
msgstr "<span class=\"d-none d-md-inline\">Nom de la structure</span>"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "<span class=\"fa fa-arrow-left\"/> Back to my positions list"
msgstr "<span class=\"fa fa-arrow-left\"/> Retour à la liste des positions"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "<span class=\"fa fa-arrow-left\"/> Back to my structures list"
msgstr "<span class=\"fa fa-arrow-left\"/> Retour à la liste de mes structures"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "Access rights"
msgstr "Droits d'accès"
#. module: partner_profiles_portal
#: model:ir.model.fields,field_description:partner_profiles_portal.field_res_partner__odoo_user_id
#: model:ir.model.fields,field_description:partner_profiles_portal.field_res_users__odoo_user_id
@@ -90,16 +116,17 @@ msgid "City:"
msgstr "Ville :"
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_my_positions.py:40
#: code:addons/partner_profiles_portal/controllers/portal_my_profiles.py:51
#: code:addons/partner_profiles_portal/controllers/portal_my_structures.py:40
#, python-format
msgid "Company"
msgstr "Entreprise"
msgstr ""
#. module: partner_profiles_portal
#: model:ir.model,name:partner_profiles_portal.model_res_partner
msgid "Contact"
msgstr "Contact"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
@@ -129,6 +156,7 @@ msgid "Email"
msgstr "Courriel"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Email Pro:"
msgstr "Courriel pro :"
@@ -139,6 +167,7 @@ msgid "Email:"
msgstr "Courriel :"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Function:"
msgstr "Poste occupé :"
@@ -146,11 +175,12 @@ msgstr "Poste occupé :"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
msgid "Image"
msgstr "Image"
msgstr ""
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_my_account.py:115
#: code:addons/partner_profiles_portal/controllers/portal_partner_profile.py:40
#: code:addons/partner_profiles_portal/controllers/portal_position_profile.py:28
#: code:addons/partner_profiles_portal/controllers/portal_structure_profile.py:41
#, python-format
msgid "Invalid Email! Please enter a valid email address."
@@ -167,6 +197,12 @@ msgstr "L'email public n'est pas valide, merci de renseigner un email valide !"
msgid "Logo:"
msgstr "Logo :"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "Manage\n"
" the structure's profiles"
msgstr "Gère les profils de la structure"
#. module: partner_profiles_portal
#: model:ir.model.fields,field_description:partner_profiles_portal.field_create_position_profile__edit_structure_profiles
#: model:ir.model.fields,field_description:partner_profiles_portal.field_res_partner__edit_structure_profiles
@@ -177,13 +213,23 @@ msgstr "Gère les profiles de la structure"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
msgid "Mobile"
msgstr "Mobile"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Mobile:"
msgstr "Mobile :"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "My Position Details"
msgstr "Détail de la position"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "My Positions"
msgstr "Mes positions"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "My Structure Details"
@@ -199,6 +245,12 @@ msgstr "Mes Structures"
msgid "My information"
msgstr "Mes informations"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_home_profile_menu
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "My positions"
msgstr "Mes positions"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_home_profile_menu
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_structures
@@ -206,6 +258,7 @@ msgid "My structures"
msgstr "Mes structures"
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_my_positions.py:39
#: code:addons/partner_profiles_portal/controllers/portal_my_profiles.py:49
#: code:addons/partner_profiles_portal/controllers/portal_my_structures.py:39
#, python-format
@@ -230,6 +283,7 @@ msgid "Phone"
msgstr "Téléphone"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Phone Pro:"
msgstr "Téléphone pro :"
@@ -262,6 +316,7 @@ msgstr "Nom public :"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Save"
msgstr "Sauvegarder"
@@ -301,6 +356,12 @@ msgstr "Les informations suivantes sont des informations publiques qui peuvent
" pouvez les personnaliser (et vous rendre anonyme par exemple) pour montrer\n"
" publiquement ce que vous souhaitez ou avez besoin."
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_partner_profile.py:33
#, python-format
msgid "This nickname is already used, please find an other idea."
msgstr "The Pseudo est déjà utilisé, merci d'en trouver un autre."
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_my_account.py:130
#: code:addons/partner_profiles_portal/controllers/portal_structure_profile.py:34
@@ -323,6 +384,11 @@ msgstr "Site Web :"
msgid "You are not linked with any structure."
msgstr "Vous n'êtes lié à aucune structure."
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "You do not have any positions in your structure."
msgstr "Vous n'avez pas de positions occupées dans votre structure."
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_home_profile_menu
msgid "Your Details"
@@ -370,6 +436,7 @@ msgid "create Position Profile"
msgstr "créer un profil Position"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "details"
msgstr "détails"
@@ -377,7 +444,7 @@ msgstr "détails"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "e.g. https://odoo.com"
msgstr "e.g. https://odoo.com"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-23 15:12+0000\n"
"PO-Revision-Date: 2023-05-23 15:12+0000\n"
"POT-Creation-Date: 2023-06-13 13:59+0000\n"
"PO-Revision-Date: 2023-06-13 13:59+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -15,8 +15,14 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "'s position in the structure"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "<i class=\"fa fa-fw fa-check-circle\"/> Data saved!"
msgstr ""
@@ -46,16 +52,36 @@ msgstr ""
msgid "<small>- Modification causes log out. Sign in just after!</small>"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "<span class=\"d-none d-md-inline\">Function</span>"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "<span class=\"d-none d-md-inline\">Person name</span>"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_structures
msgid "<span class=\"d-none d-md-inline\">Structure name</span>"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "<span class=\"fa fa-arrow-left\"/> Back to my positions list"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "<span class=\"fa fa-arrow-left\"/> Back to my structures list"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "Access rights"
msgstr ""
#. module: partner_profiles_portal
#: model:ir.model.fields,field_description:partner_profiles_portal.field_res_partner__odoo_user_id
#: model:ir.model.fields,field_description:partner_profiles_portal.field_res_users__odoo_user_id
@@ -90,6 +116,7 @@ msgid "City:"
msgstr ""
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_my_positions.py:40
#: code:addons/partner_profiles_portal/controllers/portal_my_profiles.py:51
#: code:addons/partner_profiles_portal/controllers/portal_my_structures.py:40
#, python-format
@@ -129,6 +156,7 @@ msgid "Email"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Email Pro:"
msgstr ""
@@ -139,6 +167,7 @@ msgid "Email:"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Function:"
msgstr ""
@@ -151,6 +180,7 @@ msgstr ""
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_my_account.py:115
#: code:addons/partner_profiles_portal/controllers/portal_partner_profile.py:40
#: code:addons/partner_profiles_portal/controllers/portal_position_profile.py:28
#: code:addons/partner_profiles_portal/controllers/portal_structure_profile.py:41
#, python-format
msgid "Invalid Email! Please enter a valid email address."
@@ -167,6 +197,18 @@ msgstr ""
msgid "Logo:"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "Manage\n"
" the structure's profiles"
msgstr ""
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/models/res_partner.py:14
#, python-format
msgid "Manage structure's main profile"
msgstr ""
#. module: partner_profiles_portal
#: model:ir.model.fields,field_description:partner_profiles_portal.field_create_position_profile__edit_structure_profiles
#: model:ir.model.fields,field_description:partner_profiles_portal.field_res_partner__edit_structure_profiles
@@ -174,6 +216,12 @@ msgstr ""
msgid "Manage structure's profiles"
msgstr ""
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/models/res_partner.py:17
#, python-format
msgid "Manage structure's public profile"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
msgid "Mobile"
@@ -184,6 +232,16 @@ msgstr ""
msgid "Mobile:"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
msgid "My Position Details"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "My Positions"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "My Structure Details"
@@ -199,6 +257,12 @@ msgstr ""
msgid "My information"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_home_profile_menu
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "My positions"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_home_profile_menu
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_structures
@@ -206,6 +270,7 @@ msgid "My structures"
msgstr ""
#. module: partner_profiles_portal
#: code:addons/partner_profiles_portal/controllers/portal_my_positions.py:39
#: code:addons/partner_profiles_portal/controllers/portal_my_profiles.py:49
#: code:addons/partner_profiles_portal/controllers/portal_my_structures.py:39
#, python-format
@@ -229,6 +294,7 @@ msgid "Phone"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Phone Pro:"
msgstr ""
@@ -261,6 +327,7 @@ msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_details_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "Save"
msgstr ""
@@ -324,6 +391,11 @@ msgstr ""
msgid "You are not linked with any structure."
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_positions
msgid "You do not have any positions in your structure."
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_my_home_profile_menu
msgid "Your Details"
@@ -368,6 +440,7 @@ msgid "create Position Profile"
msgstr ""
#. module: partner_profiles_portal
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_position
#: model_terms:ir.ui.view,arch_db:partner_profiles_portal.portal_structure
msgid "details"
msgstr ""

View File

@@ -24,6 +24,14 @@
</button>
</a>
</div>
<div
id="positions" t-if="user_id.partner_id.is_company">
<a t-attf-href="/my/positions">
<button class="btn btn-primary mb8">
My positions
</button>
</a>
</div>
</div>
</div>
</xpath>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_positions" name="My Positions">
<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 Positions</t>
</t>
<h3>
My positions
</h3>
<div class="oe_position" id="oe_position_portal_my_positions_1" />
<t t-if="not positions">
<div class="alert alert-warning mt8" role="alert">
You do not have any positions in your structure.
</div>
</t>
<t t-if="positions" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>
<span class='d-none d-md-inline'>Person name</span>
</th>
<th>
<span class='d-none d-md-inline'>Function</span>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="positions" t-as="position">
<td>
<a t-attf-href="/my/position/#{position.id}?{{ keep_query() }}">
<span t-field="position.name" />
</a>
</td>
<td>
<span t-field="position.function" />
</td>
</tr>
</tbody>
</t>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_position" name="Position 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' % (position.id)" />
</t>
</t>
<t t-set="additional_title">My Position Details</t>
<div style="text-align:right">
<br />
<a href="/my/positions">
<span class="fa fa-arrow-left" /> Back to my positions list </a>
</div>
<form action="/my/position/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="position.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>
<!-- ##################### -->
<!-- POSITION PROFILE DATA -->
<!-- ##################### -->
<div>
<br />
<h3>
<span t-field="position.name" />'s position in the structure </h3>
<div class="row" id="position_function">
<div
t-attf-class="form-group #{error.get('function') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="function">Function: </label>
<input type="text" name="function"
t-attf-class="form-control #{error.get('function') and 'is-invalid' or ''}"
t-att-value="function or position.function" />
</div>
</div>
<div class="row" id="position_contact">
<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 Pro: </label>
<input type="email" name="email"
t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}"
t-att-value="email or position.email" />
</div>
<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 Pro: </label>
<input type="tel" name="phone"
t-attf-class="form-control #{error.get('phone') and 'is-invalid' or ''}"
t-att-value="phone or position.phone" />
</div>
</div>
</div>
<div id="position_access_rights">
<br />
<h3>
Access rights </h3>
<div id="edit_structure_profiles"
t-attf-class="form-group #{error.get('edit_structure_profiles') and 'o_has_error' or ''} col-xl-6">
<input type="checkbox" name="edit_structure_profiles"
t-att-checked="edit_structure_profiles or position.edit_structure_profiles" />
<label class="col-form-label" for="edit_structure_profiles">Manage
the structure's profiles</label>
</div>
</div>
<br />
<input type="hidden" name="position_id" t-att-value="position_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/positions">
<span class="fa fa-arrow-left" /> Back to my positions list </a>
</div>
</t>
</template>
</odoo>