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
closesodoo/odoo#48463
X-original-commit: 5381e9d900b344e7d48a6b347c5fc551d433b15e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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.
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.
closesodoo/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>
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.
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
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>
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
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
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
- 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
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
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
closesodoo/odoo#48380
X-original-commit: 9752596abfcae6b0bbf79ac675fe9e304a068a21
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
As the container class now changes with the width option. We cannot use
this class in the js or css files anymore.
task-2162952
closesodoo/odoo#48377
X-original-commit: 1cf2ee35c2d85d87b27d5bd72c414e12fcbaf123
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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#47967closesodoo/odoo#48175
X-original-commit: 940cc76ef3f301df91b60353e48cbaa5217bea93
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
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
closesodoo/odoo#48369
X-original-commit: 02ceb42e204be2b40b334b4e554eef6dfaffd228
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
closesodoo/odoo#44486
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#46503
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
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
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
Hide theme tab in the left panel if the user does not have the rights.
Hide also header and footer options.
task-2199214
closesodoo/odoo#46627
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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)
closesodoo/odoo#48145
X-original-commit: 06e0e48217f25f17dff23331111f5dcb98e8cecd
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
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.
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
closesodoo/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>
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>
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
closesodoo/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>
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
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
To avoid a SQL Query on hot state, the website menus ids are now prefetch.
Related to #47257
task-2211013
X-original-commit: 73421c27f01e7100403eaa72e027c34dbdf9f720
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
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
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
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
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
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
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