Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions website_oca_integrator/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

======================
Website OCA Integrator
======================
Expand All @@ -17,7 +13,7 @@ Website OCA Integrator
.. |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/license-AGPL--3-blue.png
.. |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%2Foca--custom-lightgray.png?logo=github
Expand Down
8 changes: 0 additions & 8 deletions website_oca_integrator/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
"membership",
"website_membership",
"website_customer",
"github_connector",
"github_connector_odoo",
"apps_product_creator",
],
"data": [
"security/ir.model.access.csv",
Expand All @@ -28,18 +25,13 @@
"views/view_portal_templates.xml",
"views/website_oca_integrator_data.xml",
"views/view_res_partner.xml",
"views/view_odoo_author.xml",
"data/ir_cron.xml",
],
"external_dependencies": {"python": ["responses"]},
"assets": {
"web.assets_frontend": [
"website_oca_integrator/static/src/js/integrator_portal.js",
"website_oca_integrator/static/src/scss/website_oca_integrator.scss",
],
"web.assets_tests": [
"website_oca_integrator/static/src/js/integrator_portal_tour.js",
],
},
"installable": True,
}
49 changes: 1 addition & 48 deletions website_oca_integrator/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ def integrators(self, country=None, page=0, **post):
# search integrators matching current search parameters
integrator_ids = partner_obj.sudo().search(
base_integrator_domain,
order="grade_id ASC, implemented_partner_count DESC,"
"contributor_count DESC, member_count DESC,"
"name ASC",
order="grade_id ASC, member_count DESC, name ASC",
offset=pager["offset"],
limit=self._references_per_page,
)
Expand Down Expand Up @@ -126,42 +124,6 @@ def integrators(self, country=None, page=0, **post):
status=integrators and 200 or 404,
)

def get_integrator_modules_list(self, integrator):
"""
Returns 5 favourite modules selected by integrator. If integrator has
not selected 5 modules, then returns latest 5 developed modules.
"""
module_display_count = 5
favourite_modules = integrator.favourite_module_ids.filtered("is_published")
developed_modules = integrator.developed_module_ids.filtered("is_published")
favourite_module_count = len(favourite_modules)
developed_module_count = len(developed_modules)

remaining_modules = module_display_count - favourite_module_count

# if integrator has developed less than 5 modules then
# remaining modules are just other than favourite modules.
if developed_module_count < module_display_count:
remaining_modules = developed_module_count - favourite_module_count

if remaining_modules:
remaining_product_tmpl_ids = list(
set(developed_modules.ids) - set(favourite_modules.ids)
)
# search latest product variant of module.
sorted_modules = request.env["product.product"].search(
[("product_tmpl_id", "in", remaining_product_tmpl_ids)],
order="create_date desc",
)

sorted_modules = sorted_modules.mapped("product_tmpl_id")[
:remaining_modules
]

favourite_modules += sorted_modules

return favourite_modules, developed_module_count

def get_integrator_references(self, integrator):
# sort integrator references by implemented date.
references = integrator.implemented_partner_ids.sorted(
Expand Down Expand Up @@ -197,26 +159,18 @@ def integrators_detail(self, integrator_id, **post):
if integrator.sudo().exists() and (
integrator.website_published or is_website_publisher
):
modules_list, developed_module_count = self.get_integrator_modules_list(
integrator
)

references = self.get_integrator_references(integrator)

sponsorship_lines = integrator.sponsorship_line_ids.sorted(
key=lambda r: r.date_end, reverse=True
)[:5]

display_all_modules = True if developed_module_count > 5 else False

values = {
"main_object": integrator,
"integrator": integrator,
"current_country": current_country,
"references": references,
"modules_list": modules_list,
"sponsorship_lines": sponsorship_lines,
"display_all_modules": display_all_modules,
}
return request.render("website_oca_integrator.integrators", values)
return self.integrators(**post)
Expand Down Expand Up @@ -259,7 +213,6 @@ def integrator_contributors(
country_domain = [
"|",
("membership_state", "=", "paid"),
("github_name", "!=", False),
("website_published", "=", True),
("parent_id", "=", integrator_id),
]
Expand Down
50 changes: 0 additions & 50 deletions website_oca_integrator/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,11 @@
# Copyright 2018 Surekha Technologies (https://www.surekhatech.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import http
from odoo.http import request, route

from odoo.addons.portal.controllers.portal import CustomerPortal


class IntegratorPortal(CustomerPortal):
@route()
def account(self, redirect=None, **post):
if post:
modules = request.httprequest.form.getlist("favourite_module_ids")
if not modules:
modules = post.get("favourite_module_ids")
if modules:
modules = modules.split(",")
if modules:
post["favourite_module_ids"] = [int(id) for id in modules]
else:
post["favourite_module_ids"] = False
return super().account(redirect=redirect, **post)

@http.route(
"/my/account/get_developed_modules",
type="http",
auth="user",
methods=["GET"],
website=True,
sitemap=False,
)
def integrator_developed_module_read(self, query="", limit=25, **post):
integrator = request.env.user.partner_id
modules_data = request.env["product.template"].search_read(
[
("id", "in", integrator.developed_module_ids.ids),
("name", "=ilike", "%" + (query or "") + "%"),
],
fields=["id", "name"],
limit=int(limit),
)
return request.make_json_response(modules_data)

@http.route(
"/my/account/get_favourite_modules",
type="http",
auth="user",
methods=["GET"],
website=True,
sitemap=False,
)
def integrator_favourite_module_read(self):
integrator = request.env.user.partner_id
modules = integrator.favourite_module_ids
modules_data = [{"id": m.id, "name": m.name} for m in modules]
return request.make_json_response(modules_data)

def details_form_validate(self, data):
# after adding HTML editor in portal page, if we click on
# 'Confirm' button then, 'files' key is passed in post data.
Expand Down
17 changes: 0 additions & 17 deletions website_oca_integrator/data/ir_cron.xml

This file was deleted.

2 changes: 1 addition & 1 deletion website_oca_integrator/i18n/website_oca_integrator.pot
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,4 @@ msgstr ""
#. module: website_oca_integrator
#: model_terms:ir.ui.view,arch_db:website_oca_integrator.integrators
msgid "to view Contributors/Members"
msgstr ""
msgstr ""
2 changes: 0 additions & 2 deletions website_oca_integrator/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
from . import contributor_module_line
from . import odoo_author
from . import res_partner
from . import sponsorship
19 changes: 0 additions & 19 deletions website_oca_integrator/models/contributor_module_line.py

This file was deleted.

15 changes: 0 additions & 15 deletions website_oca_integrator/models/odoo_author.py

This file was deleted.

Loading
Loading