From da8d418ff08aa55c7378887c9a5a06a5d12b72c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 18 Jul 2017 09:49:47 +0200 Subject: [PATCH] [ADD] portal: add module for customer portal and sharing features This module adds required base code for a fully integrated customer portal. It contains the base controller class and base templates. Business addons will add their specific templates and controllers to extend the customer portal. This module contains most code coming from odoo v10 website_portal. Purpose of this module is to allow the display of a customer portal without having a dependency towards website edition and customization capabilities. Some CSS files used in frontend assets are already moved to have a working portal skeleton. A is_public method on users is also added as it will be used in various portal code soon. --- addons/portal/__init__.py | 4 ++ addons/portal/__manifest__.py | 23 ++++++ addons/portal/controllers/__init__.py | 4 ++ addons/portal/controllers/portal.py | 17 +++++ .../static/src/less/bootstrap.extend.less | 0 .../static/src/less/website.ui.less | 0 .../static/src/less/website.wrapwrap.less | 0 addons/portal/views/assets.xml | 10 +++ addons/portal/views/portal_templates.xml | 72 +++++++++++++++++++ addons/web/views/report_templates.xml | 4 +- addons/website/__manifest__.py | 2 +- addons/website/models/__init__.py | 2 +- addons/website/views/website_templates.xml | 3 - odoo/addons/base/res/res_users.py | 5 ++ 14 files changed, 139 insertions(+), 7 deletions(-) create mode 100644 addons/portal/__init__.py create mode 100644 addons/portal/__manifest__.py create mode 100644 addons/portal/controllers/__init__.py create mode 100644 addons/portal/controllers/portal.py rename addons/{website => portal}/static/src/less/bootstrap.extend.less (100%) rename addons/{website => portal}/static/src/less/website.ui.less (100%) rename addons/{website => portal}/static/src/less/website.wrapwrap.less (100%) create mode 100644 addons/portal/views/assets.xml create mode 100644 addons/portal/views/portal_templates.xml diff --git a/addons/portal/__init__.py b/addons/portal/__init__.py new file mode 100644 index 00000000000..dd15b5c32e5 --- /dev/null +++ b/addons/portal/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import controllers diff --git a/addons/portal/__manifest__.py b/addons/portal/__manifest__.py new file mode 100644 index 00000000000..61e0818a929 --- /dev/null +++ b/addons/portal/__manifest__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +{ + 'name': 'Customer Portal', + 'summary': 'Customer Portal', + 'sequence': '9000', + 'category': 'Hidden', + 'description': """ +This module adds required base code for a fully integrated customer portal. +It contains the base controller class and base templates. Business addons +will add their specific templates and controllers to extend the customer +portal. + +This module contains most code coming from odoo v10 website_portal. Purpose +of this module is to allow the display of a customer portal without having +a dependency towards website edition and customization capabilities.""", + 'data': [ + 'views/assets.xml', + 'views/portal_templates.xml', + ], + 'depends': ['http_routing', 'mail'], +} diff --git a/addons/portal/controllers/__init__.py b/addons/portal/controllers/__init__.py new file mode 100644 index 00000000000..903b755e71e --- /dev/null +++ b/addons/portal/controllers/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import portal diff --git a/addons/portal/controllers/portal.py b/addons/portal/controllers/portal.py new file mode 100644 index 00000000000..1e7d97f7eb8 --- /dev/null +++ b/addons/portal/controllers/portal.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.http import Controller, request, route + + +class CustomerPortal(Controller): + + def _prepare_portal_layout_values(self): + return { + 'page_name': 'home', + } + + @route(['/my', '/my/home'], type='http', auth="user", website=True) + def home(self, **kw): + values = self._prepare_portal_layout_values() + return request.render("portal.portal_layout", values) diff --git a/addons/website/static/src/less/bootstrap.extend.less b/addons/portal/static/src/less/bootstrap.extend.less similarity index 100% rename from addons/website/static/src/less/bootstrap.extend.less rename to addons/portal/static/src/less/bootstrap.extend.less diff --git a/addons/website/static/src/less/website.ui.less b/addons/portal/static/src/less/website.ui.less similarity index 100% rename from addons/website/static/src/less/website.ui.less rename to addons/portal/static/src/less/website.ui.less diff --git a/addons/website/static/src/less/website.wrapwrap.less b/addons/portal/static/src/less/website.wrapwrap.less similarity index 100% rename from addons/website/static/src/less/website.wrapwrap.less rename to addons/portal/static/src/less/website.wrapwrap.less diff --git a/addons/portal/views/assets.xml b/addons/portal/views/assets.xml new file mode 100644 index 00000000000..c90c7f3aacc --- /dev/null +++ b/addons/portal/views/assets.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/addons/portal/views/portal_templates.xml b/addons/portal/views/portal_templates.xml new file mode 100644 index 00000000000..715cb3edc57 --- /dev/null +++ b/addons/portal/views/portal_templates.xml @@ -0,0 +1,72 @@ + + + + + + + + diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml index 6f723ca4750..bb5a11bc684 100644 --- a/addons/web/views/report_templates.xml +++ b/addons/web/views/report_templates.xml @@ -10,8 +10,8 @@ - - + + diff --git a/addons/website/__manifest__.py b/addons/website/__manifest__.py index eca433417d6..8ab5925f81e 100644 --- a/addons/website/__manifest__.py +++ b/addons/website/__manifest__.py @@ -9,7 +9,7 @@ 'website': 'https://www.odoo.com/page/website-builder', 'version': '1.0', 'description': "", - 'depends': ['web', 'web_editor', 'web_planner'], + 'depends': ['web', 'web_editor', 'web_planner', 'http_routing', 'portal'], 'installable': True, 'data': [ 'data/website_data.xml', diff --git a/addons/website/models/__init__.py b/addons/website/models/__init__.py index aa289415d5d..99fd60cddd5 100644 --- a/addons/website/models/__init__.py +++ b/addons/website/models/__init__.py @@ -5,9 +5,9 @@ from . import ir_actions from . import ir_attachment from . import ir_http from . import ir_qweb +from . import website from . import ir_ui_view from . import res_company from . import res_partner from . import web_planner -from . import website from . import website_config_settings diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 4bf165d3abe..83c5932d928 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -18,12 +18,9 @@