Commit Graph
13 Commits
Author SHA1 Message Date
Naglis Jonaitis f17f2e8336 [IMP] website_theme_install: typo in model class name
closes odoo/odoo#35389

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-01 20:27:30 +00:00
Andrea Ullianaandqsm-odoo 7deceae18c [IMP] website, *: use "auto" widget for font customization
* theme_bootswatch, theme_default, website_theme_install

This commit makes use of the new 'auto' widget for font selection:
instead of enabling a template which will enable a scss file which sets
a font variable to a specific value... we directly allow to do a scss
custo which sets that value.

The code in charge of resetting font customizations on theme switching
is also moved and refactored here in website (instead of being specific
to each theme).

Part of https://github.com/odoo/odoo/pull/33442
task-1974659

Co-authored-by: qsm-odoo <qsm@odoo.com>
2019-07-30 09:59:28 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00
Thanh Dodeur c212cfe899 [REF] *: removes datas_fname from ir.attachment
This commit removes the field `datas_fname` from `ir.attachment` as
it was unnecessary and most of the time the duplicate of `name` or
`url`.

Task #1909865

closes odoo/odoo#32976

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-06-05 09:12:13 +00:00
Martin Trigaux 288b5e3a41 [FIX] website_theme: translate website themes
Inspired by l10n_multilang
When a theme is installed, the theme.* records are used to generate actual records.
The same was as we use account.account.template to create account.account, the
translations of  the theme records should be propagated to the new records.

opw-1918120

closes odoo/odoo#29748
2019-02-08 12:27:15 +00:00
qsm-odoo 30e937cf74 [FIX] website_theme_install: review post copy view toggling
If a theme post copy wants to enable/disable a view, this is to
enable/disable a given functionality which is disabled/enabled
by default. So if a post copy asks to enable/disable a view which
is already enabled/disabled, we would not consider it otherwise it
would COW the view for nothing.

closes odoo/odoo#28772
2018-11-19 10:25:26 +00:00
Sébastien Theys 96ef4885a7 [FIX] website_theme_install: fix theme install/upgrade/remove
The goal of this commit is to handle 3 cases:
===============================================================================

- Correct loading of downstream themes for existing themes at (auto)install

  eg. If we have `theme_A` loaded on a website and we install `website_sale`,
    then `theme_A_sale` must also be loaded automatically on that website.

- Allow migration of every theme/website from the command line -u

    When there is such an explicit upgrade, the Odoo framework was already
    handling the upgrade of the modules, but it did not take care of reloading
    the appropriate themes on the websites using them.

- Allow upgrade of only one theme from the interface

    When using the UI to upgrade a theme, we want the user to be able to upgrade
    only the current website and not any other. This will upgrade the modules
    of all themes in the stream, but reload them only for the current website.

===============================================================================

- Move install/upgrade logic into the `write` method to automatically take
    advantage of base features such as correct order of dependencies.

- Create methods to correctly compute the dependency stream of a theme:
    upstream, downstream, and both ways.

    Upstream: limited to modules with name starting with `theme_`.
    Downstream: limited to modules with name starting with current theme name.

- Change `_update_records` method to better look for dependencies

- Change `button_choose_theme`:
    - Always upgrade the stream before installing a new theme.

- Move `_convert_to_base_model` logic into `theme_models.py`

================================================================================

There are a lot of flows to take into account, some of which may be combined
with others.

- Dependencies such as website_sale or website_blog can be:
    - already installed when loading a theme
    - (auto)installed later when the theme is already in use

  theme_A_sale and/or theme_A_blog has to be loaded on every website using
  theme_A as soon as it is needed.

  Not all themes have such dependencies.

- A theme can have other themes as dependency.
    - The proper dependency chain must be taken into account when installing
      or upgrading.

- Some themes do not have any dependency at all (theme_default, theme_bootswatch).

- Different websites can use the same theme.
    - All of them have to be upgraded when using -u
    - Only the current website must be upgraded when doing it from the UI

- Different websites can use different themes, including intermediary themes.
    eg. - website1 may use theme_A
        - website2 may use theme_B (depending on theme_A)

  Moreover, theme_A and theme_B might have downstream themes such as
  theme_A_sale and theme_B_sale (which depends on theme_A_sale).

In that case it is important when manipulating theme_B to also take into account
the relation it has with theme_A_sale even though theme_A_sale doesn't start
with the same name as theme_B and it is not in the direct stream of theme_B.

Authored by @seb-odoo with contributions from @dbh-odoo and @JKE-be
and precious help from @rde-odoo

PR: #27511

closes odoo/odoo#27838
2018-10-15 10:45:36 +00:00
Nimesh Jethva 53e8aba1ab [IMP]website_*: Improvement in model description
Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
2018-09-21 11:45:15 +02:00
qsm-odoo fa12ae4009 [FIX] website_theme_install: fix the enable_view method
The method failed to enable views which were created by copying a
theme.ir.ui.view. This is because standard views were found with the
'ref' method while those particular ones were found thanks to the
copy_ids field... which only found the already active ones by default.
2018-09-19 10:24:35 +02:00
qsm-odoo a0fed1c719 [REF] website_theme_install, *: add theme.utils utility methods
* theme_bootswatch, theme_default

Allow to disable/enable a view from a xml_id whether the xml_id is
linked to an ir.ui.view or a theme.ir.ui.view.
2018-09-04 17:43:45 +02:00
qsm-odoo 0b480f6b2c [FIX] website_theme_install, *: multi-website customization dialog
* theme_bootswatch, theme_default

Before this commit, the customization dialog for themes was not
multi-website. That means if a theme was installed on a website, the
customization dialog was enabled for all the websites.

Note: this commit uses the '_post_copy' system of theme installations
for the first time and it had to be adapted a little bit.
2018-08-31 16:00:10 +02:00
Jeremy Kersten 7341f33f16 [IMP] website_theme_install: allow to set mode on view in theme
Allow to set mode=primary on new view for theme
2018-08-15 16:23:23 +02:00
Jeremy KerstenandDerie Romain c0968e68ed [ADD] website_theme_install: try to make theme multi website compliant
From now, when you install a theme, it load the data from xml to template
table theme [ir.ui.view|ir.attachment|website.page|website.menu].

Data are only copied from this template table into the real table when you
choose a theme on a website; Making them website_specific and with a link
to the original to allow futur update.

A special case is done to create theme.ir.ui.view when you are installing
a theme, even if you continue to use template tag to create quick view.

Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-13 20:16:34 +02:00