summaryrefslogtreecommitdiff
path: root/addons/website/models/website.py
AgeCommit message (Collapse)Author
2019-02-22[MERGE] forward port branch saas-12.1 up to 0f4abc5c228Christophe Simonis
2019-02-21[MERGE] forward port branch 12.0 up to 84143a34b31Christophe Simonis
2019-02-06[FIX] website: allow scheme and port on domain (multi-website)Sébastien Theys
Before this commit, the website selection was not working when a scheme or port was encoded in the domain field. This was not obvious or natural for the user, because the easiest way to fill it was to copy/paste the URL from the browser. Now it works when scheme or port are encoded, it is even strongly recommended to actually encode them if they don't take a default value because they will be used when creating full URL to the website (typically when sending emails to clients where a link back is necessary). PR: #30000
2019-02-06[FIX] *: share URL on the correct website if possibleSébastien Theys
* = base, auth_signup, mail, portal, sale, website, website_sale Before this commit, sending an object by email would always link to web.base.url even if the object was created from a specific website. Now if the object has a website, we use the URL of that website if it is set. The fallback will always be on the web.base.url. opw-1921030 PR: #30000
2019-01-31[MERGE] forward port branch 12.0 up to cb8fefa8999Christophe Simonis
2019-01-22[FIX] website: don't copy is_publishedJeremy Kersten
Before this commit, if you duplicate a published record on the website, the copy was already published, while in most of case you need to update it to adapt to the new content. There doesn't make senses to duplicate the same content on a website and let the duplicate content. Task-1930058
2019-01-16[MERGE] forward port branch saas-11.3 up to 83cc046e9a9Christophe Simonis
2019-01-16[MERGE] forward port branch 11.0 up to 4c93e4be0daChristophe Simonis
2019-01-16[FIX] website: null type redirectionNicolas Martinelli
Commit 68e9d5504cb293643 makes the redirection type mandatory, which is logical. Since we can't add such a constraint in stable, we make the field required in the view and assign a default value (in case the module is not upgraded, which is very likely to be the case). opw-1924983 closes odoo/odoo#30252
2019-01-09[FIX] website: fix viewref to not raise when raise_if_not_found=FalseSébastien Theys
`ref` could raise even if raise_if_not_found was False on `viewref`, now we prevent that, and rely only on the exception on `viewref`. Also, when not set to raise, the method could return None instead of a recorset. PR: #29753
2019-01-09[FIX] base,website: make better comments for view helpersSébastien Theys
PR: #29753
2019-01-09[FIX] website: fix menus unlinkingNans Lefebvre
Fine-tuning of commit b48d2b6b5e3aa0f74. The call to unlink inside the unlink can recurse infinitely in case there is a copy of a menu. We replace that direct call by an accumulator so no recursion occurs. opw 1922448 closes odoo/odoo#30032
2019-01-18[MERGE] forward port branch 12.0 up to 6e5ac011603Christophe Simonis
Also contains fixes for previous forward-port.
2019-01-18[MERGE] forward port branch 12.0 up to f854e01a983Christophe Simonis
2019-01-14[MERGE] forward port branch 12.0 up to 6a0675d36ddChristophe Simonis
2019-01-09[MERGE] forward port branch 12.0 up to 3e4138deaa2Christophe Simonis
closes odoo/odoo#30045
2018-12-24[FIX] website: remove faulty decoratorAtul Patel
copy_menu_hierarchy is not a model function since it expects to iterate on a recordset of websites closes odoo/odoo#29723
2018-12-19[FIX] web_editor, website(_theme_install): avoid theme.ir.ui.view crashRomain Derie
In a particular case, `_views_get` was mixing apples and oranges, ir.ui.view and theme.ir.ui.view. This was the case if a theme has a theme.ir.ui.view t-calling another theme.ir.ui.view. (Only theme's sale bridge cause this issue, eg theme_kea_sale.products) Then, having that theme installed on a website would make all other website without that theme to crash when opening the /shop customize menu. Indeed, the theme.ir.ui.view would have the xml_id theme_kea_sale.search. The generic view `website_sale.products` would have `theme_kea_sale.products` as inherit child which is website specific and t-call `theme_kea_sale.search`. Then, on a website witout theme_kea installed, opening the customize menu would call `get_related_views` that would call `_views_get` that would loop through inherit children calling `_view_obj` that would not find a view with that key and would fallback on self.env.ref, finding the theme.ir.ui.view. Note: `_views_get` might return specific view for another website but that will be filtered on `get_related_views` override in website. Step to reproduce: - Have at least 2 websites and website_sale installed - Install theme_kea on a website, it will also install theme_kea_sale - Go on the website that has not theme_kea installed - Go to /shop - Open Customize menu, it won't load because of python crash opw-1914576 Closes #29347
2018-11-29[MERGE] forward port branch 12.0 up to 82a1e1dcc33Christophe Simonis
2018-11-29[REF] *: replace deprecated pycompat helpers for builtinsAdrian Torres
This commit replaces calls to pycompat helpers that were intended for python 2 <-> python 3 interoperability for python 3 builtins, as python 2 is no longer officially supported by Odoo. This includes: * calls to imap/izip/ifilter replaced by map/zip/filter * uses of text_type replaced by str * uses of unichr replaced by chr * calls to implements_to_string, implements_iterator removed * string_types and integer_types replaced by str, int respectively * calls to to_native replaced by calls to to_text This is done in preparation to the removal of these deprecated helpers in the following commit.
2019-01-28[MERGE] forward port branch saas-12.1 up to d3b8422c9c4Christophe Simonis
closes odoo/odoo#30614
2019-01-18[REF] website: split class by file and keep historyJeremy Kersten
2019-01-17[REF] website: add new file for website_menu.pyJeremy Kersten
2019-01-17[REF] website: add new file for website_redirect.pyJeremy Kersten
2019-01-17[REF] website: add new file for website_page.pyJeremy Kersten
2019-01-17[REF] website: add new file for mixins.pyJeremy Kersten
2019-01-09[MERGE] forward port branch saas-12.1 up to 8aa8548d8abChristophe Simonis
2018-12-07[CHG] *: make binary fields default to attachment=TrueXavier Morel
Check that it makes custom binary fields into attachment as that's the main reason for the change: when users create binary fields via Studio, they're necessarily db-stored (as the interface doesn't allow altering the attachment attribute and it's unclear how we'd handle users switching it on/off every time), which significantly bloats their database (and burns storage & backup space), especially as the primary use case for binary fields is adding images and documents to records. * check that binary fields are properly created as attachment=True * add attachment=False on fields where that seems relevant (most but not all of the fields previously using the default) * remove occurrences of attachment=True closes odoo/odoo#29308
2018-11-12[FIX] website: redirect_type oversightmreficent
In https://github.com/odoo/odoo/commit/2924b77b6f52e7ee9f4a6f2fb0cc79211be42292 type field was renamed to redirect_type One was missing closes odoo/odoo#28570
2018-10-31[MERGE] forward port branch 11.0 up to a587325ca7aChristophe Simonis
2018-11-06[MERGE] forward port branch 12.0 up to dd70c684268Christophe Simonis
2018-10-24[REF] website: rename website.redirect,type to redirect_typemreficent
Part of odoo/odoo#27599 to rename fields named 'type' which may conflict closes odoo/odoo#28112
2018-10-19[FIX] website: Add onchange language_ids on website modelAkim Juillerat
On res.config.settings for website, when removing a language from language_ids, if this language is defined as default_lang_id, the default language will be updated by an onchange to prevent any inconsistency. The same should happen when doing this directly on the form view of a website record. closes odoo/odoo#27727
2018-11-02[MERGE] forward port branch saas-11.4 up to f6ca72b3ce9Christophe Simonis
2018-10-31[MERGE] forward port branch saas-11.3 up to 21eb31d8047Christophe Simonis
2018-10-19[FIX] website: current website cachingXavier Morel
Not taking fallback in account means incorrect values can get cached/retrieved on fallback v not fallback cases closes odoo/odoo#27989
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-11-26[FIX] website_event: website menu on event not workingRomain Derie
Commit 7077f18e3 tried to fix the website event menu issue. But the fix was wrong and fixed only the event having a website_id set. After the 7077f18e3 fix, event with a website_id set are working as expected but the ones without a website_id are not working. Indeed, it will create a website.menu without a website_id which will result in the menu being duplicated for each website (multi-website rule). The required on website_id when activating website menu on event was trying to hide that new issue but it was problematic since: 1. We were removing a feature for no reason as it would not be possible anymore to create a generic event (no website) with website menu activated. 2. The required would only work in form view, demo data or custo data loaded through xml without a website_id but having website menu activated would still bug and would not have a menu. Worst, the menu would be duplicated for every website and added to the website navbar. Now, regardless of the event having a website_id set or not, activating or deactivating event menu will work. closes odoo/odoo#29036
2018-10-08[FIX] website: use proper env in model methodsOlivier Dony
Using `request.env` should be reserved for code that lies outside of model methods (typically: controllers). Model methods have to use the appropriate `self.env`. This particular case caused frequent Python-PostgreSQL undetected deadlocks during installations of website-related modules in 12.0. One way to reproduce it was to trigger the installation of both `website` and `website_form` in a single transaction, with neither pre-installed. Installing Apps that depend on both would do the job, such as `website_sale`, provided that GEOIP is available on the system. In details: During installation of `website`, new attachments creation would call get_current_website (see 602807acdf20ff4f75a1abb7f5fa1be4db3f532d and 4f6ec1cd2a9253bb0c6c17d304490c7809facf8a), using the wrong database cursor: the one from the request instead of the one for the installation, as provided by `ir.module.module._button_immediate_function`. This would acquire database locks on `res.country` and `ir.model` in the wrong transaction, later blocking alterations to `ir.model` in the installation transaction, e.g. for website_form's 'website_form_access' column. This combination of events was possible before 12.0, but more difficult to reproduce as module installations used to happen with a super-user account, ignoring ACL checks and therefore not locking `ir.model`.
2018-10-08[FIX] website: auto enable multi website when creating a second websiteJeremy Kersten
Before this commit, you need to check manually multi website. And demo data create 2 websites by default, but don't check it.
2018-10-01[MERGE] forward port branch saas-11.3 up to e980af9df00Christophe Simonis
2018-09-30[REF] website, *: add automatic context for call_kw rpcqsm-odoo
* web_editor, website_blog, website_crm_partner_assign, website_links, website_livechat, website_mail_channel, website_mass_mailing, website_slides Calling a model's method thanks to an RPC will now always send the web_editor context automatically, making sure the method gets the website_id all the time, removing the need to guess the current website (now the get_current_website method uses the context website_id if any). Note: other routes already have the website_id via request.env.context if they correctly set website=True (this commit also adds website=True for scss files customization routes).
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-09-28[IMP] website: add default social share imageSébastien Theys
Allow to specify another image than the logo as default share image. This commit closes #27297
2018-09-27[REF] *: adapt code to new related default behaviourAdrian Torres
This commit adapts the business code to changes introduced by the parent commit in order to keep the same behaviour as before. All readonly=False fields will have to be checked afterwards to confirm that the business case requires write access to the source field.
2018-09-25[FIX] website: website forced on wrong session with website selectorRomain Derie
Forcing website on session before navigating to the other website would not work as expected if the other website has a different URL (hostname). It would force the website on session on current website, then navigate to second website which could still had another website in session. Now, we force the website in session once we land on the website in the dispatch() method. Step to reproduce: - Set website1 to 127.0.0.10 - Set website2 to 127.0.0.20 - From website1 click on website2 in website selector - Website2 is forced on website1 session (wrong) - You land correctly on website2 and see website2 - From there (website2) click on website1 in website selector - Website1 is forced on website2 session (wrong) - You land on website1 but see website2 since website2 was forced on website1 session at steps 3/4. This is even more trickier when there is a third website without a domain in the equation (meaning this website can be seen from website1 and website2 without changing URL (hostname)).
2018-09-25[IMP] website: add quick install from "new content"Sébastien Theys
This gives the user an overview of the possible actions, including those he currently does not have installed. It allows him to quickly install the missing applications without having to go on the backend. The commit also improves the existing actions: - correct handling of the actions deferred - add some translated terms PR: #27110 task-1885419
2018-09-21[FIX] website: allow to get current website without fallbackJeremy Kersten
Before this commit, when we ask for get_current_website, we always get one website. If we don't know which, we took the first one. Now we can ask, if we are into a website context or not with a new argument fallback. Previous code like: website = get_current_website() if website: ... Have now a sense ;)
2018-09-21[IMP]website_*: Improvement in model descriptionNimesh Jethva
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-20[FIX] website: avoid translation issue with copy on inherited recordRomain Derie
Since Odoo saas-11.3, copying a record with it's inherited record in the copy dict values will trigger translation of the inherited record's fields which it shouldn't. This issue will be fixed with #27108 In the meantime, we can avoid this issue by not copying the view separately from the page as this code is a residue from the old implementation (no inheritS between `website.page` and `ir.ui.view` + they both had `name` field) and is not usefull anymore.