Skip to content

Commit 3ac4eb1

Browse files
committed
[18.0] [MIG] website_oca_integrator
1 parent f34b905 commit 3ac4eb1

22 files changed

Lines changed: 141 additions & 308 deletions

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# generated from manifests external_dependencies
2+
responses

website_oca_integrator/README.rst

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
======================
62
Website OCA Integrator
73
======================
@@ -17,17 +13,17 @@ Website OCA Integrator
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foca--custom-lightgray.png?logo=github
24-
:target: https://github.com/OCA/oca-custom/tree/14.0/website_oca_integrator
20+
:target: https://github.com/OCA/oca-custom/tree/18.0/website_oca_integrator
2521
:alt: OCA/oca-custom
2622
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/oca-custom-14-0/oca-custom-14-0-website_oca_integrator
23+
:target: https://translation.odoo-community.org/projects/oca-custom-18-0/oca-custom-18-0-website_oca_integrator
2824
:alt: Translate me on Weblate
2925
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/oca-custom&target_branch=14.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/oca-custom&target_branch=18.0
3127
:alt: Try me on Runboat
3228

3329
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -46,29 +42,29 @@ Bug Tracker
4642
Bugs are tracked on `GitHub Issues <https://github.com/OCA/oca-custom/issues>`_.
4743
In case of trouble, please check there if your issue has already been reported.
4844
If you spotted it first, help us to smash it by providing a detailed and welcomed
49-
`feedback <https://github.com/OCA/oca-custom/issues/new?body=module:%20website_oca_integrator%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
45+
`feedback <https://github.com/OCA/oca-custom/issues/new?body=module:%20website_oca_integrator%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
5046

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

5349
Credits
5450
=======
5551

5652
Authors
57-
~~~~~~~
53+
-------
5854

5955
* Surekha Technologies
6056

6157
Contributors
62-
~~~~~~~~~~~~
58+
------------
6359

64-
* `Tecnativa <https://www.tecnativa.com>`_:
60+
- `Tecnativa <https://www.tecnativa.com>`__:
6561

66-
* Víctor M.M. Torres
67-
* Carlos Roca
68-
* Ernesto Tejeda
62+
- Víctor M.M. Torres
63+
- Carlos Roca
64+
- Ernesto Tejeda
6965

7066
Maintainers
71-
~~~~~~~~~~~
67+
-----------
7268

7369
This module is maintained by the OCA.
7470

@@ -80,6 +76,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8076
mission is to support the collaborative development of Odoo features and
8177
promote its widespread use.
8278

83-
This module is part of the `OCA/oca-custom <https://github.com/OCA/oca-custom/tree/14.0/website_oca_integrator>`_ project on GitHub.
79+
This module is part of the `OCA/oca-custom <https://github.com/OCA/oca-custom/tree/18.0/website_oca_integrator>`_ project on GitHub.
8480

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

website_oca_integrator/__manifest__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Website OCA Integrator",
55
"summary": "Displays Integrators in website.",
6-
"version": "14.0.1.0.1",
6+
"version": "18.0.1.0.1",
77
"category": "Website",
88
"license": "AGPL-3",
99
"website": "https://github.com/OCA/oca-custom",
@@ -13,15 +13,14 @@
1313
"website",
1414
"website_crm_partner_assign",
1515
"website_sale",
16-
"website_apps_store",
16+
# "website_apps_store",
1717
"membership",
1818
"website_membership",
1919
"website_customer",
20-
"apps_product_creator",
20+
# "apps_product_creator",
2121
],
2222
"data": [
2323
"security/ir.model.access.csv",
24-
"views/assets.xml",
2524
"views/website_oca_integrator_templates.xml",
2625
"views/website_oca_integrator_product_templates.xml",
2726
"views/website_oca_integrator_contributor_templates.xml",
@@ -32,5 +31,13 @@
3231
"data/ir_cron.xml",
3332
],
3433
"external_dependencies": {"python": ["responses"]},
34+
"assets": {
35+
"web.assets_frontend": [
36+
"website_oca_integrator/static/src/js/integrator_portal.js",
37+
],
38+
"website.assets_tests": [
39+
"website_oca_integrator/static/src/js/integrator_portal_tour.js",
40+
],
41+
},
3542
"installable": True,
3643
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from . import main
22
from . import member
33
from . import portal
4-
from . import website_sale

website_oca_integrator/controllers/main.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
# Part of Odoo. See Odoo LICENSE file for full copyright and licensing details.
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
import werkzeug
5+
from werkzeug.urls import url_encode
66

77
from odoo import http
88
from odoo.http import request
99
from odoo.tools.translate import _
1010

11-
from odoo.addons.http_routing.models.ir_http import slug, unslug
12-
1311

1412
class WebsiteIntegrator(http.Controller):
1513
_references_per_page = 40
@@ -75,7 +73,7 @@ def integrators(self, country=None, page=0, **post):
7573

7674
if country:
7775
base_integrator_domain += [("country_id", "=", country.id)]
78-
url = "/integrators/country/" + slug(country)
76+
url = "/integrators/country/" + request.env["ir.http"]._slug(country)
7977
else:
8078
url = "/integrators"
8179

@@ -98,9 +96,9 @@ def integrators(self, country=None, page=0, **post):
9896
# search integrators matching current search parameters
9997
integrator_ids = partner_obj.sudo().search(
10098
base_integrator_domain,
101-
order="grade_id ASC, implemented_count DESC,"
99+
order="grade_id ASC, implemented_partner_count DESC,"
102100
"contributor_count DESC, member_count DESC,"
103-
"display_name ASC",
101+
"name ASC",
104102
offset=pager["offset"],
105103
limit=self._references_per_page,
106104
)
@@ -118,7 +116,7 @@ def integrators(self, country=None, page=0, **post):
118116
"google_map_integrator_ids": google_map_integrator_ids,
119117
"pager": pager,
120118
"searches": post,
121-
"search_path": "%s" % werkzeug.url_encode(post),
119+
"search_path": "?%s" % url_encode(post),
122120
"google_maps_api_key": google_maps_api_key,
123121
}
124122

@@ -181,7 +179,7 @@ def integrators_detail(self, integrator_id, **post):
181179
"""
182180
Display integrator's detail.
183181
"""
184-
_, integrator_id = unslug(integrator_id)
182+
_, integrator_id = request.env["ir.http"]._unslug(integrator_id)
185183
current_country = None
186184
country_id = post.get("country_id")
187185

@@ -192,7 +190,7 @@ def integrators_detail(self, integrator_id, **post):
192190
if integrator_id:
193191
integrator = request.env["res.partner"].sudo().browse(integrator_id)
194192

195-
is_website_publisher = request.env["res.users"].has_group(
193+
is_website_publisher = request.env.user.has_group(
196194
"website.group_website_publisher"
197195
)
198196

@@ -243,7 +241,7 @@ def integrator_contributors(
243241
self, integrator_id=None, country_name=None, country_id=0, page=1, **post
244242
):
245243
integrator = integrator_id
246-
integrator_name, integrator_id = unslug(integrator_id)
244+
integrator_name, integrator_id = request.env["ir.http"]._unslug(integrator_id)
247245
country = request.env["res.country"]
248246
partner = request.env["res.partner"]
249247

@@ -318,7 +316,7 @@ def integrator_contributors(
318316

319317
contributors = partner.sudo().search(
320318
country_domain,
321-
order="display_name ASC",
319+
order="name ASC",
322320
offset=pager["offset"],
323321
limit=self._references_per_page,
324322
)
@@ -333,7 +331,7 @@ def integrator_contributors(
333331
"current_country_id": current_country and current_country["id"] or 0,
334332
"pager": pager,
335333
"post": post,
336-
"search": "?%s" % werkzeug.url_encode(post),
334+
"search": "?%s" % url_encode(post),
337335
}
338336

339337
return request.render("website_oca_integrator.contributor_index", values)

website_oca_integrator/controllers/portal.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
# Copyright 2018 Surekha Technologies (https://www.surekhatech.com)
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
import json
5-
64
from odoo import http
75
from odoo.http import request, route
86

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

119

1210
class IntegratorPortal(CustomerPortal):
13-
OPTIONAL_BILLING_FIELDS = CustomerPortal.OPTIONAL_BILLING_FIELDS + [
14-
"github_organization",
15-
"favourite_module_ids",
16-
"website_short_description",
17-
"website_description",
18-
]
19-
2011
@route()
2112
def account(self, redirect=None, **post):
2213
if post:
23-
modules = post.get("favourite_module_ids")
14+
modules = request.httprequest.form.getlist("favourite_module_ids")
15+
if not modules:
16+
modules = post.get("favourite_module_ids")
17+
if modules:
18+
modules = modules.split(",")
2419
if modules:
25-
post["favourite_module_ids"] = [int(id) for id in modules.split(",")]
20+
post["favourite_module_ids"] = [int(id) for id in modules]
2621
else:
2722
post["favourite_module_ids"] = False
2823
return super().account(redirect=redirect, **post)
@@ -45,7 +40,7 @@ def integrator_developed_module_read(self, query="", limit=25, **post):
4540
fields=["id", "name"],
4641
limit=int(limit),
4742
)
48-
return json.dumps(modules_data)
43+
return request.make_json_response(modules_data)
4944

5045
@http.route(
5146
"/my/account/get_favourite_modules",
@@ -59,7 +54,7 @@ def integrator_favourite_module_read(self):
5954
integrator = request.env.user.partner_id
6055
modules = integrator.favourite_module_ids
6156
modules_data = [{"id": m.id, "name": m.name} for m in modules]
62-
return json.dumps(modules_data)
57+
return request.make_json_response(modules_data)
6358

6459
def details_form_validate(self, data):
6560
# after adding HTML editor in portal page, if we click on

website_oca_integrator/controllers/website_sale.py

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)