Search 1.9 billion lines of Odoo code on GitHub

website_multi_theme

Author: Tecnativa, IT-Projects LLC, Onestein, Odoo Community Association (OCA)
License: LGPL-3
Branch: 11.0
Repository: 001101/website
Dependencies: base, and website
Languages: JavaScript (134, 0.7%), LESS (3, 0.0%), PO File (17499, 92.8%), Python (625, 3.3%), XML (461, 2.4%), and reStructuredText (141, 0.7%)
Other branches: 10.0
Other repositories: 020cui/website, ADVALAKI/website-1, AITIC/website, AdvaitT17/website-1, Alex-Woo/website, Anon234/website, App-247/website, BenjaHe/website, BitStab/website, BoxInABox/website, CB-Gran-Canaria/website, Callino/website, Change2improve/website, ClearCorp/oca-website, Colorlessgold/website, CompassionCH/website, Daemo00/website, DavidNitro/website, Djaitai/website, Dobtor-OCA/website, ELMARDI0107/website, Fitranugraha/website, ForgeFlow/website, Frank278/website, FreshSoftGit/website, GabbasovDinar/website-1, Gabinete-Digital/website, Georgepanpan/website, Gofekra/website, GrupoAlvamex/website, HammerSport-Marketing/website, ImgBotApp/website-5, Ingeos/website, Jaquedeveloper/website, Jarsa/website, JayVora-SerpentCS/website, JazziMc/website, Jeisonpernia/website, Jokevil/website, JonathanOsAlc/website, Kazebayashi/website, KolushovAlexandr/website, LaMachinerieDigitale/odoo_website_oca, LasLabs/website, LevelPrime/website, Logicasoft/FORK_website_OCA, MathBenTech/website, MediaJockey/website, NL66278/website, NextERP-Romania/website, Nikul-Chaudhary/website, Nitrokey/odoo-website, Numigi/odoo-website, OCA-MUK/website, OCA/website, ORETEK/website, OpenPymeMx/website, OpusVL/website, OsoTranquilo/website, PCatinean/website, Palpid/website, PismennyiIgor/website, QANSEE/website, Rad0van/website, RealSolutionsLux/website, RedNeboa/website, Ricardlol/website, SalahAdDin/website, SanteLibre/website, Saran440/website, SequarSrl/website, SicurSam/website, Spearhead-Odoo/website, Studio73/website, SuzanaBhandari/website, Syci-Consulting/website, TRESCLOUD/website, Tecnativa/website, Vauxoo/website, VisiionSolucionesTecnologicas/website, Xara77/website, XtremXpert/website, YevhenPechurin/website, abakus-it/website, accnops/website, acsone/website, adr9/website, agenterp/website, agrista/odoo-website, akhdaniel/website, amendoncabh/website, anandkansagra/website, anhchuyen/website, anhvu-sg/website, ansinaesmejor/website, antcto/website, antilhue/website, antonio-trey/website, apetbiz/website, aurestic/website, benwillig/website, bishalgit/website, bizople/website, bjornbillen/website, brain-tec/website, bvkl/website, c-meier/website, camptocamp/website, chakhi/website, colmeirin/website, coopiteasy/website, corsisa/website, cristinamartinrod/website, crnd-inc/website, danztensai/website, ddufresne/website, devnsys/website, diagramsoftware/website, diegobgl/website, dipendra-karki/website, druidoo-dev/website, eLBati/website, ehabqino/website, emyu01/website, ericbbs/website, ernestotejeda/website, eslAmer/website, eversatis/website, exosoftware/oca-website, fbpatel/website, firefly1994/website, flotho/website, focusate/website-oca, francoisdelarbre/website, gaanto/website, garrettcadams/website, gastonfeng/website, gbaumgartner-callino/website, gbrian/website-1, gfcapalbo/website, grant-thornton/website, haroldtamo/website, hbrunn/website, hinfo506/website, hippe-67/website, iRichGit/website, iledarn/website, invitu/website, isoscl/website, it-projects-llc/website, jacky82669513/website, jansumanpan/website, jason156/website, jcarlosmontoya/website, jcchoquet/website, jhoengels/website, jop-odoo/website, josepmy/website, joyshmitz/website, jromeroarg/website-1, jsrhtc/website, jsviterig/website, jupiterzhuo/website, kaerdsar/website, karan-dreambits/website, keylor2906/website, kmee/website, l0wskilled/website, leangjia/website, lideritjnma/website, lincersolucoes/oca-website, lpetkov-sw/website, manawi/website, mettadipa/website, miguel-trey/website, minhhq09/website, monksoftware/website, mpanarin/website, mrierav/website, nabiforks/website, nadiaafa/website, necrodevz/website, nikul-serpentcs/website, njeudy/website, noorealam96/website, novacode-nl/website, ntsystemwork/oca-website, nuobit/website, odoogap/website, odoosoft/website, old-boy/website-1, onaconsulting/website, one2pret/website, onurugur/website, open2bizz/website, ougc27/website, oxidos/website, parminder-chrishan/website, pedrocasi/website, pedroporras/website, petypi/website, popcomputadores-desenv/website, popsolutions/website, presenceverte/website, pscloud/website, py-web/website, pythoner-3k/website, raihansazal/website, ralnakar/website, ravishekharco/website, raycollazo/website, redblow/website, redcor/website, rohitramnani1994/website, romugb/website, royalline1/website-1, rsullivan2704/website, saas-addons/website, sadeqamin/website, safecoms/website, sailguest/website, sanube/website, satriani-vai/website, savoirfairelinux/website, searro/website, shiram/website, simahawk/website, simplifysolutions/website, smurf-U/website, steingabelgaard/website, syentys/website, takobi-online/website, tarteo/website, tbaden/website, thijshuijbers/website, thinkopensolutions/oca-website, thomas-willdooit/website, tirma-sa/website, torans/website, unitek-solusi/OCA-website, usmcgwg/website, valmarnet/website, vcloud9ray/website, vdedyukhin/website, vdewulf/website, versada/website, vidtsin/website, vrajesh266/website, wahello/website, y2gsmith/website, yaoxingqi/website-1, yassine-teoshore/website, yelizariev/website, youifki/website, yusniermatos/website, yveshoyos/website, and zakoo20122/website

<a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.svg"> </a> <a name="website-multi-theme"></a> <h2>Website Multi Theme</h2> <p>Allow the website admin to set a different theme for each website.</p> <p>The <em>theme</em> might be not just a theme-module, but any set of themes and even particular views from any module (e.g. view <code>website.custom_footer</code> from <code>website</code> module). It also means, that <em>theme</em> is not just a styling, but a content as well.</p> <p>It adds controls to make managing multiple websites easier:</p> <ul class="simple"> <li>Drop-down list to switch to a different website.</li> <li>Change the related website of pages in the page properties dialog with checkboxes.</li> <li>Adds the field <cite>website_ids</cite> to the <cite>website.page</cite> tree.</li> </ul> <a name="how-it-works"></a> <h3>How it works</h3> <p>Core idea is as following</p> <ul class="simple"> <li>Find views created by <em>theme-module</em> and mark them as <em>multi-views</em> (<code>website.theme.asset</code>) additionally to one specified manually via XML (see <a class="reference external" href="demo/themes.xml">demo/themes.xml</a> as an example). The method <a class="reference external" href="models/website_theme.py">_convert_assets</a> is responsible for it.</li> <li>Set <code>active</code> to <code>False</code> for <em>multi-views</em>. See method <a class="reference external" href="models/website_theme.py">_find_and_deactivate_views</a>.</li> <li>Apply <em>Multi-theme</em> (record in new model <code>website.theme</code>) to the specific website. See method <a class="reference external" href="models/website.py">_multi_theme_activate</a><ul> <li>Make some magic with technical views <code>website.assets_frontend</code> and <code>website.layout</code>.<ul> <li>Duplicate <em>patterns</em> from <a class="reference external" href="templates/patterns.xml">templates/patterns.xml</a></li> <li>In <code>layout_pattern</code> replace <code>{theme_view}</code> placeholder to a duplicate of <code>assets_pattern</code></li> <li>Corresponding duplicated <em>pattern</em> will be used as a new value for <code>inherit_id</code> field in duplicated <em>multi-views</em> that originally extend <code>web.assets_frontend</code>, <code>website.assets_frontend</code> or <code>website.layout</code>.</li> </ul> </li> <li>Duplicate <em>multi-views</em> of the <em>multi-theme</em> and its <em>dependencies</em> (other <em>multi-themes</em>). In duplicates, the field <code>inherit_id</code> is changed to other duplicated views or duplicated <em>patterns</em> when possible</li> </ul> </li> </ul> <a name="installation"></a> <h3>Installation</h3> <p>To make this module work, you need to either:</p> <ul class="simple"> <li>Install any of the officially supported themes:<ul> <li>theme_bootswatch</li> </ul> </li> <li>Install any of the unofficially supported themes (at your own risk):<ul> <li>theme_anelusia</li> <li>theme_artists</li> <li>theme_avantgarde</li> <li>theme_beauty</li> <li>theme_bewise</li> <li>theme_bistro</li> <li>theme_bookstore</li> <li>theme_clean</li> <li>theme_enark</li> <li>theme_graphene</li> <li>theme_kea</li> <li>theme_loftspace</li> <li>theme_mongolia</li> <li>theme_nano</li> <li>theme_notes</li> <li>theme_odoo_experts</li> <li>theme_orchid</li> <li>theme_treehouse</li> <li>theme_vehicle</li> <li>theme_yes</li> <li>theme_zap</li> </ul> </li> </ul> <p>Themes in the above lists will become multiwebsite when installed along this module. <strong>If they get installed after ``website_multi_theme``, update this module manually</strong>, or it will not be notified of such change.</p> <a name="configuration"></a> <h3>Configuration</h3> <p>To configure this module, you need to:</p> <ol class="arabic simple"> <li>Go to <em>Website Admin &gt; Configuration &gt; Settings</em> and choose or create a <em>Website</em>.</li> <li>Press <em>Advanced &gt; Multiwebsite theme &gt; Reload</em>.</li> <li>In <em>Advanced &gt; Multiwebsite theme</em>, pick one of the available themes.</li> <li>Via Edit button (<code>fa-external-link</code>) add <em>Default Theme</em> to <em>Sub-themes</em> of the selected theme to make multi-footer work.</li> </ol> <p>Once you save, any website that has no <em>Multiwebsite theme</em> selected will have, the default plain Bootstrap theme, and those that do have one will get it.</p> <p>Of course, your Odoo instance must be reachable by all of the provided host names, or nobody will ever see the effect. But that is most likely configured through your DNS provider and/or proxy, so it is not a matter of this addon.</p> <p>If you want to test this behavior, think that <code>localhost</code> and <code>0.0.0.0</code> are different host names.</p> <a name="usage"></a> <h3>Usage</h3> <p>To use this module, you need to:</p> <ol class="arabic simple"> <li>Follow the configuration steps.</li> <li>Enter any of the websites you modified.</li> </ol> <a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/186/11.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a> <a name="development-faq"></a> <h3>Development FAQ</h3> <a name="how-to-develop-a-multiwebsite-ready-theme"></a> <h4>How to develop a multiwebsite-ready theme?</h4> <p>Check <code>demo/themes.xml</code>. It includes a demo theme that will serve as a template for you. This demo theme turns primary buttons green, so you can test if it is applied or not easily.</p> <a name="how-to-convert-a-single-website-theme-in-a-multi-website-one"></a> <h4>How to convert a single-website theme in a multi-website one?</h4> <p>Check <code>data/themes_bootswatch.xml</code>. You must do that. You can consider adding the support directly in this addon, given it will just do nothing if the single-website theme addon is not installed (it acts as a soft dependency).</p> <a name="how-to-get-multiwebsite-specific-views-updated"></a> <h4>How to get multiwebsite-specific views updated?</h4> <p>This addon is conservative by default, meaning that in production databases views will not be updated if they already were created (except for the ones copied from <code>templates/patterns.xml</code>).</p> <p>To force your website getting updated views for all views from a base theme that has changed, you should disable the website multi theme (to make the engine remove all views) and then re-enable it again (to recreate them from scratch).</p> <p>This does not happen in demo or development instances, where views arch is always updated.</p> <a name="how-to-test-on-runbot"></a> <h4>How to test on runbot?</h4> <ul> <li><p class="first">Open <code>[[ Website ]] &gt;&gt; Configuration &gt;&gt; Settings</code></p> </li> <li><p class="first">Switch <em>Website</em> field from <code>Website localhost</code> to <code>Website 0.0.0.0</code></p> </li> <li><p class="first">Click <em>fa-external-link</em> icon to edit the Website</p> </li> <li><p class="first">At <strong>Website Domain</strong> field copy-paste build domain and add something right after the first dot, for example:</p> <pre> <code>Original domain: 3308093-10-0-28910f.runbot2.odoo-community.org New domain: 3308093-10-0-28910f.second-website.runbot2.odoo-community.org</code> </pre> </li> <li><p class="first">Click <code>[Save]</code> to save changes at the Website</p> </li> <li><p class="first">Now you can use unchanged build domain for website called <code>Website localhost</code> and updated domain for website called <code>Website 0.0.0.0</code></p> </li> </ul> <a name="known-issues-roadmap"></a> <h3>Known issues / Roadmap</h3> <ul class="simple"> <li>Private themes support is not guaranteed.</li> <li>There is no UI to remove websites. Do it through an odoo shell.</li> <li>Theme picker should include some kind of thumbnail if possible.</li> <li>If you install any of the supported themes after installing this addon, you will have to press <em>Reload</em> in the website config wizard to make it notice the change.</li> <li>If you install any unsupported theme along with this addon, it would possibly become the base for all those supported, which can easily lead to weird situations and errors.</li> </ul> <a name="credits"></a> <h3>Credits</h3> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Rafael Blasco &lt;<a class="reference external" href="mailto:rafael.blasco&#64;tecnativa.com">rafael.blasco&#64;tecnativa.com</a>&gt;</li> <li>Antonio Espinosa &lt;<a class="reference external" href="mailto:antonio.espinosa&#64;tecnativa.com">antonio.espinosa&#64;tecnativa.com</a>&gt;</li> <li>Jairo Llopis &lt;<a class="reference external" href="mailto:jairo.llopis&#64;tecnativa.com">jairo.llopis&#64;tecnativa.com</a>&gt;</li> <li>Ivan Yelizariev &lt;<a class="reference external" href="https://it-projects.info/team/yelizariev">https://it-projects.info/team/yelizariev</a>&gt;</li> <li>Dennis Sluijk &lt;<a class="reference external" href="mailto:d.sluijk&#64;onestein.nl">d.sluijk&#64;onestein.nl</a>&gt;</li> </ul> <a name="maintainer"></a> <h4>Maintainer</h4> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>This module is maintained by the OCA.</p> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>