diff --git a/website_sale_slides_portal/README.rst b/website_sale_slides_portal/README.rst new file mode 100644 index 0000000..50ae2a2 --- /dev/null +++ b/website_sale_slides_portal/README.rst @@ -0,0 +1,88 @@ +========================== +Website Sale Slides Portal +========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:8e2129116bdf52aaccd45cfaf84303667132f5defc24cb2c03220b6cf08ba4a7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--learning-lightgray.png?logo=github + :target: https://github.com/OCA/e-learning/tree/17.0/website_sale_slides_portal + :alt: OCA/e-learning +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-learning-17-0/e-learning-17-0-website_sale_slides_portal + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/e-learning&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the Odoo portal to allow customers to view the +courses they have purchased through the website. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +1. Create a Sales Order for a course product (set Quantity > 1, or + create multiple orders for the same course). +2. Confirm the Sales Order(s). +3. Log in as the purchasing customer and go to the portal home. +4. Open **My courses** to see the purchased course(s). + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa + +Contributors +------------ + +- [Tecnativa](https://www.tecnativa.com/): + + - Pilar Vargas + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/e-learning `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_slides_portal/__init__.py b/website_sale_slides_portal/__init__.py new file mode 100644 index 0000000..e046e49 --- /dev/null +++ b/website_sale_slides_portal/__init__.py @@ -0,0 +1 @@ +from . import controllers diff --git a/website_sale_slides_portal/__manifest__.py b/website_sale_slides_portal/__manifest__.py new file mode 100644 index 0000000..d08dccc --- /dev/null +++ b/website_sale_slides_portal/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2025 Tecnativa - Pilar Vargas +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Website Sale Slides Portal", + "summary": "Display of purchased courses and participation in portal", + "version": "17.0.1.0.0", + "category": "Website/eLearning", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/e-learning", + "license": "AGPL-3", + "depends": ["portal", "website_sale_slides_multi_qty"], + "data": [ + "views/portal_templates.xml", + ], +} diff --git a/website_sale_slides_portal/controllers/__init__.py b/website_sale_slides_portal/controllers/__init__.py new file mode 100644 index 0000000..8c3feb6 --- /dev/null +++ b/website_sale_slides_portal/controllers/__init__.py @@ -0,0 +1 @@ +from . import portal diff --git a/website_sale_slides_portal/controllers/portal.py b/website_sale_slides_portal/controllers/portal.py new file mode 100644 index 0000000..86efc44 --- /dev/null +++ b/website_sale_slides_portal/controllers/portal.py @@ -0,0 +1,62 @@ +# Copyright 2026 Tecnativa - Pilar Vargas +# 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 +from odoo.addons.portal.controllers.portal import pager as portal_pager + + +class CoursesCustomerPortal(CustomerPortal): + def _prepare_courses_domain(self): + commercial = request.env.user.partner_id.commercial_partner_id + return [ + ("partner_id.commercial_partner_id", "=", commercial.id), + ("parent_id", "=", False), + ("sale_order_line_ids", "!=", False), + ("available_registrations", ">", 1), + ] + + def _prepare_home_portal_values(self, counters): + values = super()._prepare_home_portal_values(counters) + if "courses_count" in counters: + domain = self._prepare_courses_domain() + values["courses_count"] = ( + request.env["slide.channel.partner"].sudo().search_count(domain) + ) + return values + + @http.route(["/my/courses"], type="http", auth="user", website=True) + def portal_my_courses( + self, page=1, date_begin=None, date_end=None, sortby=None, **kw + ): + values = self._prepare_portal_layout_values() + SlideChannelPartner = request.env["slide.channel.partner"] + domain = self._prepare_courses_domain() + searchbar_sortings = self._prepare_searchbar_sortings() + if not sortby: + sortby = "date" + order = searchbar_sortings[sortby]["order"] + courses_count = SlideChannelPartner.sudo().search_count(domain) + # pager + pager = portal_pager( + url="/my/courses", + url_args={"date_begin": date_begin, "date_end": date_end, "sortby": sortby}, + total=courses_count, + page=page, + step=self._items_per_page, + ) + courses = SlideChannelPartner.sudo().search( + domain, order=order, limit=self._items_per_page, offset=pager["offset"] + ) + values.update( + { + "courses": courses, + "page_name": "courses", + "default_url": "/my/courses", + "pager": pager, + "searchbar_sortings": searchbar_sortings, + "sortby": sortby, + } + ) + return request.render("website_sale_slides_portal.portal_my_courses", values) diff --git a/website_sale_slides_portal/i18n/es.po b/website_sale_slides_portal/i18n/es.po new file mode 100644 index 0000000..a57330b --- /dev/null +++ b/website_sale_slides_portal/i18n/es.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_slides_portal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-01-30 12:37+0000\n" +"PO-Revision-Date: 2026-01-30 13:38+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.2\n" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Course #" +msgstr "Curso #" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Courses" +msgstr "Cursos" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_home_instances +msgid "Information about courses and participations." +msgstr "Información acerca de cursos y participaciones." + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Invitation Link" +msgstr "Link de invitación" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Remaining" +msgstr "Disponibles" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_home_instances +msgid "Slides" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "There are no courses." +msgstr "No hay cursos." + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Total" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Used" +msgstr "Usadas" diff --git a/website_sale_slides_portal/i18n/website_sale_slides_portal.pot b/website_sale_slides_portal/i18n/website_sale_slides_portal.pot new file mode 100644 index 0000000..b19e554 --- /dev/null +++ b/website_sale_slides_portal/i18n/website_sale_slides_portal.pot @@ -0,0 +1,61 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_slides_portal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-01-30 12:37+0000\n" +"PO-Revision-Date: 2026-01-30 12:37+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Course #" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Courses" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_home_instances +msgid "Information about courses and participations." +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Invitation Link" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Remaining" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_home_instances +msgid "Slides" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "There are no courses." +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Total" +msgstr "" + +#. module: website_sale_slides_portal +#: model_terms:ir.ui.view,arch_db:website_sale_slides_portal.portal_my_courses +msgid "Used" +msgstr "" diff --git a/website_sale_slides_portal/pyproject.toml b/website_sale_slides_portal/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/website_sale_slides_portal/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_sale_slides_portal/readme/CONTRIBUTORS.md b/website_sale_slides_portal/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..2c4c4a0 --- /dev/null +++ b/website_sale_slides_portal/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- \[Tecnativa\](): + - Pilar Vargas diff --git a/website_sale_slides_portal/readme/DESCRIPTION.md b/website_sale_slides_portal/readme/DESCRIPTION.md new file mode 100644 index 0000000..e4f7b1f --- /dev/null +++ b/website_sale_slides_portal/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module extends the Odoo portal to allow customers to view the courses they have purchased through the website. diff --git a/website_sale_slides_portal/readme/USAGE.md b/website_sale_slides_portal/readme/USAGE.md new file mode 100644 index 0000000..080da61 --- /dev/null +++ b/website_sale_slides_portal/readme/USAGE.md @@ -0,0 +1,4 @@ +1. Create a Sales Order for a course product (set Quantity > 1, or create multiple orders for the same course). +2. Confirm the Sales Order(s). +3. Log in as the purchasing customer and go to the portal home. +4. Open **My courses** to see the purchased course(s). diff --git a/website_sale_slides_portal/static/description/icon.png b/website_sale_slides_portal/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/website_sale_slides_portal/static/description/icon.png differ diff --git a/website_sale_slides_portal/static/description/index.html b/website_sale_slides_portal/static/description/index.html new file mode 100644 index 0000000..a36fae1 --- /dev/null +++ b/website_sale_slides_portal/static/description/index.html @@ -0,0 +1,438 @@ + + + + + +Website Sale Slides Portal + + + +
+

Website Sale Slides Portal

+ + +

Beta License: AGPL-3 OCA/e-learning Translate me on Weblate Try me on Runboat

+

This module extends the Odoo portal to allow customers to view the +courses they have purchased through the website.

+

Table of contents

+ +
+

Usage

+
    +
  1. Create a Sales Order for a course product (set Quantity > 1, or +create multiple orders for the same course).
  2. +
  3. Confirm the Sales Order(s).
  4. +
  5. Log in as the purchasing customer and go to the portal home.
  6. +
  7. Open My courses to see the purchased course(s).
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/e-learning project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/website_sale_slides_portal/static/src/img/courses.png b/website_sale_slides_portal/static/src/img/courses.png new file mode 100644 index 0000000..e7d045c Binary files /dev/null and b/website_sale_slides_portal/static/src/img/courses.png differ diff --git a/website_sale_slides_portal/static/src/img/courses.svg b/website_sale_slides_portal/static/src/img/courses.svg new file mode 100644 index 0000000..1e49543 --- /dev/null +++ b/website_sale_slides_portal/static/src/img/courses.svg @@ -0,0 +1,4 @@ + + + + diff --git a/website_sale_slides_portal/views/portal_templates.xml b/website_sale_slides_portal/views/portal_templates.xml new file mode 100644 index 0000000..aaab07b --- /dev/null +++ b/website_sale_slides_portal/views/portal_templates.xml @@ -0,0 +1,70 @@ + + + + + + +