-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by mikevhe18
- Loading branch information
Showing
14 changed files
with
929 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
========================= | ||
Partner Experience Portal | ||
========================= | ||
|
||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
1. Clone the branch 14.0 of the repository https://github.com/open-synergy/ssi-partner | ||
2. Add the path to this repository in your configuration (addons-path) | ||
3. Update the module list | ||
4. Go to menu *Apps -> Apps -> Main Apps* | ||
5. Search For *Partner Experience Portal* | ||
6. Install the module | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/open-synergy/ssi-partner/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed | ||
and welcomed feedback. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Miftahussalam <miftahussalam08@gmail.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://simetri-sinergi.id/logo.png | ||
:alt: PT. Simetri Sinergi Indonesia | ||
:target: https://simetri-sinergi.id | ||
|
||
This module is maintained by the PT. Simetri Sinergi Indonesia. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import ( | ||
models, | ||
controllers, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Partner Experience Portal", | ||
"version": "14.0.1.0.0", | ||
"website": "https://simetri-sinergi.id", | ||
"author": "OpenSynergy Indonesia, PT. Simetri Sinergi Indonesia", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"application": True, | ||
"auto_install": True, | ||
"depends": [ | ||
"ssi_partner_experience", | ||
"ssi_partner_portal", | ||
], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"security/ir_rule_data.xml", | ||
"views/assets.xml", | ||
"views/portal_templates.xml", | ||
], | ||
"demo": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import portal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
|
||
from odoo.http import request, route | ||
|
||
from odoo.addons.portal.controllers import portal | ||
from odoo.addons.portal.controllers.portal import CustomerPortal | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class CustomerPortalExtended(CustomerPortal): | ||
@route(["/my/academics"], type="http", auth="user", website=True, methods=["GET"]) | ||
def academics(self): | ||
values = self._prepare_portal_layout_values() | ||
values["get_error"] = portal.get_error | ||
values["academic_ids"] = request.env["portal_partner_academic"].search( | ||
[("partner_id", "=", request.env.user.partner_id.id)] | ||
) | ||
|
||
return request.render( | ||
"ssi_partner_experience_portal.portal_my_academics", | ||
values, | ||
headers={"X-Frame-Options": "DENY"}, | ||
) | ||
|
||
@route( | ||
["/my/academic", "/my/academic/<int:id>"], | ||
type="http", | ||
auth="user", | ||
website=True, | ||
methods=["GET", "POST"], | ||
) | ||
def academic(self, **post): | ||
id = post.get("id") | ||
partner_obj = request.env["res.partner"].sudo() | ||
academic_obj = request.env["portal_partner_academic"] | ||
education_level_obj = request.env["partner.formal_education_level"] | ||
field_of_study_obj = request.env["partner.field_of_study"] | ||
values = self._prepare_portal_layout_values() | ||
error_messages = [] | ||
values.update( | ||
{ | ||
"error_message": "", | ||
"partner_address_ids": partner_obj.search([("is_company", "=", True)]), | ||
"education_level_ids": education_level_obj.search([]), | ||
"field_of_study_ids": field_of_study_obj.search([]), | ||
"current_academic_id": academic_obj, | ||
} | ||
) | ||
current_academic_id = academic_obj | ||
if id: | ||
id = int(id) | ||
current_academic_id = academic_obj.search([("id", "=", id)]) | ||
values.update( | ||
{ | ||
"current_academic_id": current_academic_id, | ||
} | ||
) | ||
|
||
if request.httprequest.method == "POST": | ||
academic_vals = { | ||
"partner_id": request.env.user.partner_id.id, | ||
"location": post.get("location"), | ||
"date_start": post.get("date_start") or False, | ||
"expire": post.get("expire"), | ||
"date_end": post.get("date_end") or False, | ||
"diploma": post.get("diploma"), | ||
"gpa": post.get("gpa"), | ||
"activities": post.get("activities"), | ||
"note": post.get("note"), | ||
} | ||
if post.get("partner_address"): | ||
partner_address_id = partner_obj.sudo().search( | ||
[("id", "=", int(post.get("partner_address", "0")))] | ||
) | ||
if not partner_address_id: | ||
error_messages.append("Institution not found.") | ||
academic_vals.update( | ||
{ | ||
"partner_address_id": partner_address_id.id, | ||
} | ||
) | ||
if post.get("education_level"): | ||
education_level_id = education_level_obj.sudo().search( | ||
[("id", "=", int(post.get("education_level", "0")))] | ||
) | ||
if not education_level_id: | ||
error_messages.append("Education level not found.") | ||
academic_vals.update( | ||
{ | ||
"education_level_id": education_level_id.id, | ||
} | ||
) | ||
if post.get("field_of_study"): | ||
field_of_study_id = field_of_study_obj.sudo().search( | ||
[("id", "=", int(post.get("field_of_study", "0")))] | ||
) | ||
if not field_of_study_id: | ||
error_messages.append("Field of Study not found.") | ||
academic_vals.update( | ||
{ | ||
"field_of_study_id": field_of_study_id.id, | ||
} | ||
) | ||
if error_messages: | ||
values["error_message"] = "\n".join(error_messages) | ||
return request.render( | ||
"ssi_partner_experience_portal.portal_my_academic", | ||
values, | ||
headers={"X-Frame-Options": "DENY"}, | ||
) | ||
if not current_academic_id: | ||
academic_obj.create(academic_vals) | ||
else: | ||
current_academic_id.write(academic_vals) | ||
return request.redirect("/my/academics") | ||
|
||
return request.render( | ||
"ssi_partner_experience_portal.portal_my_academic", | ||
values, | ||
headers={"X-Frame-Options": "DENY"}, | ||
) | ||
|
||
@route( | ||
["/my/academic/remove/<int:id>"], | ||
type="http", | ||
auth="user", | ||
website=True, | ||
methods=["GET", "POST"], | ||
) | ||
def remove_academic(self, **post): | ||
id = post.get("id") | ||
academic_id = request.env["portal_partner_academic"].search( | ||
[("id", "=", int(id))] | ||
) | ||
academic_id.unlink() | ||
return request.redirect("/my/academics") | ||
|
||
@route(["/my/experiences"], type="http", auth="user", website=True, methods=["GET"]) | ||
def experiences(self): | ||
values = self._prepare_portal_layout_values() | ||
values["get_error"] = portal.get_error | ||
values["experience_ids"] = request.env["portal_partner_experience"].search( | ||
[("partner_id", "=", request.env.user.partner_id.id)] | ||
) | ||
|
||
return request.render( | ||
"ssi_partner_experience_portal.portal_my_experiences", | ||
values, | ||
headers={"X-Frame-Options": "DENY"}, | ||
) | ||
|
||
@route( | ||
["/my/experience", "/my/experience/<int:id>"], | ||
type="http", | ||
auth="user", | ||
website=True, | ||
methods=["GET", "POST"], | ||
) | ||
def experience(self, **post): | ||
id = post.get("id") | ||
partner_obj = request.env["res.partner"].sudo() | ||
experience_obj = request.env["portal_partner_experience"] | ||
values = self._prepare_portal_layout_values() | ||
error_messages = [] | ||
values.update( | ||
{ | ||
"error_message": "", | ||
"partner_address_ids": partner_obj.search([("is_company", "=", True)]), | ||
"current_experience_id": experience_obj, | ||
} | ||
) | ||
current_experience_id = experience_obj | ||
if id: | ||
id = int(id) | ||
current_experience_id = experience_obj.search([("id", "=", id)]) | ||
values.update( | ||
{ | ||
"current_experience_id": current_experience_id, | ||
} | ||
) | ||
|
||
if request.httprequest.method == "POST": | ||
experience_vals = { | ||
"partner_id": request.env.user.partner_id.id, | ||
"job_position": post.get("job_position"), | ||
"job_level": post.get("job_level"), | ||
"location": post.get("location"), | ||
"date_start": post.get("date_start") or False, | ||
"expire": post.get("expire"), | ||
"date_end": post.get("date_end") or False, | ||
"note": post.get("note"), | ||
} | ||
if post.get("partner_address"): | ||
partner_address_id = partner_obj.sudo().search( | ||
[("id", "=", int(post.get("partner_address", "0")))] | ||
) | ||
if not partner_address_id: | ||
error_messages.append("Institution not found.") | ||
experience_vals.update( | ||
{ | ||
"partner_address_id": partner_address_id.id, | ||
} | ||
) | ||
if error_messages: | ||
values["error_message"] = "\n".join(error_messages) | ||
return request.render( | ||
"ssi_partner_experience_portal.portal_my_experience", | ||
values, | ||
headers={"X-Frame-Options": "DENY"}, | ||
) | ||
if not current_experience_id: | ||
experience_obj.create(experience_vals) | ||
else: | ||
current_experience_id.write(experience_vals) | ||
return request.redirect("/my/experiences") | ||
|
||
return request.render( | ||
"ssi_partner_experience_portal.portal_my_experience", | ||
values, | ||
headers={"X-Frame-Options": "DENY"}, | ||
) | ||
|
||
@route( | ||
["/my/experience/remove/<int:id>"], | ||
type="http", | ||
auth="user", | ||
website=True, | ||
methods=["GET", "POST"], | ||
) | ||
def remove_experience(self, **post): | ||
id = post.get("id") | ||
experience_id = request.env["portal_partner_experience"].search( | ||
[("id", "=", int(id))] | ||
) | ||
experience_id.unlink() | ||
return request.redirect("/my/experiences") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import ( | ||
portal_partner_academic, | ||
portal_partner_experience, | ||
) |
13 changes: 13 additions & 0 deletions
13
ssi_partner_experience_portal/models/portal_partner_academic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class PortalPartnerAcademic(models.Model): | ||
_name = "portal_partner_academic" | ||
_inherit = ["partner.academic"] | ||
_description = "Portal Partner Academic" | ||
_table = "partner_academic" | ||
_order = "date_start" |
13 changes: 13 additions & 0 deletions
13
ssi_partner_experience_portal/models/portal_partner_experience.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class PortalPartnerExperience(models.Model): | ||
_name = "portal_partner_experience" | ||
_inherit = ["partner.experience"] | ||
_description = "Portal Partner Experience" | ||
_table = "partner_experience" | ||
_order = "date_start" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_portal_partner_academic_user,portal_partner_academic - user,model_portal_partner_academic,base.group_user,1,1,1,1 | ||
access_portal_partner_experience_user,portal_partner_experience - user,model_portal_partner_experience,base.group_user,1,1,1,1 | ||
access_portal_partner_academic_portal,portal_partner_academic - portal,model_portal_partner_academic,base.group_portal,1,1,1,1 | ||
access_portal_partner_experience_portal,portal_partner_experience - portal,model_portal_partner_experience,base.group_portal,1,1,1,1 |
Oops, something went wrong.