Purpose
=======
This is the first huge step to improve the test suite in several ways:
- Make them demo data independent, allowing to modify the demo data without having to adapt the tests depending on it. It also allows to have a beautiful + convenient demo dataset to make a demonstration, and to configure complex data in the tests to manage the corner cases.
- Improve the test performances by converting them into SavepointCase. Each test will be rollbacked to it's initial state, after the setUpClass call. That way the different data are not re-created at each test for nothing.
- Introduce several test classes in base/tests/common.py to launch a TransactionCase, HttpCase or SavepointCase test with an available demo user, portal user or a large set of partners.
- This is the first step to tend to a rolling release process, allowing to execute the tests (or a subset of the tests) on a migrated base, for example.
closesodoo/odoo#39868
Taskid: 2075739
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this commit, when an user clicked on a control button to go to
another carousel slide, the overlay ended at the wrong position and
multiple scrollbars appeared. This occured because bootstrap fires the
'slid.bs.carousel' event too soon, because it emulates the transition
end event with a setTimeout. So on a normal computer, this occured:
- User click on control button, transition starts.
- slid.bs.carousel is fired -> we retarget the edition to the new active
slide and reposition the overlay... but that slide is still moving
as the transition is not really finished.
- The transition finishes, the overlay is at the wrong position, outside
of the screen.
Actually, this is more complex than than because our own system checks
transition end events to reposition the overlay. Even if unperfect,
we now have:
- User click on control button, transition starts.
- slide.bs.carousel is fired -> we enable the parent carousel instead of
the current slide (this DOM element is not moving).
- slid.bs.carousel is fired -> we know it is fired too soon, so we wait
an extra 20% of the time between 'slide' and 'slid' before retargeting
edition.
- The transition finishes, the overlay is still over the carousel and
not the active slide.
- Our extra 20% duration ends, we retarget edition to the current slide
and reposition the overlay (should not move since normally at the same
position as the carousel itself).
Part of https://github.com/odoo/odoo/pull/38997
task-2090180
Previously, the carousel and quotes carousel snippets were the only ones
that were not enclosed in section blocks. This had a number of
undesirable side effects, such as editing the anchor on the carousel
breaking the carousel functionality, and the inability to separately
choose a background for the carousel itself and individual slides.
I also used this opportunity to move controls relative to the entire
carousel onto the carousel itself rather than the individual slides. The
sizing_y (vertical padding) will however keep targeting individual
slides, as the carousel uses the height of its tallest slide, and also
because padding on the carousel will not get covered by slide
backgrounds and saty blank, which is unwanted.
Lastly, most of the snippet options for the carousel were rewritten, as
they were quite broken. There was some compatibility code for saas-3
left, some useless events were bound to the controls, even though they
were already handled through event-delegation at the document level.
Finally, most of the edition features were broken on duplicated
carousels since the onClone method wasn't reassigning most of the things
it needed to.
Part of https://github.com/odoo/odoo/pull/38997
task-2090180
In the editor, the snippets from uninstalled module are shown with the
possibility to install the module to get snippet.
Before this commit:
When clicking on it, it will redirect to the module page, in the backend from
where you can install the module.
Now:
A popup will be shown to save current changes and install the module.
The installation will be done without changing page, in the editor. Once done,
the page will reload in editor enabled mode.
task-2089285
closesodoo/odoo#39138
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
When loading a page on an existing starting database, registry is not
fully loaded causing potential error when trying to access model
existing in database (views, menitem, ...) since model added in last
loaded module does not exist in registry.
Thus, executing browser js test may lead to errors when executed during
an update on a database with other modules installed.
HTTPCase should be executed post_install to ensure that registry is
fully loaded to avoid this problem.
Since HTTPCase are slower than other test, it is also a good idea to
execute them at the end, in order to prioritize fast fail.
With this commit, a warning is isued if such a test class is tagged to
run at install time.
While at it, remove deprecated at_install and post_install helpers and
remove the deprecated phantom_js alias.
closesodoo/odoo#39462
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Before this commit, if you had a page_id set on a menu, and that you
fork this page, the page_id from the menu was always pointing to the
previous one, so you see old page, but edit new page.
> Reproduce:
> Fork Contactus (Page_id on menu become wrong)
> Refresh contact us (done on save btw)
> You see old content
> Edit with Html Editor, you sill see that forked view exists!
Bug was hidden before that we set page_id on menu, but it is needed if
we want to support the groups visibility on the menu item.
closesodoo/odoo#39472
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Now, you can define a Visibility mode between:
Public (All poeple)
Connected (Portal or Employee)
Restricted Group (Has this group or is Employee)
With Password (Know password or is Employee)
Internal Users (Is Employee)
It is a 'fair' feature, but without really warranty that the content is
really unreadable via others methods, ...
It is more for frontend display, that real secret. Dont use this like
a keychain ;)
We only catch the visibility on the main view and not the t-call inside.
Even if it should work on controller too, it is only display now on the
page property menu. (Or on the view directly in backend)
task-2091365
From now, you need to explicitely add sitemap=True if you want your controller
into the sitemap.
It's the default value, but if you forgot it, it will raise a Warning on runbot.
It will avoid wrong controller in sitemap and duplicate (empty) content.
From now, if your model contains a field website_id, the modelConverter for
sitemap will automatically add the domain:
"[('website_id', 'in', (False, current_website_id))]"
It avoid redundant declaration and ugly url in redirect/rewrite view.
Migration: need to remove it from url_from in website.rewrite
task-2065018
closesodoo/odoo#39427
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
* web_editor
Commit https://github.com/odoo/odoo/commit/7e2b0ebe7996c9fa35f75949b7fc8cd5a58d7c36
broke the website JS loading as it added a dependency to a lazy loaded
JS module which was not even always lazy loaded.
A test so that this does not happens anymore will be made in another
commit.
Related to task-2092386
closesodoo/odoo#39391
X-original-commit: 5ac269d722f9ff8c206215dd1c07b8544cfd5382
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
*: website
Inherited colorpicker were not used due to the context missing the
website_id and the method call being used instead of call_kw.
task-2092386
closesodoo/odoo#39357
X-original-commit: 7e2b0ebe7996c9fa35f75949b7fc8cd5a58d7c36
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
`_` is not available when loading this part of the template, leading to
an error on `_.str.trim()`.
We can simply use `trim()` to do so. By the way, `google_analytics_key`
is now trimmed automatically when adding it in the settings, so this is
only useful for migrated databases.
Fixes#38891
opw-2089296
closesodoo/odoo#39269
X-original-commit: a492047e9a064beecbe0611c3f7aef5172406eb1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Since saas-12.3, deferred actions use native promises. This has the
annoying side-effect of force-deferring promises even if they are
resolved at once... and we relied on the opposite behavior for some
call made in _setActive or option methods.
In master, we should review the async logic of snippet options. Right
now we will rely on the fact those promises are resolved at once but
that we need to avoid for their "async part" anyway. The _setActive
method and the option methods are thus still working synchronously in
stable, despite the new force-deferring promises.
Also, with old promises, when we waited for the resolution of multiple
deferred, the resolve handler received the multiple results as
individual arguments. Now it receives all the results in an array as
a single argument. The resolution of action demands had to be adapted.
closesodoo/odoo#39171
X-original-commit: 30d15315a73c1fa34ada86371b06c02b6375db89
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
You need to provide a small part of the code, because to avoid fraud, google
make several request to be sure that you don't allow all codes :)
So the 'WPS' solution was dropped, now we take the first request from google
that match the part provided, as the good one, and refuse all others requests.
task-2086915
closesodoo/odoo#39186
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
The XML file homepage view record is not supposed to be deleted as it is used
to bootstrap newly created website.
If that view is deleted, everything's fine. But if that view's page is not
found (m2o link broken somehow), then the code would crash.
This would only appear if the user is playing in the backend in technical but
it seems to happen more than it should.
This commit will prevent the code to crash in such a case.
Step to reproduce:
1. Go to settings > technical > views (debug)
2. Find the xml homepage view (with xml_id)
3. Go to its website.page and break the m2o view_id
4. Try to create a new website, it will crash
opw-2081894
closesodoo/odoo#39149
X-original-commit: 1d4dd200c664b99dbdb3e65e3950be1cb5e79a0a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Those tests were raising an assert error if the DB has other websites than the
data/demo ones.
As we have a new module in Odoo 13.0 (odoo/design-themes#178)
which is creating 25 websites, and since the design-themes runbot is now
running tests, we were having a red design-themes runbot.
closesodoo/odoo#39145
X-original-commit: 67df6b91ddb6cb83d558137691481f50834f7fca
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This test was raising an assert error if the DB has other websites than the
data/demo ones.
As we have a new module in Odoo 13.0 (https://github.com/odoo/design-themes/pull/178)
which is creating 25 websites, and since the design-themes runbot is now
running tests, we were having a red design-themes runbot.
closesodoo/odoo#39008
X-original-commit: 5c7b446363fbec7b2a76a579794e0fac20d05271
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Since 62c9dedafd, when accessing a website
connected as portal or public user, the themes images are not showed. An
error is arose 'Sorry, you are not allowed to access documents of type
'Attachment' (ir.attachment)'.
Now, the portal and public user have access to the themes images.
opw-2082468
closesodoo/odoo#39025
X-original-commit: 9b8c390cd5526556346356f260a9cfe1b90cd510
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Snippets with side margins look quite compressed between full width
snippets. This commit adds an option in the side-menu to control whether
a section is stretched or not. This option is available everywhere it
would have a reasonable visual impact (the cutoff was arbitrarily chosen
to be that the stretched section is at least 5% larger than the
unstretched version)
task-2080570
closesodoo/odoo#38852
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
A 404 will take 3 to 5 seconds to be resolved and execute +- 1900 query, to return
a rendered page which is quite expensive, especially when multiple missing images
are rendered in a view.
Catching static route and marking them as not frontend will help to avoid to handle miss
on static resources. In this case server returns a standard 404.
This commit also fix a iframe src in order to avoid a 404 on
/web/(test )/report/html/some_report (thx to aab-odoo)
X-original-commit: 818d0cb59fbae78d0edf06318082981f318e4db7
Before this commit launch a server with --db-filter that match at least 2 dbs name
Try to authenticate
You will have an error request is unbound when you try to access request.env
Now we retrieve the user from self instead of the request.
New test to ensure rpc authentication is tested.
Related to commit 245ef4b1
closesodoo/odoo#38969
X-original-commit: 4b3400c430bec7539aada0619fd203978daca2d8
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
The snippet was using the posts of all websites and blog post creation
was suggesting all blogs. Now:
- On blog post creation only suggest the blogs of the current website
- In latest posts option, only suggest blogs of the current website
- In any case, latest posts only displays posts of the current website
Part of https://github.com/odoo/odoo/pull/38510
Related to task-2083198
closesodoo/odoo#38794
X-original-commit: 4be97b48861a6631fe465054c62baea65bfc1524
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Test case;
The user as edition rights on the website
Install quotation builder
Have a sale order with many lines
Click preview > you end up on the portal view
Before this commit, there was a blank space just before the
sale order lines per se
This was because the sale order's lines website description
were in the dom and took some fixed space, which is a feature
meant for the edit mode by using the class oe_no_empty
After this commit, we restrict the effect of that class concerning
the fixed height only to edit mode
There is no more gaps in the sale order preview
In master, one should check whether the class / rule is still relevant
OPW 2082267
closesodoo/odoo#38435
X-original-commit: 4b177412235cdf3e62f5ff30c18246c003c25cc2
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Follow up of commit a3845ae3f0
Issue
=====
Since the above commit there is a confirmation dialog when clicking on a button,
for which the only options are to Discard or Cancel.
The problem is that when discarding it will revert the selected website back to
the default value. Therefore before the current commit it is impossible to
install a theme on a website other than the first.
Solution
========
The solution is to avoid showing this dialog when clicking on buttons for which
the result depends on the currently selected website. This leads to the same
behavior as what existed before the mentioned commit: the settings are
implicitly discarded because they are not saved, but at the time of the click
the transient model still holds the non-discarded value that the user selected.
This restores the "select a theme" feature, but also restores the unfortunate
side effect that the user might unknowingly loose all of his pending changes
when clicking on the button, but only for those two specific buttons.
Other considerations
====================
Saving instead of Discarding was considered but it is impossible to do because
saving might do a lot of changes that might even lead to the installation of
modules, so the settings page has to be reloaded to apply them, and then the
website field will be reset to its default value again.
Instead of changing website specific settings from the main settings, it was
considered to update them through a form view, but it is apparently too
complicated for on-boarding.
The last consideration was that the settings view should actually mark the
corresponding fields as unchanged when changing the website, but it is too
complex to implement for a case that is not supported in the first place,
especially for a fix in a stable version.
task-2083198
closesodoo/odoo#38745
X-original-commit: 2298ef19bcd9e7a14958dce9a93cea69258064d8
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
When you try to create two users with the same login, the shown error message is
the Postgresql integrity error instead of a nice (translated) validation error.
This happens since bf88f3e which changed the way error messages are translated.
The reason is the manually created unique index `res_users_login_key_unique_website_index`.
The error handling and translation mechanisms don't know it exists.
The index was created for performance reasons in commit b5a12b4 where the
original python constraint was replaced with this custom SQL index.
In this commit, the python constraint is re-introduced to remove the index hack,
but the implementation now uses a single SQL query, which should be quite fast.
closesodoo/odoo#38737
X-original-commit: 817a811ec98b0c313b12e6464b5e98ca432cb3fc
Signed-off-by: Christophe Simonis <chs@odoo.com>
This is necessary when writing view fields from a page record because the
generic page will put the given values on its cache but in reality the values
were only meant to go on the specific page. Invalidate all fields and not only
those in vals because other fields could have been changed implicitly too.
Pr: #37363
X-original-commit: 83f9a3e2608db34a319b985271d73f7de5bc73a1
Install the website, install a second language.
Switch the language on the website: error 500.
The function opened a new cursor, to update website_visitor.
It did so at the end of the query dispatch.
However when switching the language of the website, the lang is written on the
website visitor. This is done at the flush, done at the end (exit) of the query.
This is done on the cursor that was used for all the transaction.
Therefore that write would systemically fail on a
ERROR: could not serialize access due to concurrent update
opw 2080986
closesodoo/odoo#38453
X-original-commit: cc88a36744dc3c2949c47e8b163e1de98f5dbd95
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
In the backend, when a mailing popup was being edited, it was not
centered in the edition area (and went under the editor UI) and was not
using the correct style.
task-2083465
closesodoo/odoo#38449
X-original-commit: 6ccf3b618b4b0774deccb4f75bf33f3ea4dc8b75
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
When a background video was used in a mega menu, it was only working in
edit mode. Indeed, the background video size is computed on page load
(and on window resize) but as the video is inside a hidden dropdown
menu in this case, the size cannot be properly computed.
This commit fixes the issue by recomputing the video size on dropdown
menu opening.
task-2080590
closesodoo/odoo#38314
X-original-commit: 66ec1c19b63fe26e559ed2d8d7359df974ade789
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
* web_editor
The purpose is to force our dropdown style in our UI so that themes do
not break it anymore (same way all the other elements are forced (cards,
headings, etc)).
task-2059538
closesodoo/odoo#38321
X-original-commit: 4ef0eac5ba134f462f72f3e9c60e5c9fc95f3a8c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
.. and first menu is a container with # as url.
There is a particular case where the / url would loop endlessly.
1. Unpublished the homepage /
2. Edit the menu so the first menu is a container. There is a hint telling you
a container menu should have its URL set to `#` as a good practice.
3. This will lead to endless loop for public user as the code will check if the
homepage can be accessed. Since it is unpublished, it will then fallback on
the first menu which is not '/' and redirect to it.
Sadly, the code was not expecting `#` to be handled as `/`.
opw-2081969
closesodoo/odoo#38234
X-original-commit: cff11bdb66f1dda41cf333a28b67df7ef20a3de9
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since commit 07631a5, category has been updated, but not the filter of this action
task-2081177
closesodoo/odoo#38223
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Missing diff in last commit.
redirect_301 -> has been renamed to 301
redirect_302 -> has been renamed to 302
rewrite -> has been renamed to 308
not_found -> has been renamed to 404
To be coherent everywhere and because this value is used as http code into
the werkzeug redirect call.
closesodoo/odoo#38061
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
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>
*base, website_blog, website_event, website_forum, website_slides
With this commit:
1. It is now possible to add the 'Edit in backend' entry in the frontend navbar
for any desired model, not only the ones which have the published mixin.
It will simply redirect to the main_object form view.
This commit add it to Forum and Blog.
2. When clicking on 'Edit in backend', it is now possible to land on another
module than Website.
That's especially useful for events and slides which are not directly
related to the website module as they have their own module.
3. Remove the custom Edit in backend from the forum homepage (fa-cog).
Opportunity was also taken to remove the 'edit welcome message'.
It will now be editable through the editor (welcome message will appear in
edit mode). Thus we got rid of the custom edit welcome message controller
and views.
Closes#36325
Without this commit, connection with mobile app crash
since there are no uid set on the env.
_is_public_user expecting singleton.
closesodoo/odoo#37756
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
* = portal, website, test_website, account, sms
Portal an Survey error pages were ugly default pages.
Now the error pages will be the same as the website ones.
Also fixing single module builds tests
task-2059969
closesodoo/odoo#35535
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Redirect_type was renamed from 3xx to redirect_3xx, but name is used as http
status code. It is better a redirect(301) instead of redirect(redirect_301)
Re-add the bind_to_environ, it was removed because it seems not useful, but
once you are behind a proxy, werkzeug need the environ to find the correct
hostname and more ... Transformed relative url into absolute by werkzeug was
wrong.
closesodoo/odoo#37733
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>