Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Customer Rating

Entity: rating.rating

Compute Method: _compute_rating_image

View 17.0 View 19.0
Inputs Method Outputs
self.rating_image_url = False
self.rating_image = False
for rating in self:
            image_path = f'rating/static/src/img/{rating._get_rating_image_filename()}'
            rating.rating_image_url = f'/{image_path}'
            try:
-                 rating.rating_image = base64.b64encode(
-                     file_open(image_path, 'rb', filter_ext=('.png',)).read())
-             except (IOError, OSError, FileNotFoundError):
+                 with file_open(image_path, 'rb', filter_ext=('.png',)) as f:
+                     rating.rating_image = base64.b64encode(f.read())
+             except OSError:
                rating.rating_image = False
  • rating_image_url
  • rating_image

Back to entity