summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/content/website_root.js
AgeCommit message (Collapse)Author
2021-05-03[FIX] http_routing, website: prevent crash when using `fw` in urlRomain Derie
Before this commit, the routing map generated and used would be the one from the website the request is performed, instead of the one from the `fw` website ID which will be the one we redirect the user to. This issue was introduced with the routing map by website, be8fc2296b38 and is restricted to a single case: a publisher using the website switcher, and it won't happen on next page naviguation/refresh as the `fw` website id will be the same as the current website's ID. Thus there won't be any routing map mismatch. Step to reproduce: - Create a page on website 2, set it as homepage - Naviguate to website 1 on '/' url - Naviguate to website 2 on '/' url This will raise a werkzeug error about `EndPoint not iterable`. ----- Technical analysis ------ This is the current flow: 1. `_dispatch()` is setting `website_routing` to `get_current_website()` -> 2 2. `_dispatch()` is calling `_match()` 3. `_match()` is calling `routing_map()` with key = `website_routing`, which was set to 2 in step 1. 4. `routing_map()` is calling `_generate_routing_rules()` which generate the rules based on `website_routing`, which was set to 2 in step 1. 5. `_dispatch()` authenticate the user by calling `_authenticate()` 6. `_dispatch()` is calling `_add_dispatch_parameter()`, where URL param `fw` is forced in session, so `get_current_website()` now return the correct `website_id` -> 1 The issue: in order to handle the `fw` URL parameter (step 6.), we need to check the rights to ensure we can allow the website switch. To check rights, user need to be authenticated (step 5.), which is done after generating the routing map (2. & 3. & 4.). The routing map is generated based on the current website (step 1.) Step 6 depends of steps 5 which depends of steps 2/3/4 which depend of step 1, but step 1 should depend of step 6, which is an impossible cycle. closes odoo/odoo#70278 X-original-commit: 878e28f93a65756fa2002ef2af5b02a3e2c59b1b Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com> Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-12-02[FIX] website: remove old codeRomain Derie
This code is a leftover of https://github.com/odoo/odoo/commit/2972976962617d4b8a0113bae58c640ab41cdff8#diff-70e782021bdfee46734a7fc7dbcad3104f7f985dd37f9320f1480d424581d67fL191 - We should not get info from the `err` and `data` parameters, those are not the same as the it was before the code got migrated, `data.data` never exists. - The fact that we handle the fail on this call is also a leftover of that refactoring where the error was done through a generic template. - We should not handle an error on publish action. We never handle that kind of error if the action should not fail by default. This is typically the case when loading the menu through "Edit Menu" or the page properties. - This is especially true with later version as error raised are already handled globaly Closes #60041 closes odoo/odoo#62532 X-original-commit: 4e089041252c25cc197a30f9e285d82f7162d809 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-08-14[IMP] website, web, portal: new options language selector in footerBenjamin Vray
Add an option to display the language selection inline or with a dropdown. Add an option to choose if language labels are flags, text or both. Part of https://github.com/odoo/odoo/pull/55300 task-2203383 Co-authored-by: qsm-odoo <qsm@odoo.com>
2020-07-30[FIX] website: prevent page flickering when modal is openedqsm-odoo
Commit [1] introduced a flickering when any modal was opened on the frontend. Indeed, it introduced the possibility to go into "fullscreen" mode, which makes the Odoo UI navbar and sidebar disappear. This is animated: the padding of the `<body/>` element is using a CSS transition... but when a Bootstrap modal opens, the padding-right is changed to compensate the scrollbar removal. This change now being animated, it creates a flickering. A generic solution was made: only animate what is animated for the duration of the fullscreen mode switch. [1]: https://github.com/odoo/odoo/commit/0b0690a3934cedcab0d5e34373e8d40c2ab25660 closes odoo/odoo#55210 X-original-commit: ccadb20c82a651e9ef87e818b898f3e9a081cacd Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-07-28[IMP] website, *: move all google map options to left panelqsm-odoo
*: web_editor -> Introduce the we-gpspicker widget and improve the way the gmap lib is loaded (for Odoo / multiple snippets / ...). Part of https://github.com/odoo/odoo/pull/49101 task-2091396
2020-06-12[IMP] *: update notifications to optional titleJulien Mougenot
closes odoo/odoo#52826 Related: odoo/enterprise#11084 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-25[FIX] web, *: fix keyboard overlay staying active when alt-tab/clickingSamuel Degueldre
*: website The keyboard navigation mixin was initially only used in the web-client, because of this, some of the logic for hiding the overlay was put inside of the web-client. We recently made keyboard navigation available on website [1]. The handlers that would hide the overlay when alt-tabbing or clicking on the page were not registered. This commit fixes that by making the keyboard navigation mixin register the overlay-hiding handlers itself. [1]: https://github.com/odoo/odoo/commit/0b0690a3934cedcab0d5e34373e8d40c2ab25660 closes odoo/odoo#50122 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-16[IMP] website, web: add fullscreen mode and frontend keyboard shortcutsSamuel Degueldre
While the edit mode interface is full of useful things, it also adds a lot of clutter, and alters the page's width and thus, its layout. This commit adds keyboard shortcut for website editors to use, and allows them to enter a "fullscreen" mode that hides the editor interface while remaining in edit mode, allowing the user to have fewer distractions while editing text content, and a closer rendition of the page's final layout while editing. For this, keyboard shortcuts were required, and a few other useful shortcuts have been added, such as alt-1,2,3 for the navbar, just like in the backed. task-2126915 closes odoo/odoo#46953 Related: odoo/enterprise#9295 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-26[FIX] website: typo in toastr 'Congratulations'Romain Derie
Missing a `s`. Congratulation > Congratulations (fdba9a878f4b02). task-2144335 closes odoo/odoo#46380 X-original-commit: 7d743029dde14fac18fb3b5331c43fe1d940a772 Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-02-12[FIX] website: prevent undefined in publish toastrRomain Derie
d92f76592c19 introduced a toastr when publishing a record. It was designed for the topbar publishing toggle button, but some other templates ended up also using that feature. As those templates were missing `data-description` which contains the model business name, it would show `You've published your undefined`. This is only related to a very few places having a publish button inside the page. This commit fixed that by ensuring every publish button template have the necessary code. Also, a fallback is added in case tha `data-description` is missing somehow. task-2191735 closes odoo/odoo#45141 X-original-commit: 4ab6e36b739060eb16e97eac502fd087a072abf3 Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-02-03[IMP] website(_blog/_slides): show a toaster when a record is publishedRomain Derie
This commit shows a toaster when publishing a record through the toggle in the topbar. The `_description` field is used to do that, as it is supposed to contains a 'business oriented' descriptive name, see task-37311. Indeed, this field is used in studio and in mail templates. task-2144335
2020-01-21[FIX] website: bit which blows up during testsXavier Morel
2019-10-02[REM] account, project, sale, *: remove dead code 'return_label'Romain Derie
Since Odoo 9.0, the `return_label` in url was not working anymore. What it did before 9.0 is add an item in the breadcrumb which once clicked would redirect to the frontend. This was handled in the `do_load_state` of the action manager in JS. We don't need to reimplement that behavior as now we have the 'Go to website' stat button. Thus we remove the code. Closes #36325 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-25[MERGE] forward port branch saas-12.4 up to bef26222b8fChristophe Simonis
2019-09-25[MERGE] forward port branch saas-12.3 up to dd627b9698dChristophe Simonis
2019-09-24[FIX] website: make website selector work with scheme and portRomain Derie
Before this commit, if one would introduce a scheme or a port in his website domain, it would make the website selector to crash JS side. Indeed, it would replace the current url hostname by the website domain. If the website domain was introduced with `http://` it would lead to `http://http://mysite.com`. If port was introduced, `http://mysite:8069:8069`. Also, by fixing those 2, it also make `localhost` and `127.0.0.1` to work. (which would not work without `http://`. Related to #36390
2019-08-26[IMP] http_routing, website: allow to customize the lang in URLRomain Derie
With this commit it is now possible to change the lang displayed in the URL. Eg, you could use `/fr` instead of `/fr_BE`, or even a fancier `/french`. Task-32838 Courtesy of pla@odoo.com closes odoo/odoo#35135 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-06-06[MERGE] forward port branch saas-12.3 up to 409679866b2Christophe Simonis
2019-06-03[MERGE] forward port branch saas-12.2 up to 995aa1685eeChristophe Simonis
2019-06-26[IMP] base: Add option on image widget to enable zoomKevin Baptiste
Purpose ======= As the employee picture on a form view is often too small, it should be possible to zoom on it like for products in eCommerce. Specification ============= Added new bool options on FieldBinaryImage: `zoom` and `background`. `zoom` will call zoomOdoo.js and display a popup with the zoomed out image. `background` is used to either display the image as a div element with a background-url (to be used e.g. in a kanban view) or as a standard img element. closes odoo/odoo#33839 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-21[IMP] website: add specific object for Optimize SEORomain Derie
Before this commit, the object used by Optimize SEO 'wizard' was always the main object, without any possibility to change that (except by changing the main object but that would cause a lot of other issue, eg edit in backend). This commit add the possibility to explicitly set a seo object on the html data attribute. If set, this one will be used instead of the main object. This is useful for event.event where all the event pages (with website menu enabled) would share the same SEO since the main object would be the event.event. With this commit, the seo object is now the website.page, thus giving the possibility to have a separate SEO for every event pages. (Required for Odoo.com website for OXP) closes odoo/odoo#33194 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-13[IMP] base: Contextualize the multi companyYannick Tivisse
Purpose ======= Allow the user to select the allowed companies for which he wants to see records on top of selecting his current company. It is confusing for users to see the records from the company he is connected to and the records of the children companies. Instead of using the hierarchy of companies to access records across companies, the user can now select (from his set of allowed companies) the companies for which he wants to access records. /!\ This means that the user will interact with records from company A when in company B. Example: a SO has been created and confirmed in A. When in B, I create the invoice from it. Specifications ============== 1/ Deprecate the parent/children hierarchy on the res.company model. The fields are kept on the res.company model to ensure the retro-compatibility, but won't be used accross the standard code anymore. The only functional usage for this mechanism was to allow to see records from several companies by creating a virtual parent company, which will be possible with the new mechanism. 2/ By default, a user will only see the records of the company he is connected to (or records without a company). (It is still editable by the user if needed). For that, put this information in the user context, to allow having different configurations on different browser tabs. Instead of having domains like ['|', ('company_id', '=', False), ('company_id', 'child_of', user.company_id.id)] you'll have something like ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] Note that the 'company_ids' is a value that is passed in the evaluation context on the record rule, as we already have user, or time. company_ids is a list of the ids of all the enabled companies in the user's context. 3/ Out of the generic improvements brought by this task, this will illustrate issues that could exist since several versions. For example, it should not be possible to create a scrap order for the company A with a package of the company B, or it should not be possible to create an invoice on the company A with payment terms from the company B. Before the version 12.0, it was easy to encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side effect of the fact that the SUPERUSER_ID has become an inactive user was to make it more difficult to introduce mismatch on the records, but haven't solved the issue, as it was still possible to do it with parent companies configuration. Some of these issues have been fixed in this commit, but all the business flows should be re-tested to check if an ir.rule should be introduced (eg: a multi company rule for stock.quand.package), if the company of a record is correctly transfered to another record created from the first record (eg: From a SO, create an invoice and a payment, the company of the sales order should be transfered on the invoice and the payment, even if the company of the sales order is A and I'm logged into the company B with the company A enabled. 4/ Currently, if I click on a button on a notification email (example 'View Task'), I face a traceback if I'm not logged into the company of the record. Now, if you click on a button and if you have access to the record, the correct company will be automatically set. 5/ If I display a kanban view with several records from several companies (and an image), all the images should be displayed. 6/ Currently if you copy paste an url, this will crash if you're not in the correct company. This won't be fixed because it's quite impossible to do it in a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into the correct company, re-copy/paste -> Ok. 7/ 2 property methods have been added on the environment to retrieve the company on which the user is logged in and the companies the user enabled, on a specific tab. That way, when creating a record, instead of doing default=lambda self: self.env.user.company_id do default=lambda self: self.env.company_id On the other hand, to retrieve the enabled companies, do companies = self.env.company_ids 8/ Modify the Company Switcher widget to allow to log into another company WITHOUT writing on the res.users (and thus bringing cache invalidation issues and so on). Also allow to enable several companies and see records from several companies, and independantly of the other browser's tabs. 9/ When focusing on a tab, save the current company configuration on the local storage. That way, when doing 'CTRL+T' or a middle click, the context is propagated to the new tab. 10/ Improve the error message in case of multi company access errors. Now, when the user is in debug mode, display the related names of the records and the name of the user who brings the issue. 11/ Remove the context erasing when writing on a res.users This is probably coming from the migration to new API of the base module. The context was not propagated at this moment, which was a common mistake at that time. When migrating the module, probably by using the 'black box' method, as the context was not propagated, it was erased on the new version. This is now an issue because the context (i.e. the enabled companies) was erased when writing on a res.users, leading to tracebacks. See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624 12/ Fix the crash manager on redirect warnings. The issue is the following - Create an invoice on a company without a configured CoA. - Set a partner - On the onchange_partner_id, a redirect warning is raised to propose you to configure a CoA - Click on 'Go to the configuration panel' - A generic warning says something like 'Do you want to discard your changes?' - Click on yes, the page refreshes, but not on the redirect action. Now, set correctly the action on the hash, and reload instead. The breadcrumb is lost for example, but you reach the correct action at least. 13/ Introduce a res.group to enable/disable the multi company per tab feature. 14/ To help the users to know which tab is in which company, add the possibility to have a favicon per company. When creating a company, the classical 'O' icon is colored by default in a random color. 15/ Remove the company switcher on the frontend. This was mainly there to allow a user to swicth to the company linked to the website. This behavior is now transparent to the user. If the website A is activated, then the company set on the context is the company of the website. 16/ Deprecated the _company_default_get method on the res.company model. Remove the method _get_company on the res.users model. 17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval context. You can now use those variables on domains in the views to access directly to the activated company.ies on the current tab. TaskID: 1960971 closes odoo/odoo#32341 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-02[MERGE] forward port branch saas-12.1 up to b11930047f6Denis Ledoux
2019-04-15[FIX] website: submit formNicolas Martinelli
Example where the issue occurs: - Publish an event - Go to the website, register for that event - At confirmation, when the email address is requested, click quickly several times on the 'Continue' button Several registrations are created since nothing prevents multi-clicks. The stateful button feature of the `button.js` jQuery plugin has been dropped in Bootstrap 4 (see [1]). [1] https://getbootstrap.com/docs/4.1/migration/#buttons opw-1958580 closes odoo/odoo#32571 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-06[REF] website: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-26[REF] website, *: stop using 'animation' confusing nameqsm-odoo
* web, website_blog, website_sale, website_twitter Before this PR, all website widgets were named 'Animation'. Now that they are 'Public Widgets', we can at last stop using the confusing 'animation' name. Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-26[REF] website, *: move and review the notion of edit modeqsm-odoo
* portal, sale, web, website_blog, website_crm_partner_assign, website_forum, website_event_track, website_links, website_mail, website_slides, website_mail_channel, website_mass_mailing, website_sale, website_sale_comparison, website_sale_delivery, website_sale_wishlist The `editableMode` option and its related options in public widget should only be part of website, this commit moves them there. This is also the occasion to implement something that is long overdue: stop creating 'animations' / public widgets in edit mode by default. Indeed, lots of 'animations' were defined by beginning with 'if not edit mode'. Now, if a public widget should be considered in edit mode, it must be defined explicitely through a property at *definition* of the widget. Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-26[REF] *: use 'frontend' system in non-website appsqsm-odoo
* account, auth_signup, payment, portal, project, sale, sale_management, web_unsplash, website, website_mail, website_rating, website_sale This commit does probably not do what is stated for all non-website apps but it is a first step. It also uses the system in apps which could have already used it but did not. Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-26[REF] website, web, *: move part of website into webqsm-odoo
* im_livechat, survey, website_forum When website is installed, the JavaScript code has access to utilities to define improved widgets which are automatically attached to existing DOM elements on page load. Those mechanics are more and more needed in portal which does not depend on website (as it is website which depends on portal). This commit moves part of website JS to web, so that it can be used by all 'frontend' apps whose only common dependency is web (portal, survey, auth_signup, ...). This PR also questioned several other similar issues which will be handled later like: - website should maybe not depends on portal but only on http_routing - part of portal should be moved to http_routing and http_routing should be renamed (especially for frontend layouts, etc) so that apps like survey can reuse some common code Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-26[REF] website: split WebsiteRoot definition / instantiationqsm-odoo
In preparation to future commits, the WebsiteRoot instantiation is moved in an other file than its definition. Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-05[REF] website, *: remove 'website.context' moduleqsm-odoo
* website_forum, website_gengo, website_mail_channel, website_sale Retrieving the global context is now the root's job, this will prevent problems when trying to extend the values the context has. See upcoming improvements with https://github.com/odoo/odoo/pull/29442 closes odoo/odoo#30816
2019-01-31[REF] website: merge `BodyManager` and `WebsiteRoot`qsm-odoo
Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, 'web_editor.BodyManager' stopped being used by the editor and the related file was moved to website without being renamed or considered. Hopefully, the editor replaced it by something else so the `BodyManager` makes no sense on its own anymore. This commit merges its features with the only other component which still used it: `WebsiteRoot` See upcoming improvements at https://github.com/odoo/odoo/pull/29442 (related to task-1932066) closes odoo/odoo#30740
2019-01-24[FIX] website, *: restore 'animation' system to the way it workedqsm-odoo
* website_forum Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the website 'animation' system was 'extended' to vaguely use a 'Registry' instance instead of an object. This was however left undocumented, with a require in the middle of a file, restarting all animations when used, only used by website_forum... with more code for no reason at all, ... This commit restores the system to the way it was before and re-adapts website_forum: - No need to check if website_forum is in the DOM as it is already checked by the animation system (on top of that... the new code was checking the DOM before it was ready...). - No need of a dynamic add on a registry, this is always done before the DOM is ready, so before the animations are started. - No need to know the root instance in website forum, just use the animation as the Wysiwyg instance's parent. The goal of this commit is also to avoid useless conflicts with https://github.com/odoo/odoo/pull/29442 (that should not have had any conflict at all as totally independent of the editor task...) closes odoo/odoo#30478
2019-01-22[REF] website, *: rename and simplify web_editor.contextChristophe Matthieu
* website_forum, website_gengo, website_mail_channel, website_sale Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the web_editor.context module was moved to website without being renamed. This commit renames it to website.context but also merge the website extension that was made to that context directly within its definition. closes odoo/odoo#30409
2019-01-17[IMP] web_editor,*: Refactoring the wysiwyg editor and 'html' fieldChristophe Matthieu
* Creating a new structure by transforming all the plugins in the library using the odoo inheritance system. Plugins are easier to implement with the AbstractPlugin to add Odoo behaviors. * From now on, the methods of the library (in this case Summernote) can no longer be called by other modules or files. Only the wysiwyg widgets can access it, to simplify the updating process. The wysiwyg object serves as an interface. * Depending on the options the snippets will be loaded or not, the editor will be in an iframe or not... all of this is transparent from the outside. * Regarding iframes, all controllers related to editing have been removed: the new API no longer needs them. This speeds up loading, eases testing and removes complexity for the same features. PUBLIC FEATURES There are several public methods on the Wysiwyg class: * Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the library (xml, lazy, assets...) is loaded. * Wysiwyg.getRange (DOM): returns the range (selection in the dom) * Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates a range (selection in the dom) * Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an element (option available to select all, start or end) A jQuery selector was added: :o_editable, which indicates whether the current element is editable. That is, if it is contained in a tag with the attribute 'contentEditable = "true"' or in a tag with the class o_editable. Several methods are also present: * focusIn: makes a focus and places the cursor at the beginning of the element * focusInEnd: makes a focus and places the cursor at the end of the element * selectContent: makes a focus and selects the content HTML FIELD The HTML field can receive different options: * style-inline: {boolean} transforms a class into an inline style when saving and vice versa when reading. * no-attachment: {boolean} prevents the use of attachments (in media dialog) * cssEdit: {xml_id} to use a template containing the css to loaded in an iframe when editing * cssReadonly: {xml_id} to use a template containing the css to load into an iframe when viewing in readonly * snippets: {xml_id} snippets template (can be used with or without cssEdit) * wrapper: {template} qweb static template (containing a tag: id = "wrapper") that will include the content during editing (removed on save) MASS MAILING A widget was created for mass mailing. There are now two fields: body_html and body_arch. body_arch contains the code with the class without conversion into inline style, useful when editing and one with the inline style that is visible in readonly mode and sent by email. Advantage: no spreading errors, able to update css/theme, able to do more changes when converting to inline style so that a maximum of mail clients have an impeccable rendering. Co-authored-by: Antoine Guenet <age@odoo.com>
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-13[FIX] website: multi website and company switcherJeremy Kersten
Remove domain based Use domain if set That will imply that you need to reconnect on your new website too. task-1878245
2018-08-31[FIX] website: allow to switch from company from the front endJeremy Kersten
In some case, you can be on website 2 (where company_id = 2) with your user into the company 1. In this case, you will not see the product on ecommerce from company 2 while you stay in company 1.
2018-08-24[FIX] website: move `main_object_request` event in website_rootRomain Derie
`main_object_request` was added in the navbar widget. It would not work with `PageManagement` widget as it is added in the website_root widget and not the navbar. Moving it to the website_root will make the event accessible when triggering up the event.
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[REF] website: small diff pep, renaming, make generic functionJeremy Kersten
This commit should not change the behaviour in most cases. 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.
2018-08-13[REF] web_editor, website: improve animations' restartqsm-odoo
- Before this commit, when we asked to (re)start animations on an element, we checked the animations to be started on the element and started them after destroying the animations with the same name which were already running on that element. This is in fact not correct. Indeed, if an animation was running on element but that the conditions that made the animation start are now gone, asking to restart the animations on that element should destroy the deprecated ones. (e.g. an animation "A" is to be started on all elements which have a class "a", if we remove the class "a" on an element then restart animations, the animation "A" should be destroy). The implementation is in fact even simpler: when asking a restart, a full stop is performed then a simple start. Note: this does not need to be a fix as multiple animations on a same element was recently introduced and the described case never occurs with current features. - When stopping the animations on an element, stops the animations of all its descendants too. - Add an helper method in the `SnippetOption` class to restart the animations running on the `$target` element.
2018-04-06[MERGE] forward port branch 11.0 up to d277adf4d59Christophe Simonis
2018-03-29[FIX] website: remove ribbon on unpublished pages (new specs)Romain Derie
This commit reverts part of f5912cb since the spec changed afterwards. Unpublished page will have a red toggle, which even if it is small should be enough to draw user attention, and not a ribbon anymore. Task-44005
2018-03-22[MERGE] forward port branch 11.0 up to 39d9c362c5bChristophe Simonis
2018-03-22[IMP] website: make it more noticeable when a page is unpublishedRomain Derie
Before this commit, 2 usability issues were reported: 1. Some people would get stuck with unpublished content without even knowing it since they would not understand the page is unpublished. 2. People would have a hard time finding the publish button (small toggle on the navbar). Now: 1. We now display a red ribbon on the top right corner specifying the page is unpublished. Hopefully it can't be missed. 2. This publish button will be more visible for unpublished content since it will be red (danger) color. Hopefully people will notice it at first look. Note: It is implemented in a generic way so any 'o_switch' can be turned into this version by simply adding the 'o_switch_danger' class to it. task-44005 Closes #23282
2018-02-12[FIX] web{_site,_editor}: transparent root instance 'root widget'Alexandre Kühn
With this commit, any component that needs an instance of the root widget can simply require the module 'root.widget'. Based on the context (backend, frontend, iframe), the real root.widget will resolve to either the webclient, the website root instance, or the iframe root instance. This is desirable in order for the tour_manager to become a child of the root widget, as tours are enabled in any of the above contexts. This commit is a requirement in order to solve an issue with JS services, in which there should be only one service provider at any given time.
2018-01-17[FIX] web_editor, website: properly clean snippets before savingqsm-odoo
/!\ Partial backport of https://github.com/odoo/odoo/commit/0a31cb9b4ae461119ecafdd05c5b979621ffb039 /!\ Should not be forward-ported Before the websitepocalypse introduced in 11.0 (saas-17), when saving a page in the editor, every `cleanForSave` method of snippet options were called, even for snippet options which were not initialized (so if a snippet was left unchanged before saving, the related `cleanForSave` methods were called anyway). This behavior was bad code and did not make much sense and was so removed with the websitepocalypse (see https://github.com/odoo/odoo/commit/2972976962617d4b8a0113bae58c640ab41cdff8#diff-4c580abda3220e45c6b3f6bdcf77c733L415) Unfortunatly, the behavior was necessary given the states of our snippet options. Indeed, for the "latest posts" snippet, the `cleanForSave` method removes the entire snippet content (as it is dynamically loaded). The dynamic loading is performed by the snippet *animation*... and removing the dynamic content should logically be done by the animation too... which is the case. The problem is that animations are not stopped before the editor is saved. This behavior was only implemented in saas-11.1 (for future version 12.0) with commit https://github.com/odoo/odoo/commit/0a31cb9b4ae461119ecafdd05c5b979621ffb039 As a stable fix for 11.0, part of the mentioned commit is backported here and some specific `cleanForSave` will be reviewed as animations if necessary. Note: `cleanForSave` made useless by this commit are left anyway as this is a stable fix. See https://github.com/odoo/odoo/issues/22089
2017-12-01[MERGE] forward port branch 11.0 up to c201cf2b77cChristophe Simonis