Odoo multi-website improvements debate
5 March, 2021 by
Odoo multi-website improvements debate
Administrator

 

https://github.com/odoo/odoo/issues/9745

This is a start-point for talking about multi-website support roadmap in Odoo. Core support it in v9 and it’s backported to v8 in https://github.com/odoo/odoo-extra/tree/8.0/website_multi addon.

What’s supported right now:

  • Configurable menu per website
  • Configurable pages per website
  • Configurable layouts per website (header and footer): using website_id (testing pending in v8)
  • Configurable products/products categories per website, in order to have several e-commerce shops in the same company/database: using user_id and record rules (testing pending)

What’s NOT supported right now:

  • Configurable options per website (Show sign in, show logo, automatic footer, …)
  • Configurable theme per website (one with Enark other with Graphene, for example)
  • Website creation wizard, for creating top menu, homepage, contact us, … base pages in order to start editing afterwords.
  • Pages management tree view, in order to have a list of all pages in a website

There are several issues to take into account:

  • Several addons (themes, website_sale, …) inherit from website.layout in order to add JS, CSS, HTML blocks, … If you install two theme addons, then they fight for adding static assets and result is a mess.
  • We can not create a new layout per website (for example for personalizing header and footer), because then all addons (themes, website_sale, …) inheriting website.layout will not add custom content in the new layout.
  • Active/deactive options are the same as active/deactive views, but this is applying to all websites, unless customize_show = True views were re-created when website is created.

Possible design solution:

  • Create a website template model (for example ir.ui.view.template). Similar toaccount.account.template. This model will save website template from addons.
  • Create a theme model (for example ir.ui.theme) in order to have a theme list
  • Add a field
  • Implement a wizard for creating a new website that:
    • Create a website related views from website template filtering by theme
    • Associate these views to the new website
    • Create an empty homepage
    • Create a top menu with an entry ‘Home’ pointing to homepage
  • Implement a wizard for sync new views added to ir.ui.view.template into an exists website, not overwriting already edited views by user.
  • Addons inheriting from website addon will add views to ir.ui.view.template and then sync them to default website.
  • Change/extend t-call Qweb tag implementation (or create a new t-call-website tag), in order to load qweb templates associated with current website, only in website requests. Take in account that with these implementation there is one website.layout per website, so we have to use key andwebsite_id fields, not xml_id field, like we currently do for pages.
  • Change/extend t-call-assetsQweb tag implementation (or create a new t-call-website-assetstag), in order to minify assets filtering by website.
  • Define an environtment attribute to known which website is executing this controller, reading this model, or rendering this view. This allow to implement multi-website aware addons.

This are just a preliminar ideas, suggested to change and opinions. That’s why I launch this issue, to talk about it, because we can not compare Odoo multi-website with WordPress or Joomla multi-website systems.

This implementation is similar to multi-company or multi-currency. This is transversal to Odoo. So I suppose that this implementation will be welcome in master branch, in order to be ready for v10 version.
Then, after success we can implement a backport to v9 and v8.

Any opinions, questions, suggestions?
Thanks

https://github.com/odoo/odoo/issues/9745