Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] allow install several themes at once #266

Merged
merged 4 commits into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions website_multi_company/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/odoo/odoo/commit/c29cac23fbee395b3f3430346d6781e9dbe0a35c>`__ for Theme category, i.e. allows to install several themes at once

Roadmap
=======

Expand Down
4 changes: 3 additions & 1 deletion website_multi_company/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": [
],
Expand Down
8 changes: 8 additions & 0 deletions website_multi_company/data/ir_module_category.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record model="ir.module.category" id="base.module_category_theme">
<field name="exclusive" eval="False"/>
</record>

</odoo>
6 changes: 6 additions & 0 deletions website_multi_company/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
`1.2.0`
-------

- **FIX:** allow install several themes at once
- **ADD:** support of custom themes

`1.1.0`
-------

Expand Down
14 changes: 11 additions & 3 deletions website_multi_company/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,30 @@ Configuration

* `Enable technical features <https://odoo-development.readthedocs.io/en/latest/odoo/usage/technical-features.html>`__
* 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 actions are required as described `below <#multi-theme>`__

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
=====

Expand Down
1 change: 1 addition & 0 deletions website_multi_company/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import website_menu
from . import website
from . import website_theme
10 changes: 10 additions & 0 deletions website_multi_company/models/website_theme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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="")
44 changes: 44 additions & 0 deletions website_multi_company/views/website_theme_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="view_website_theme_form" model="ir.ui.view">
<field name="name">website.theme.form</field>
<field name="model">website.theme</field>
<field name="arch" type="xml">
<form string="Multi-theme">
<sheet>
<group>
<field name="name"/>
<field name="converted_theme_addon" required="1"/>
</group>
</sheet>
</form>
</field>
</record>

<record id="view_website_theme_tree" model="ir.ui.view">
<field name="name">website.theme.tree</field>
<field name="model">website.theme</field>
<field name="arch" type="xml">
<tree string="Multi-theme">
<field name="name"/>
<field name="converted_theme_addon"/>
</tree>
</field>
</record>


<record id="website_theme_action" model="ir.actions.act_window">
<field name="name">Multi-Themes</field>
<field name="res_model">website.theme</field>
<field name="view_mode">list,form</field>
</record>

<menuitem
id="website_theme_menu"
parent="website.menu_website_global_configuration"
name="Multi-Themes"
sequence="200"
action="website_theme_action"/>

</odoo>