Commit Graph
5889 Commits
Author SHA1 Message Date
qsm-odoo 20fd2e38c9 [FIX] website: restore simple drop zones
Commit https://github.com/odoo/odoo/commit/bb0cdec4594fab8c22265ed8af0c2d431a263b72#diff-e4ca107fe5c84ec39ba346fb90d1bdf6R76
added strange code affecting the whole editor when website_blog was
installed. To stay consistent, commit https://github.com/odoo/odoo/commit/80f54f563a3917828c5f67dfe9c44d0f6b0c5324
moved it in standard website and marked it as to review.

It is in fact the cause of a bug: *all* drop areas appeared with a big
editor text "Drag and drop a building block here" because of this code.

As a fix in stable, the problem was solved so that the code works as
intended: adding an editor message on a normal .oe_structure makes it
an .oe_structure.oe_empty automatically. Here in master, this code will
simply be removed and it will be up to the devs to not make errors in
their xml so that the editor messages appear. This commit in fact
keeps the "removing spaces" feature and enables it for all oe_structure.

Related to task-2210733

closes odoo/odoo#48463

X-original-commit: 5381e9d900b344e7d48a6b347c5fc551d433b15e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-27 09:59:28 +00:00
Victor Feyens 066214b36b [IMP] *: remove duplicate ACL targeting same group/model.
In the same xml file (meaning one of the two rule is useless, or wrong
if giving less rights than the other).

Removing rules that had no impact will ease the understanding of
security problems, by reducing the number of interconnecting rules.
2020-03-27 09:55:33 +01:00
Romain Derie a3fa70fd5f [FIX] website_event: restore edit menu choice
Website has a behavior that will ask you which menu you want to edit if you
click on 'Edit Menu' in the topbar and there is more than one menu in the DOM.

This is typically the case for the event pages where the event has its own menu
on top of the website one.

This event menu was not triggering that behavior since 5b563549fa where is
was accidentally broken.

closes odoo/odoo#48459

X-original-commit: 5c3c91e4a8da7b7b9f5e05f9c0ec5a6dea782d87
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-03-26 16:44:32 +00:00
Jeremy Kersten 26c4de2f18 [IMP] http_routing: use cached code from lang
In case of short controller that don't use qweb template, we don't need
anyhting else that this url code that don't change frequently.

It make only sense for model like lang, website, ... that will not change
frequently. And are called on each call by the dispatcher.

In case of a website page, we will btw browse lang later, but in case of
small controller like /favicon.ico, or page without qweb, ... we can just
use the same from last query.
2020-03-26 18:12:47 +00:00
Jeremy Kersten a65d27cce9 [IMP] website: perf - favicon.ico cached for 1 year
Note that this route is only used when no icon is set in DOM, such as accessing
a PDF after an order.

task-2211013
2020-03-26 18:12:47 +00:00
Jeremy Kersten 1606d22d40 [FIX] base: perf - binary_record, don't rebrowse ir.attachment
If model is already an ir.attachment we don't need to do a new search_read.
We can use it record directly.

After this commit, we don't do extra request if we already have the info,
else we don't change the behavior.

task-2211013
2020-03-26 18:12:47 +00:00
Jeremy KerstenandRomain Derie 6d6b505598 [IMP] website: perf - add cache for website frequent fields
The dispatching layer of Odoo (common to any call) can avoid a query on website
if those 3 values are cached.
Note that for complex business flows, there won't be any gain since website
infos will have to be fetched at some point.

About user_id:
In most cases, for a website page you will need to browse the website btw so
we don't remove this request previously. But in case of a simple image, the
controller /web/content need the public user just to set the request.uid in
auth_public but no other info from website.

With this commit, we don't do the 'select * from website where id in()'
request on each controller declared in auth='public' but use the user_id
from the cache. (Invalidated by the write on website_id)

task-2211013

Co-authored-by: Jérémy Kersten <jke@odoo.com>
Co-authored-by: Romain Derie <rde@odoo.com>
2020-03-26 18:12:50 +00:00
Romain Derie b03a4180be [REM] website: remove useless method
Was introduced with bae7e32e4b for `website_version` which doesn't exist
anymore.

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie bd4a44cece [IMP] base: perf - try/except instead of exists
Most of the time, the record exists, but we still ensure it does, every single
time, making an SQL query.
Doing a try catch will result in the same behavior, but won't make that query
most of the time.

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie 2c09e00a64 [IMP] website: perf - prefetch menus when serving a page
If we are rendering a page, the menus will most likely be rendered as well.
Note that even in a 403 case when the page is found but is not visible, the
menus will also be shown on the 403 page.

Fetching the menus before accessing the requested page will prefetch that page
as well in one go if that page is in the menus, without any costs for the pages
not in the menus.

There is a tradeoff for 'non-layout' pages, which only occurs in advanced
technical cases:
1. Create a page with specific extension as name suffix (page.css) in which
   case the page will be bootstraped accordingly, without call to layout.
2. Remove the call to layout in HTML editor or backend
3. Remove the call to submenus template in HTML editor or backend
For those cases, the menus will be prefetched for no reason.

Note that homepage '/' is rendered through a controller, same logic is applied
there.

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie 7ec403a1e3 [REM] website: remove unused qcontext keys
task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie d52c2bbe19 [IMP] website: perf - clear cache only when needed
Before this commit, the cache would always been cleared even if not needed.
Now, we only clear cache when needed.

Util:
Introduced with https://github.com/odoo/odoo/commit/9920f20e4c7753bc17bea71dea3a90f7de687196#diff-1407a8ce197a04eefaefa26c127a4418R327
Changed with 0d5fcdc1c7

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie a5a57321c7 [IMP] website: perf - reduce SQL queries for the website menu
Render page flow:
  - Search website.page in _serve_page for requested URL
  - Check if the page is visible with `is_visible`
  - `is_visible` will get the `ir.ui.view` of the page
    Note that this is not 'cachable' as being visible depends of now() for the
    publishing date
  - Render layout which is getting the website menus
    Note that this can't be cached either as a menu visibility might also
    depends of it's website.page visibility which depends of now()
  - Checking menus `is_visible` fetch the menus pages and those pages views.

Before this commit, every level of menu hierarchy would add 2 queries.
This can be avoided by prefetching everything in once during the dispatch if we
know we will render the website menu.
In such a case, read `is_visible` on every website menus will fetch every
pages, views and menus in the lowest SQL queries possible, eg one query for
every table.

For a 3 level menus, requests goes from 20 to 12 to load a untracked page.

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie af68fcde48 [IMP] website: clean and add perf tests
- Refactor for easier readability
  - Add a test to ensure menu hierarchy scale correctly.
  - Add tests for image controllers
  - Add test for assets controllers

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie 86b449ad48 [FIX] website: set correct m2o relation for home menu
When creating a website, we:
  1. Create the website
  2. Bootstrap a homepage
  3. Copy the generic menu hierarchy tree for that website

But since we just bootstraped a homepage for the website, the home menu was not
using that page but the generic one from the xml data instead.

That's an issue for tests recently introduced in master that needs the relation
to be correctly set for the query count to work as expected.

task-2211013
2020-03-26 18:06:02 +00:00
Benjamin Vray 34227348f0 [FIX] website: fix height and position of carousel indicators controls
In gallery snippet in carousel mode, fix the fact that the height of
the controls are bigger that the others squares and fix also the wrong
position of the indicators.

task-2162952

closes odoo/odoo#48380

X-original-commit: 9752596abfcae6b0bbf79ac675fe9e304a068a21
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-25 17:03:36 +00:00
Benjamin Vray e0dda5172e [FIX] website: fix an issue when changing width option in the gallery
As the container class now changes with the width option. We cannot use
this class in the js or css files anymore.

task-2162952

closes odoo/odoo#48377

X-original-commit: 1cf2ee35c2d85d87b27d5bd72c414e12fcbaf123
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-25 16:27:40 +00:00
Swapnesh Shah d805d73297 [FIX] website: make company required on website config
Before this commit, There would be a crash if the user tries to remove `website_company_id` from Website configuration as It is used in Backend.

With this commit, we make `website_company_id` required if the Website is set.

Fixes #47967

closes odoo/odoo#48175

X-original-commit: 940cc76ef3f301df91b60353e48cbaa5217bea93
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-03-23 10:43:29 +00:00
Thibault Delavallée 52ac7f2ddb [FIX] website(_crm): fix email and phone computation of visitor
Currently there are several limitations in visitor email and phone
computation, notably phone of partner is not taken into account (only mobile)
and computation does not work in website_crm if there are no leads.

In this commit we

  * support both mobile and phone fields of partner. Indeed generally all
    SMS flows check for those two fields and not only for mobile;
  * replace the SQL by standard ORM computation. As those fields are not stored
    and displayed in list views ORM should be capable of managing them;
  * avoid crash when creating visitors through the UI (no ids -> don't go
    into raw SQL);
  * correctly keep partner-based values when no lead is linked to the visitor;

Tests are also added in order to ensure behavior.

Task ID 2196869

closes odoo/odoo#48369

X-original-commit: 02ceb42e204be2b40b334b4e554eef6dfaffd228
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-25 15:51:25 +00:00
Benjamin Vray 95f30739a8 [FIX] website: keep images order in gallery snippet with masonry mode
Keep the same images order as the other modes in the gallery snippet
with masonry mode. Before this commit, the images order was reversed
with masonry mode.

task-2162952

closes odoo/odoo#44486

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-25 15:12:29 +00:00
Benjamin Vray 7da747c627 [IMP] website: add position top in cookie bar and fix a bug
Add position top in popup snippet and cookie bar.
Properly center content when full size and position center because
before this commit the content was at the top and not centered.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309

closes odoo/odoo#46503

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-24 16:07:26 +00:00
Benjamin Vray 079dac124a [IMP] website: move options in table of content snippet
Move position options in navbar.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:07:22 +00:00
Benjamin Vray 9ebc9a1a44 [IMP] website: review snippet Share
Reduces margin on icons when layout is none. Add icon size options.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:07:19 +00:00
Benjamin Vray efe8ea2676 [IMP] website: review progress bar snippet
Add an input field to define the value of the progress bar instead of
the previous system by mousedown. Disable animated by default.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:07:14 +00:00
Benjamin Vray c87f61d26b [IMP] web_editor, website: copy absolute path for anchor links
Copy the absolute path in the clipboard instead of the relative for
anchor links. So the link still works if it is pasted on another page.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:07:10 +00:00
Benjamin Vray a522e08273 [IMP] website: review timeline snippet
Removes option to move card to the right/left from the left panel
and add this option on the element overlay.
Makes the snippet responsive and other improvements.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:07:06 +00:00
Benjamin Vray 85a604635c [IMP] web_editor, website: preview container width on hover
Preview the boundaries of container elements when hovering over the 3
width options.

Part of https://github.com/odoo/odoo/pull/46503
task-2194309
2020-03-24 16:06:59 +00:00
Cocographique 22d0ca2905 [REF] website: remove useless option code in s_color_blocks_2 snippet
Part of https://github.com/odoo/odoo/pull/46809
task-2182909

closes odoo/odoo#46809

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-24 13:34:01 +00:00
Cocographique 50bce1da43 [FIX] website: adapt paragraphs styles of s_color_blocks_2 snippet
Part of https://github.com/odoo/odoo/pull/46809
task-2182909
2020-03-24 13:32:47 +00:00
Cocographique a5ca5d11ff [IMP] website: review bold style in Text Block snippet
Otherwise, when the user starts typing, this makes the text bold by
default.

Part of https://github.com/odoo/odoo/pull/46809
task-2182909
2020-03-24 13:20:01 +00:00
Cocographique b1048cb5ba [IMP] website: improve Alignment option wording and position
Part of https://github.com/odoo/odoo/pull/46809
task-2182909
2020-03-24 13:19:03 +00:00
Cocographique a91c6c8c4c [IMP] website: improve "Numbers of columns" option wording
Part of https://github.com/odoo/odoo/pull/46809
task-2182909
2020-03-24 13:16:19 +00:00
Cocographique 5dc2af38c3 [IMP] website: reduce space between icons in Rating snippet
Part of https://github.com/odoo/odoo/pull/46809
task-2182909
2020-03-24 13:14:14 +00:00
Thanh Dodeur 900dad016d [IMP] website, web_editor: add options to fully control shadows
task-2182909

closes odoo/odoo#46816

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-24 10:47:05 +00:00
Benjamin Vray 27b46767b2 [FIX] website: hide theme tab in left panel if the user has no rights
Hide theme tab in the left panel if the user does not have the rights.
Hide also header and footer options.

task-2199214

closes odoo/odoo#46627

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-23 15:41:47 +00:00
Jeremy Kersten 94f8f15036 [FIX] website: make handle_visibility private
This commit:
   - make handle_visibility a private function (even if not
     exploitable in rpc easily since it uses request.website)
   - encrypt the password in db (even if not critic, since this
     password could be shared on twitter, ... it doesn't cost anything
     to secure it a bit more)
   - remove useless sudo, since handle_visibility does a sudo itself.

In the future, this notion of visibility should be handled on controller layer,
and no more on the View layer (during rendering)

closes odoo/odoo#48145

X-original-commit: 06e0e48217f25f17dff23331111f5dcb98e8cecd
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-03-21 10:23:32 +00:00
Victor Feyens a3ded9043d [IMP] *: declare ir.rule in noupdate
ir.rule are default values but can be customized based on the
company's policy and needs.
This is typically a record that is in noupdate as should be
customization-friendly.
2020-03-20 16:21:25 +01:00
Vishnu Thuletiya d426a2cfca [FIX] website: Fix the 'unarchive' behaviour
Currently when the 'active' field is exist in model but when not added
to the view then it will only display the 'unarchive' options on action
and it does not works as well.

So Find out some model and to fix that behaviour added the active
invisible field on the view so archive/unarchive should works properly

closes odoo/odoo#46839

Taskid: 2204135
Related: https://github.com/odoo/enterprise/pull/9000
Related: odoo/enterprise#9000
Closes: #46839
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-20 12:18:05 +00:00
David Beguin 375b984cc7 [FIX] website : fix partner visitors field definition
visitor.partner is a many2one to partner. But partner.visitor_ids is a
many2many.

The result is when you set the partner_id on visitor, the (what should be)
inverse field is not set accordingly.

This inverse field should be a one2many fields. This commit fixes the field
definition.

Task ID: 2127691
PR #40577

Related: odoo/upgrade#905
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-20 09:09:57 +00:00
Romain Derie d47f039fd2 [FIX] website: clear cache when menu group is changed
Otherwise, `_get_menu_ids()` won't be recomputed, meaning removing a group from
a menu won't make it appear for restricted user, and adding a group on a menu
won't hide that menu, until a clear cache occurs.

Introduced with 02e01dce516

closes odoo/odoo#48065

X-original-commit: 0131e6d9103f68950ee23c6b0ef1af972370416e
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-03-19 18:25:09 +00:00
Romain Derie ffd6ebff72 [FIX] website: add SQL performance test for page loading
This will ensure the performances stay correct for a blank page (no layout),
a standard page and a homepage (which has its own controller).

Related to #47257
task-2211013

X-original-commit: 08e01b5fc4a71b8f7639a953137fbb546ddf3b3e
2020-03-19 15:37:49 +00:00
Jeremy Kersten 89bbf76c44 [FIX] website: perf - get most specific in SQL
Before this commit, we would get all the pages for the requested URL then
filter to get the most specific.
This can just be done in SQL by sorting website_id desc so the specific are
returned first.

Note that this will respect 41897f0dba.

This will avoid having to prefetch the generic page when it is useless.

Related to #47257
task-2211013

X-original-commit: b31294592a80d9e55f887f0122cc01225b64966c
2020-03-19 15:37:48 +00:00
Romain Derie b98d9c968c [FIX] website: perf - ormcache the website menus
To avoid a SQL Query on hot state, the website menus ids are now prefetch.

Related to #47257
task-2211013

X-original-commit: 73421c27f01e7100403eaa72e027c34dbdf9f720
2020-03-19 15:37:48 +00:00
Jeremy Kersten 4c40393490 [FIX] website: perf - translation - avoid query to find what we know
Before this commit, each module override _get_translation_frontend_modules_domain
from ir.http to add its own translation in website if needed and that module
is not starting by website_. Updating the domain from the super() call.
Since we know in most of the case the name, it is useless to do a:
   select name from module where name = 'name1' or name = 'name2'...

Now we support a new override of _get_translation_frontend_modules_name that will
allow to add the known module name directly in the list instead to make a search.

In case nobody override _get_translation_frontend_modules_domain, we don't need to
make an extra rpc to find the module.

Related to #47257
task-2211013

X-original-commit: 0dc54814161ab55c34dd2242f65dea23d19fdfca
2020-03-19 15:37:47 +00:00
Romain Derie e27eb978a6 [FIX] website: perf - don't force homepage on website in data
Let the homepage being set in bootstraping

Without this, any -i will set generic homepage as website homepage_id.
This is not really an issue for enduser as they probably don't do -i once
website is already installed.

But this code was useless anyway, as the homepage_id set in XML would be
overriden during bootstraping of the homepage in website create() override.

Note that this is important to have the correct homepage_id in DB, otherwise
it has to prefetch the generic homepage.

Related to #47257
task-2211013

X-original-commit: 385203d7632daeaab762c57319cc93b8312cc043
2020-03-19 15:37:46 +00:00
fja-odoo 124c3539aa [FIX] website: perf - prefetch access token to avoid extra request
Access_token has a restricted group, so it not fetched by defaut.

In our case, we know that after the first access to partner_id, that will fill
the cache without access_token, we will access access_token (so new query).

So we access first the access_token, to have only one request that fill the
cache with the access_token, and the partner_id used later.

Related to #47257
task-2211013

X-original-commit: 7dd69d10d00d5f4a7c12ec414d63f868a10683be
2020-03-19 15:37:46 +00:00
Jeremy Kersten 30f24d1ca7 [FIX] website: perf - don't search backend menu if you will not see it
Before this commit, in all cases, we search the backend menu to open if you
click on edit backend menu.
But the backend menu edit is useless for non editor user.

This feature has been introduce in v13, since eLearning have his own apps, so
when you edit in backend, you want to see the slide form view, into the
elearning app and no website App.

Related to #47257
task-2211013

X-original-commit: 1da7e53f4cdd82574688eb62f7a1cb8ddca871e6
2020-03-19 15:37:45 +00:00
Sébastien Theys 1d981f22f3 [FIX] website: perf - prefetch website.menu's mega_menu_content
Since this field is not sanitized, it is safe (perf wise) to prefetch it.
It should not be CPU heavy, plus whenever we access a `website.menu`, it is
most likely we will read that field.

with following structure, 5 SQL queries will be avoided:
- Top menu
  - Home
  - Contact us
    - Sub Contact us
      - Sub Sub Contact us

Related to #47257
task-2211013

X-original-commit: 20cddcd899e7a119fa9f365e62527499f8e5ff7d
2020-03-19 15:37:44 +00:00
Romain Derie f95af92ae3 [FIX] website: perf - prefetch every website menus in one go
Without this commit, the website menus would not be prefetch all in once.
Thus, every call to `submenu` template (called recursively) would do SQL
queries. One when accessing website.menu_id, then for every access on menu's
child_ids. It would also make an extra request for groups since the menus have
an ir.rule for that.

with following structure, 13 SQL queries will be avoided, regardless if there is
a group or not on the menus:
- Top menu
  - Home
  - Contact us
    - Sub Contact us
      - Sub Sub Contact us

Related to #47257
task-2211013

X-original-commit: 7fb016f9966bb5e2289ba17eacafb8887626514e
2020-03-19 15:37:44 +00:00
qsm-odoo 98c8438f52 [FIX] website: restore top menu transparent color option behavior
The option was not adapted correctly to the new left panel option
system, especially: not adapted to the use of a dedicated colorpicker
widget.

Part of https://github.com/odoo/odoo/pull/45093
task-2151408

X-original-commit: 39ed330ba635af7c81f03df2fdfe4309c95e05d9
2020-03-18 19:52:33 +00:00