From f8268c66e46fecb5ebc61cbf8f31b2a1b84a361e Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Tue, 9 Jan 2018 21:24:53 +0000 Subject: [PATCH 1/3] [FIX] allow install several themes at once [ADD] views to create website.theme on flight DEV NOTE: this commit cannot be backported to 10.0, because it doesn't have exclusive fields at module category and constraint is hardcoded for Themes --- website_multi_company/README.rst | 6 +++ website_multi_company/__manifest__.py | 4 +- .../data/ir_module_category.xml | 8 ++++ website_multi_company/doc/changelog.rst | 6 +++ website_multi_company/doc/index.rst | 14 ++++-- website_multi_company/models/__init__.py | 1 + website_multi_company/models/website_theme.py | 8 ++++ .../views/website_theme_views.xml | 44 +++++++++++++++++++ 8 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 website_multi_company/data/ir_module_category.xml create mode 100644 website_multi_company/models/website_theme.py create mode 100644 website_multi_company/views/website_theme_views.xml diff --git a/website_multi_company/README.rst b/website_multi_company/README.rst index cdd8a8be6..967bb815b 100644 --- a/website_multi_company/README.rst +++ b/website_multi_company/README.rst @@ -30,6 +30,12 @@ Updates for eCommerce: * ``/shop/*`` pages show only products for current company +Multi-Theme +----------- + +* New menu to allow switch theme to multi-theme on-flight (i.e. without adding code to the theme). +* Removes `exclusiveness `__ for Theme category, i.e. allows to install several themes at once + Roadmap ======= diff --git a/website_multi_company/__manifest__.py b/website_multi_company/__manifest__.py index 15a990f32..797304290 100644 --- a/website_multi_company/__manifest__.py +++ b/website_multi_company/__manifest__.py @@ -5,7 +5,7 @@ "category": "eCommerce", "live_test_url": "http://apps.it-projects.info/shop/product/website-multi-company?version=11.0", "images": ['images/website_multi_company_main.png'], - "version": "1.1.0", + "version": "1.2.0", "application": False, "author": "IT-Projects LLC, Ivan Yelizariev, Nicolas JEUDY", @@ -25,7 +25,9 @@ "views/website_views.xml", "views/website_menu_views.xml", "views/website_page_views.xml", + "views/website_theme_views.xml", "views/res_config_views.xml", + "data/ir_module_category.xml", ], "qweb": [ ], diff --git a/website_multi_company/data/ir_module_category.xml b/website_multi_company/data/ir_module_category.xml new file mode 100644 index 000000000..1ad2fc4fe --- /dev/null +++ b/website_multi_company/data/ir_module_category.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/website_multi_company/doc/changelog.rst b/website_multi_company/doc/changelog.rst index d7cb54b5f..e4881307f 100644 --- a/website_multi_company/doc/changelog.rst +++ b/website_multi_company/doc/changelog.rst @@ -1,3 +1,9 @@ +`1.2.0` +------- + +- **FIX:** allow install several themes at once +- **ADD:** support of custom themes + `1.1.0` ------- diff --git a/website_multi_company/doc/index.rst b/website_multi_company/doc/index.rst index 0d6db35ff..84601089b 100644 --- a/website_multi_company/doc/index.rst +++ b/website_multi_company/doc/index.rst @@ -170,22 +170,30 @@ Configuration * `Enable technical features `__ * At ``[[ Settings ]] >> Users >> Users`` menu and activate **Multi Companies** and set **Allowed Companies** -* Open menu ``[[ Website Admin ]] >> Configuration >> Websites`` +* Open menu ``[[ Website ]] >> Configuration >> Websites`` * Create or select a website record * Update fields: * **Website Domain** -- website address, e.g. *shop1.example.com* * **Company** -- which company is used for this *website* * **Favicon** -- upload website favicon - * **Multi Theme** -- select a theme you wish to apply for website, e.g. *theme_bootswatch* (if you install any of supported themes after installing this module, you should click on **Reload** button to be able to use them) + * **Multi Theme** -- select a theme you wish to apply for website, e.g. *theme_bootswatch* + + * if you install any of supported themes after installing this module, you should click on **Reload** button to be able to use them + * for unsupported themes extra actionsf are required as described below Website Menus ------------- -You can edit, duplicate or create new menu at ``[[ Website Admin ]] >> Configuration >> Menus`` -- pay attention to fields **Website**, **Parent Menu**. In most cases, **Parent Menu** is a *Top Menu* (i.e. menu record without **Parent Menu** value). If a *website* doesn't have *Top Menu* you need to create one. +You can edit, duplicate or create new menu at ``[[ Website ]] >> Configuration >> Menus`` -- pay attention to fields **Website**, **Parent Menu**. In most cases, **Parent Menu** is a *Top Menu* (i.e. menu record without **Parent Menu** value). If a *website* doesn't have *Top Menu* you need to create one. Note. Odoo doesn't share Website Menus (E.g. Homepage, Shop, Contact us, etc.) between websites. So, you need to have copies of them. +Multi-theme +----------- + +After installing theme, navigate to ``[[ Website ]] >> Configuration >> Multi-Themes``. Check that the theme is presented in the list, otherwise add one. + Usage ===== diff --git a/website_multi_company/models/__init__.py b/website_multi_company/models/__init__.py index aca5864e0..0ac7ded89 100644 --- a/website_multi_company/models/__init__.py +++ b/website_multi_company/models/__init__.py @@ -1,2 +1,3 @@ from . import website_menu from . import website +from . import website_theme diff --git a/website_multi_company/models/website_theme.py b/website_multi_company/models/website_theme.py new file mode 100644 index 000000000..0d6c5e3a1 --- /dev/null +++ b/website_multi_company/models/website_theme.py @@ -0,0 +1,8 @@ +from odoo import models, fields + + +class WebsiteTheme(models.Model): + _inherit = 'website.theme' + + name = fields.Char(string="Theme") + converted_theme_addon = fields.Char(string="Theme's technical name", help="", required=True) diff --git a/website_multi_company/views/website_theme_views.xml b/website_multi_company/views/website_theme_views.xml new file mode 100644 index 000000000..410b60221 --- /dev/null +++ b/website_multi_company/views/website_theme_views.xml @@ -0,0 +1,44 @@ + + + + + website.theme.form + website.theme + +
+ + + + + + +
+
+
+ + + website.theme.tree + website.theme + + + + + + + + + + + Multi-Themes + website.theme + list,form + + + + +
From 433c8f8cf335887f0064876f94e50d858d23271b Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Wed, 10 Jan 2018 13:53:11 +0500 Subject: [PATCH 2/3] [DOC] fix typo, add link --- website_multi_company/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_multi_company/doc/index.rst b/website_multi_company/doc/index.rst index 84601089b..089351463 100644 --- a/website_multi_company/doc/index.rst +++ b/website_multi_company/doc/index.rst @@ -180,7 +180,7 @@ Configuration * **Multi Theme** -- select a theme you wish to apply for website, e.g. *theme_bootswatch* * if you install any of supported themes after installing this module, you should click on **Reload** button to be able to use them - * for unsupported themes extra actionsf are required as described below + * for unsupported themes extra actions are required as described `below <#multi-theme>`__ Website Menus ------------- From 9282f7a7c7ecc03f482759fee16e85cb36b7f841 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Wed, 10 Jan 2018 16:47:59 +0000 Subject: [PATCH 3/3] [FIX] converted_theme_addon cannot be set required via psql because record "Multiwebsite Demo Theme" doesn't have that value. So, do it via xml instead --- website_multi_company/models/website_theme.py | 4 +++- website_multi_company/views/website_theme_views.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/website_multi_company/models/website_theme.py b/website_multi_company/models/website_theme.py index 0d6c5e3a1..a8b5c2e03 100644 --- a/website_multi_company/models/website_theme.py +++ b/website_multi_company/models/website_theme.py @@ -5,4 +5,6 @@ class WebsiteTheme(models.Model): _inherit = 'website.theme' name = fields.Char(string="Theme") - converted_theme_addon = fields.Char(string="Theme's technical name", help="", required=True) + converted_theme_addon = fields.Char( + string="Theme's technical name", + help="") diff --git a/website_multi_company/views/website_theme_views.xml b/website_multi_company/views/website_theme_views.xml index 410b60221..1d178e1ca 100644 --- a/website_multi_company/views/website_theme_views.xml +++ b/website_multi_company/views/website_theme_views.xml @@ -9,7 +9,7 @@ - +