[FIX] *: session.modified has been renamed is_dirty

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.

closes odoo/odoo#118719

X-original-commit: b6f4a27f2d95d5bc5510f4da50132ab66d8c86aa
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
This commit is contained in:
Denis Ledoux
2023-04-17 11:47:15 +02:00
parent eca72b05fa
commit 1480f2fad5
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -8,5 +8,5 @@ from odoo.http import request
class HrAttendance(http.Controller):
@http.route('/hr_attendance/kiosk_keepalive', auth='user', type='json')
def kiosk_keepalive(self):
request.httprequest.session.modified = True
request.session.touch()
return {}
+1 -1
View File
@@ -306,5 +306,5 @@ class WebsiteBlog(http.Controller):
if not request.session.get('posts_viewed'):
request.session['posts_viewed'] = []
request.session['posts_viewed'].append(blog_post.id)
request.session.modified = True
request.session.touch()
return response
@@ -54,7 +54,7 @@ class WebsiteSaleWishlist(WebsiteSale):
wish_ids = request.session.get('wishlist_ids') or []
if wish.id in wish_ids:
request.session['wishlist_ids'].remove(wish.id)
request.session.modified = True
request.session.touch()
wish.sudo().unlink()
else:
wish.unlink()