Since odoo/odoo@04e972660b
The session `modified` flag has been renamed `is_dirty`.
However, it has not been renamed correctly in these
three different places.
The goal to set `modified` at this three places
is to force the session to be saved,
for instance because a mutable (a list or a dict)
contained in the session was modified,
but not the dict of the session itself,
therefore `modified` is not flagged automatically.
As the flag `modified` has not been renamed to `is_dirty`,
a key/value `modified: True` was actually assigned to the
session dict, and saved in file. The behavior
to save the session in these three places was kept,
as one key/value of the session has been changed,
but by the way to assign a new value in the session file,
which is not ideal.
It's better to assign the correct flag to avoid
setting a new key/value in the session for no reason.
closesodoo/odoo#118719
X-original-commit: b6f4a27f2d95d5bc5510f4da50132ab66d8c86aa
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Before this commit, following these steps:
- Go to /blog
- Enable the customize option 'Top banner - Name / Latest Post'
- Disable the customize option 'Full-Width Cover'
- Search for the word 'helicopter' in the blog post search bar
Two problems are then visible:
1) The top banner is always visible with a blog post that does not match
the search. This top banner should not be visible (like for tag and date
searches).
2) There is an alert message 'No results for "helicopter".' while the
blog post 'Maui helicopter tours' matches the search.
This commit corrects both errors.
task-3058239
X-original-commit: c28cf4b44c4fd9a1800d5fb1ad6e8c734feb9057
Part-of: odoo/odoo#114253
With DB having only one blog (most common case, but we are used to test
it with demo data where we have two), the query params are lost when
accessing the blog controller without passing a blog.
Eg, `/blog?search=hubble` will redirect to `/blog/travel-1`
This is because the business code is doing an early redirect if we
access the `/blog` URL without a blog post passed to it to redirect to
that blog post URL directly (since there is only one), but that redirect
is not passing the query parameters.
The main impacted params are `state`, `order` and `search` but it's the
same for all others.
Step to reproduce (in later version):
- Be sure to only have one blog
- Drag & drop the search snippet in the homepage or anywhere
- Make it search on blog only (through the snippet option)
Type anything, it will not work and won't do the search. It will just
redirect to the blog page.
closesodoo/odoo#114107
X-original-commit: 41c27fd4912fb9f50ce5f31fff7c17c77b8530f7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since [this commit], following these steps:
- Go to /blog
- Activate the sidebar option
- Select a date filter on the sidebar
=> An error occurs.
The bug comes from the fact that since [this commit], some arguments
were passed twice to a function which causes a python error. The fix is
just to not pass the same argument several times.
[this commit]: https://github.com/odoo/odoo/commit/f2e20e5377a6604084aaf509f57614d7fbf263e5
Related to opw-2882492
closesodoo/odoo#104639
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Before this commit, following these steps:
- Go to /blog
- Activate the option Customize > Top banner - Name / Latest Post
- Disable the option Customize > Full Width Cover
- Click on the "guides" tag of the "Buying A Telescope" blog
No blog is displayed. This was because the top banner post is not shown
when the posts are filtered. Basically, once filtered, a blog post was
always missing.
Related to opw-2882492
X-original-commit: ee2f778abb8b7a6e221e05361bc7b964593d1123
Part-of: odoo/odoo#104639
Before this commit, following these steps:
- Go to /blog
- Activate the option Customize > Top banner - Name / Latest Post
- Disable the option Customize > Full Width Cover
The URL to which we are redirected when we click on the category of the
post presented at the top of the page leads to an error. In order to fix
the wrong url we had to patch QueryURL so that the url prefix is added
only if the url does not already start with the prefix.
opw-2882492
X-original-commit: https://github.com/odoo/odoo/commit/2b326de107b9b7a2013ee9ff174d81b645d6a623
Part-of: odoo/odoo#104639
*: website_blog, website_event, website_forum, website_slides
With [1] it has been made easier for partners to extend search options.
This task introduces similar inheritable functions for blog posts,
events, forum posts, slides, pages and hybrid results.
[1]: https://github.com/odoo/odoo/commit/d29f2f3ac5f8c3e8109287e0933609bdbe0cadb1
task-2897924
closesodoo/odoo#97908
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
*: base, mrp_account, product, mail, website_blog, website_event,
website_forum
This commit improves the button that allows to go to the backend view of
an object when you are on its corresponding page on the website. The
button is more visible and the user can see which object he is going to
edit. Note that this commit also:
- Changes the access key to translate a website page to ALT + T.
- Adds a new access key to edit an object in backend with ALT + E.
- Removes the possibility to duplicate a blog post (but this feature
will be reintroduced later for all models, generically) **.
**: Note that the duplication of blog posts actually had a mistake:
The controller to create a new blog post has been added with [1] where
it has been decided to not be a follower of the blog posts at their
creation. A new controller has been added by [2] to be able to duplicate
a blog post, to be consistent with [1], here also the user does not
become a follower of the new blog post (the copy). So far, so good.
Finally, [3] has changed the blog post creation controller so that the
user who creates the blog post is a follower of the new blog post.
Unfortunately the same change was not made for the duplicate controller,
which is a mistake. There is no reason to be a follower of the newly
created blog posts when you go through the add blog post controller but
not when you go through the duplication controller. The behaviors should
be consistent and there is no reason for there to be a difference.
[1]: https://github.com/odoo/odoo/commit/4c3b516a7b988d758a67ff19242e8ed0837d756c
[2]: https://github.com/odoo/odoo/commit/fe40538aff2b65f7719840c8e2d6e51e858f560f
[3]: https://github.com/odoo/odoo/commit/4bf9dc4078a5ca413539a6fd16400fd5aad46907
task-2889929
closesodoo/odoo#97353
Related: odoo/enterprise#30075
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
* = blog, forum, slides
For performance reasons, allow to increment multiple fields of the same record
within the same query.
With python tests.
Task-2663320
Part of odoo/odoo#79615
If you delete a tag, but still have some link to this one, you arrive on
a 404 /blog/tag/.
We decide to redirect to the blog post without tag instead.
What is probably the expected behaviour for most customers.
closesodoo/odoo#98087
X-original-commit: 041ad20824e57b0850d7c74ca2ddbeab7f38990b
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
*: website_blog, website_hr_recruitment, website_sale, website_slides
This commit changes the redirections from the controllers, that were
always redirecting to the frontend before.
Now, we want to open the website in its backend client action most of
the time (for example, when clicking on the "go to website" buttons on
the form views).
For that, a new get_client_action_url is introduced on the website
model.
See merge commit for more information.
task-2687506
*: website_blog, website_customer, website_event_exhibitor,
website_event_track, website_hr_recruitment, website_sale,
website_slides
See merge commit for more information.
task-2687506
Using lazy values allows you to not do query when the content is not
displayed or if it is already cached. Adding `t-cache` only reduces
render time, but combining it with lazy values saves browses, computes
and query.
Thus for the `/shop` page the page is displayed in 60ms (before: 250ms).
Part-of: odoo/odoo#88276
steps to reproduce:
- install blog
- create more than 12 articles with at least on word (the one we will search for)
- Go to the "blog" menu of the website
- Go in the search field
- Search for the word in the created articles
-> Odoo removes the search criteria on the blog (Website) + number of results is inconsistent
OPW-2720355
closesodoo/odoo#83031
X-original-commit: bc2ed4a5f0997929930e3f279e5e1347818f8880
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
(*: website_blog, website_event, website_forum, website_sale,
website_slides)
Before this commit the search bar was specific to products.
After this commit a generic search bar is available as a general feature
of website which can be configured to inspect specific models.
The snippet is used to replace the old search bar in blog, courses,
event, forum, page and shop.
The search results of these pages and the autocomplete of the search bar
run through the same search mechanism.
A new hybrid results page has also been created as a target of a search
on "Everything".
In each involved module, `website._search_get_details()` is implemented
to return search metadata for every model related to the `search_type`
parameter.
Search metadata for a single model is returned by `_search_get_detail()`
on that specific model.
The autocomplete runs through the additional
`website._search_render_results()` pre-rendering step that prepares the
data to fit in the autocomplete template.
task-2379555
https://github.com/odoo/odoo/pull/65871
Part-of: odoo/odoo#65871
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.
We removed redirect_with_hash that was only for retro compatibility
local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.
Default code for redirect is 303 now instead of 302.
Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.
All werkeug.utils.redirect has been replaced by request.redirect.
Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.
Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.
Migrate your code:
http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect
Courtesy of odony for help and review ;)
closesodoo/odoo#72599
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Steps to reproduce the bug:
- Go to website app > configuration
- Set the visibility of all the blog to Website A (So that it's not visible on Website B)
- Go to the Blog menu of Website B
- A traceback is triggered
Problem:
The `all_tags` function calls an SQL query to get the tags related to the website blog
with a where condition based on the blog_id. But since there is no blog linked to the site.
The request fails and an error is raised.
Solution:
Do not load the tags, if there is no blog for the website.
Opw-2545315
closesodoo/odoo#72636
X-original-commit: 4d8fc86e4e6beb2171e3bebbabd532086d884d59
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
Steps to reproduce the bug:
- Create a blogpost in the the blog 'travel
- Archive the blog 'travel'
- Open the blogpost
Bug:
A traceback was raised
opw:2444406
closesodoo/odoo#65576
X-original-commit: 196d96ef8eaf8aa06e16c9768ed595fca1c315ff
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Before this commit, routes were prevented to be accessed if the route model was
not accessible from the current website, eg you couldn't access blog1 which is
set to website2 from website 1.
That would raise a 404 even from admin/editor.
This commit introduce that behavior at a lowel level in a generic way, instead
of having to write it on every route.
Note that routes without a model converter won't benefit from this.
Closes#63499closesodoo/odoo#64313
Related: odoo/enterprise#15688
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
*blog, forum, slides
Based on https://github.com/odoo/odoo/pull/48552#discussion_r440061218 suggestion
Add a new method 'increment_skip_lock' in tools.sql to allow to easily
increment a specific field of 1 if the record is not locked.
The method return boolean if at least 1 record has been incremented.
closesodoo/odoo#58765
X-original-commit: d92e61e89f468c2db2fbd68b2f0d6b36c77f1065
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Purpose of the retro-compatibility route was to redirect the old to the new.
And not redirect to themself and create a loop
closesodoo/odoo#58672
X-original-commit: b5e1bafeb42e94b587c245e9e7aa844770a129c6
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
*: website
As there was no way to search a blog post, it could be hard for someone
to find a particular post if there was a lot of blog post for example.
Part of https://github.com/odoo/odoo/pull/52759
task-2267693
Co-authored-by: qsm-odoo <qsm@odoo.com>
Url for a product become:
/shop/productname-id instead of /shop/product/productname-id
Url for a blog post become:
/blog/blogname-1/blogpost-1 instead of /blog/blogname-1/post/blogpost-1
Url for a question on forum become:
/forum/forumname-1/title-1 instead of /forum/forumname-1/question/title-1
task-2295016
As we introduced postlinks, some routes are no longer compatible with
GET requests anymore. Some of those routes were using the pager which
only send GET request. In order to make the pager comptabile, we're
addding a way to use postlinks in the pager.
task-2250385
closesodoo/odoo#52475
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id
Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
Avoid extra call to session_store.save if we don't touch to the session
Use an explicit name to storage post_viewed in the session
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
`tags_list()` is called in loops to get nicely formatted URL in blog tag button
but doing an exists here will do everytime an SQL query regardless of the
cache.
We can safely remove the call to `exists()` as the `tag_ids` parameter is
coming from the controller `active_tag_ids` key which is already ensuring the
exists condition.
It make also the number of requests determinists for test with a random number
of tags. From between 200 ~ 300 queries (depending number of tags)-> 116
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
Most of the website rendering process depends of customize_show views which are
part of a configuration setup.
Once it has been setup, it will most likely never change afterward.
It makes sense to orm cache those infos to avoid having to query ir.ui.view
table everytime we render something.
Note that just store basic and small infos used for customize_show case.
task-2211013
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
* website_blog, website_event_track, website_forum, website_mail_channel
7dd70438e1 was introduced in stable as a fix, which obviously had some stable
policy preventing some changes.
This commit improves that commit in master.
task-2119086
closesodoo/odoo#45622
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Before this commit in case you start on blog with url like /blog/blog-1/tag/2,
you should be redirected to /blog/blog-1/tag/website-2 to avoid duplicate
content.
But because the replace was done with /tag/%s/ it will be not replaced and so
you are redirected to the same url, creating a loop.
closesodoo/odoo#45927
X-original-commit: 666306326cecc6ac8587b45d2dbf24c0463b33a5
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Before this commit, if you have a link with a tag that doesn't exists anymore,
you will have a traceback because you try to access to a unexisting record.
odoo.exceptions.MissingError:
('Record does not exist or has been deleted.\n\n(Records: [3], User: 2)', None)
Now, we filter on existing tag before to access a field.
X-original-commit: 54b45e5c287138a87a0b04ce4f301ea6893b9223
- When browsing the blogs, in some cases the code need
to fix the URL to properly slugify the tags.
When so, the code crashes since it is trying to maniapulate
a `werkzeug.wrappers.Response` as if it was a `dict`.
To avoid this, we directly return the `werkzeug.wrappers.Response`
instead of trying to modify it.
closesodoo/odoo#45658
X-original-commit: d26ba7e4b71138a324bbb729f406cbad562881e7
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Issue
- Install Blog
- Create a post
- Remember the last update date
- Visit the post
- Check the last update date
After visiting the post, the last update date changed.
Cause
In the web_blog main.py controller, we increase the visit
count with a write, so the write_date is updated.
Solution
Keep the old write_date by forcing it.
OPW-2166289
closesodoo/odoo#42954
X-original-commit: 16843c63b97cda746972526f8933bf25b435d585
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
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>
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>
Indeed, a theme can declare its own latest posts template so it would
crash with ref instead of viewref.
Part of https://github.com/odoo/odoo/pull/38510
Related to task-2083198
X-original-commit: 755944f6b88b069515881c9ec58e72e7a0cdd762
Before this commit, if you archive a blog, you will have a 500 instead of 404.
Serve page to show the 404 use request.website, so we need to force controller
with website=True to bind website on the request.
Probably need to check all controllers in website_* module.
opw-2066725
closesodoo/odoo#38539
X-original-commit: 74341c4fcba701fe5ce7ee742880bbf138131a0d
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
en_US may not be activated as it is possible to create a database in
another language using the database manager.
When trying to install a chart of account, the tax return entry tried
to format a date at the installation of the module, with no lang in
the context. The fallback was made on en_US but an error is raised if
that language is not activated.
As it is a very common scenario to retrieve a language from the
context, add a generic tool method to do it.
Replace and closesodoo/odoo#37629closesodoo/odoo#37568
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>