Skip to content
Snippets Groups Projects
Commit 35c144c2 authored by Lucas Lefèvre's avatar Lucas Lefèvre
Browse files

[FIX] lunch: Cache lunch product images


Images of the lunch dashboard are not cached by the browser.

closes odoo/odoo#47427

X-original-commit: fec2e2a4
Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent 82987124
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, tools
from odoo import api, fields, models, tools
from odoo.osv import expression
......@@ -41,6 +41,17 @@ class LunchProductReport(models.Model):
else:
product_r.image_128 = False
def compute_concurrency_field(self):
"""Image caching is based on the `__last_update` field (=self.CONCURRENCY_CHECK_FIELD)
But the image is never cached by the browser because the value fallbacks to
`now` when access logging is disabled. This override sets a "real" value based on the
product or category last update.
"""
for report in self:
product_last_update = report.product_id[self.CONCURRENCY_CHECK_FIELD]
category_last_update = report.category_id[self.CONCURRENCY_CHECK_FIELD]
report[self.CONCURRENCY_CHECK_FIELD] = max(product_last_update, category_last_update)
def _compute_is_available_at(self):
"""
Is available_at is always false when browsing it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment