summaryrefslogtreecommitdiff
path: root/addons/website/tests/test_menu.py
AgeCommit message (Collapse)Author
2020-04-30[FIX] website: menu translation on websiteNicolas Lempereur
Currently, the menu are only translated for installed language when we create a new website. When we create a new menu (eg. by installing a module) or install a new language we will only translate menu without website_id set, so the menu are not translated. With this changeset, we try to match translation of menu without website_id to menu with website_id when translations are updated: - when a language is installed/updated - when a module is installed/updated Without the changeset, the added test would fail with: - "Menu in english" != "Menu en français" Load translation add missing translation from template menu - "Menu in french" != "Menu en français" Load translation with overwriting update existing menu from template fixes #43365 opw-2209864 closes #48031 closes odoo/odoo#50498 X-original-commit: 998987f8ee148235f4025eb97a424e838ac6fc9f Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-10-21[IMP] website: make test works with more website than the data onesRomain Derie
Those tests were raising an assert error if the DB has other websites than the data/demo ones. As we have a new module in Odoo 13.0 (odoo/design-themes#178) which is creating 25 websites, and since the design-themes runbot is now running tests, we were having a red design-themes runbot. closes odoo/odoo#39145 X-original-commit: 67df6b91ddb6cb83d558137691481f50834f7fca Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-09-03[IMP] website: add the ability to create mega menusqsm-odoo
Allow users to create complex website menus, also known as "mega menus". Mega menus are enabled individually via the edit menu dialog, then their content can be customized by dragging snippets in them like any other snippets area in edit mode. task-1925319 closes odoo/odoo#36097 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: Andrea Ulliana <aul@odoo.com>
2018-10-12[FIX] website: Remove related website menus on module uninstallRomain Derie
Commit 850e1675eb improved the website.menu creation on module install (eg: /shop for website_sale). This commit aims to do the same on module uninstall. Before this commit: Uninstalling a website module would uninstall its website.menu (/shop) stored on the default menu tree. But the copies of that default menu, on websites, would remains. Indeed, there is no direct link between the default menus and its copies. More annoyingly, installing that website module again after uninstalling it would create a new copy of the default menu, resulting in multiple same menus on website. Now, if the menu to be uninstalled is in the default tree menu, we remove all its copies (the website.menu having that same URL). Closes #27488, closes #27721
2018-09-29[FIX] website: store default menu tree (apps menu) for new websiteRomain Derie
Previously, for multi-websites it was decided that: - creating a new website would not get already existing apps menu (shop, blog, forum..). - installing a new app would create the app's menu on existing website This was decided mostly for technical reason but it is a weird behavior. This commit saves the installed apps menus in order to copy them on new website If this default menu got deleted, we ensure a minimalist tree menu for new website Note: This also fixes the bug where installing a website_module more than once (with -i website_module in command line) would create the menu (blog, shop, forum..) on the first website a second time. This was because the website.menu.create() overrided in website would return the last created record in the self loop, thus the last one created would be the one set to the xml_id (ir.model.data). This commit closes #27253
2018-08-13[FIX] website: improve/fix menu, copy on unlink, clone page, unique_path, ↵Jeremy Kersten
sale_report, ... Fix bug from the initial poc of JOV Fix menu creation - creating a menu would create a 'container' menu in the DB (.create is call without website_id) then writing on it would copy (if condition to cow) the menu with a website_id leaving the first one as a menu container unused. - website_menu should always have a website_id we dont want to support the multiwebsite system that allow to have generic/specific menu unlink/write is useless now since we always have a website_id Make unique_path website dependent, 2 distinct website can have a page with same name Make Sale report multiwebsite compliant Make website_id on sale_order / account.invoice as a related stored from partner_id. Co-authored-by: Derie Romain <rde@odoo.com> Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-13[IMP] website,*: support multiple websitesJoren Van Onder
This implements support to administer multiple websites. Although the core functionality already existed, managing multiple websites was fairly technical. In the interest of database updates and migration this attempts to keep duplicated data to a minimum. To do this the usual generic records are rendered unless some website-specific record exists that replaces it. Copy-on-write (COW) is used to create these website-specific records. Through this mechanism creating a website-specific record is delayed until necessary. A COW mechanism has been implemented on 4 models: ir.ui.view, website.page, website.menu and ir.attachment. These COW mechanisms are activated when editing data through the website (aka frontend). These frontend edits (e.g. with web_editor) will be website-specific, possibly creating a website-specific record when necessary. When editing data in the backend nothing special will happen, even when editing a generic record. Note that because of this mechanism also facilitates the ability to create new, uncustomized websites because the generic data is kept. Support is provided for a website to have any theme. Themes are fairly complex to handle. Standalone themes can depend on other standalone themes (e.g. theme_beauty depends on theme_loftspace) and themes usually modify some data of the themes they depend on. Because a theme can be installed on multiple websites, using website_id m2o fields does not work well. It would require duplicate data, making updates and migration harder. Because of this, data for themes (ir.ui.view and ir.attachment specifically) have a theme_id m2o. website has a theme_ids m2m that identifies all theme modules currently installed on it. Through these fields we figure out what to render. A theme is only fully uninstalled when it's no longer active on any website. The advantage of this approach is that upgrading or migrating theme data is no different from the single-website case. The website.published.mixin class was modified to handle multiple websites. A wizard was added in the backend to easily manage this for multiple website. Although not used anywhere in this commit, a 'website_id' variable has been added in the evaluation context of ir.rule. It allows to easily make any model multi-website aware, all that's needed is a custom website_id m2o field on a model and a custom record rule.