diff options
| author | Lucas Lefèvre <lul@odoo.com> | 2020-03-06 15:48:16 +0000 |
|---|---|---|
| committer | Lucas Lefèvre <lul@odoo.com> | 2020-03-11 16:05:07 +0000 |
| commit | 35c144c28ad9f3715b408b6d8aaec939972a5e8d (patch) | |
| tree | 5a8eb2d7a2d9262e815fd0249df6ce3c34ad9077 /addons | |
| parent | 8298712468ec81b9a8ba3e76e1bf1f1f56e153ab (diff) | |
[FIX] lunch: Cache lunch product images
Images of the lunch dashboard are not cached by the browser.
closes odoo/odoo#47427
X-original-commit: fec2e2a49faa69d2ce554e62a3de196573fa3656
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/lunch/report/lunch_product_report.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/addons/lunch/report/lunch_product_report.py b/addons/lunch/report/lunch_product_report.py index 8ff8858487f..44953be8930 100644 --- a/addons/lunch/report/lunch_product_report.py +++ b/addons/lunch/report/lunch_product_report.py @@ -1,7 +1,7 @@ # -*- 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 |
