details:   https://code.tryton.org/tryton/commit/619fd425e3bb
branch:    default
user:      Cédric Krier <[email protected]>
date:      Fri Dec 19 09:39:32 2025 +0100
description:
        Use always the immutable value from the cache

        This prevents issues like #14433 from being missed.
diffstat:

 modules/account_payment_braintree/account.py          |   3 +-
 modules/account_payment_stripe/payment.py             |   6 +--
 modules/attendance/attendance.py                      |   2 +-
 modules/company/res.py                                |   7 +---
 modules/party/address.py                              |   6 +--
 modules/product_price_list_cache/product.py           |   3 +-
 modules/product_price_list_cache/tests/test_module.py |   2 +-
 modules/project/work.py                               |   6 +--
 modules/stock/location.py                             |   2 +-
 modules/stock_package_shipping_sendcloud/carrier.py   |   6 +--
 modules/timesheet_cost/company.py                     |   3 +-
 modules/web_shop_shopify/web.py                       |   3 +-
 trytond/doc/ref/cache.rst                             |   2 +-
 trytond/trytond/cache.py                              |   3 +-
 trytond/trytond/ir/action.py                          |  18 ++++-------
 trytond/trytond/ir/configuration.py                   |   3 +-
 trytond/trytond/ir/lang.py                            |  11 ++++---
 trytond/trytond/ir/message.py                         |   4 +-
 trytond/trytond/ir/model.py                           |  27 +++++++-----------
 trytond/trytond/ir/rule.py                            |   3 +-
 trytond/trytond/ir/translation.py                     |   3 +-
 trytond/trytond/ir/ui/view.py                         |   5 +--
 trytond/trytond/model/dictschema.py                   |   3 +-
 trytond/trytond/model/digits.py                       |   3 +-
 trytond/trytond/model/modelsql.py                     |   2 +-
 trytond/trytond/model/modelstorage.py                 |   2 +-
 trytond/trytond/model/modelview.py                    |  10 ++----
 trytond/trytond/report/report.py                      |   2 +-
 trytond/trytond/res/user.py                           |   3 +-
 29 files changed, 63 insertions(+), 90 deletions(-)

diffs (610 lines):

diff -r 9c7de9240347 -r 619fd425e3bb 
modules/account_payment_braintree/account.py
--- a/modules/account_payment_braintree/account.py      Fri Dec 12 15:31:45 
2025 +0100
+++ b/modules/account_payment_braintree/account.py      Fri Dec 19 09:39:32 
2025 +0100
@@ -1170,8 +1170,7 @@
             for payment_method in customer.payment_methods:
                 name = self._payment_method_name(payment_method)
                 methods.append((payment_method.token, name))
-            self._payment_methods_cache.set(self.id, methods)
-        return methods
+        return self._payment_methods_cache.set(self.id, methods)
 
     def _payment_method_name(cls, payment_method):
         name = payment_method.token
diff -r 9c7de9240347 -r 619fd425e3bb modules/account_payment_stripe/payment.py
--- a/modules/account_payment_stripe/payment.py Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/account_payment_stripe/payment.py Fri Dec 19 09:39:32 2025 +0100
@@ -1712,8 +1712,7 @@
                 else:
                     continue
                 sources.append((source.id, name))
-            self._sources_cache.set(self.id, sources)
-        return sources
+        return self._sources_cache.set(self.id, sources)
 
     @classmethod
     def _source_name(cls, source):
@@ -1779,8 +1778,7 @@
             for payment_method in payment_methods:
                 name = self._payment_method_name(payment_method)
                 methods.append((payment_method.id, name))
-        self._payment_methods_cache.set(self.id, methods)
-        return methods
+        return self._payment_methods_cache.set(self.id, methods)
 
     @classmethod
     def _payment_method_name(cls, payment_method):
diff -r 9c7de9240347 -r 619fd425e3bb modules/attendance/attendance.py
--- a/modules/attendance/attendance.py  Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/attendance/attendance.py  Fri Dec 19 09:39:32 2025 +0100
@@ -210,7 +210,7 @@
                 result = record.ends_at
             else:
                 result = None
-            cls._last_period_cache.set(key, result)
+            result = cls._last_period_cache.set(key, result)
         return result
 
     @classmethod
diff -r 9c7de9240347 -r 619fd425e3bb modules/company/res.py
--- a/modules/company/res.py    Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/company/res.py    Fri Dec 19 09:39:32 2025 +0100
@@ -174,9 +174,7 @@
             companies = [c.id for c in user.companies]
         else:
             companies = []
-        companies = tuple(companies)
-        cls._get_companies_cache.set(user_id, companies)
-        return companies
+        return cls._get_companies_cache.set(user_id, companies)
 
     @classmethod
     def get_employees(cls):
@@ -196,8 +194,7 @@
         else:
             employees = []
         employees = tuple(employees)
-        cls._get_employees_cache.set(user_id, employees)
-        return employees
+        return cls._get_employees_cache.set(user_id, employees)
 
     @classmethod
     def read(cls, ids, fields_names):
diff -r 9c7de9240347 -r 619fd425e3bb modules/party/address.py
--- a/modules/party/address.py  Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/party/address.py  Fri Dec 19 09:39:32 2025 +0100
@@ -625,8 +625,7 @@
         else:
             format_ = getattr(cls, f'default_{field}', lambda: '')()
 
-        cls._get_format_cache.set(key, format_)
-        return format_
+        return cls._get_format_cache.set(key, format_)
 
 
 class SubdivisionType(DeactivableMixin, ModelSQL, ModelView):
@@ -670,8 +669,7 @@
         else:
             types = []
 
-        cls._get_types_cache.set(key, types)
-        return types
+        return cls._get_types_cache.set(key, types)
 
     @classmethod
     def on_modification(cls, mode, types, field_names=None):
diff -r 9c7de9240347 -r 619fd425e3bb modules/product_price_list_cache/product.py
--- a/modules/product_price_list_cache/product.py       Fri Dec 12 15:31:45 
2025 +0100
+++ b/modules/product_price_list_cache/product.py       Fri Dec 19 09:39:32 
2025 +0100
@@ -119,7 +119,8 @@
         unit_prices = self._unit_prices_cache.get(self.raw_unit_prices)
         if unit_prices is None:
             unit_prices = loads(self.raw_unit_prices)
-            self._unit_prices_cache.set(self.raw_unit_prices, unit_prices)
+            unit_prices = self._unit_prices_cache.set(
+                self.raw_unit_prices, unit_prices)
         return unit_prices
 
     @classmethod
diff -r 9c7de9240347 -r 619fd425e3bb 
modules/product_price_list_cache/tests/test_module.py
--- a/modules/product_price_list_cache/tests/test_module.py     Fri Dec 12 
15:31:45 2025 +0100
+++ b/modules/product_price_list_cache/tests/test_module.py     Fri Dec 19 
09:39:32 2025 +0100
@@ -73,7 +73,7 @@
             self.assertEqual(cache.product, product)
             self.assertEqual(cache.uom, kilogram)
             self.assertEqual(
-                cache.unit_prices, [[0, Decimal(10)], [10, Decimal(9)]])
+                cache.unit_prices, ((0, Decimal(10)), (10, Decimal(9))))
             self.assertEqual(cache.pattern, None)
 
             # Test cached compute
diff -r 9c7de9240347 -r 619fd425e3bb modules/project/work.py
--- a/modules/project/work.py   Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/project/work.py   Fri Dec 19 09:39:32 2025 +0100
@@ -64,8 +64,7 @@
             status = records[0].id
         else:
             status = None
-        cls._get_default_status_cache.set(type, status)
-        return status
+        return cls._get_default_status_cache.set(type, status)
 
     @classmethod
     def on_modification(cls, mode, records, field_names=None):
@@ -100,8 +99,7 @@
         if domains:
             domains.append(
                 (gettext('project.msg_domain_all'), '[]', False))
-        cls._get_window_domains_cache.set(key, domains)
-        return domains
+        return cls._get_window_domains_cache.set(key, domains)
 
 
 class Work(
diff -r 9c7de9240347 -r 619fd425e3bb modules/stock/location.py
--- a/modules/stock/location.py Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/stock/location.py Fri Dec 19 09:39:32 2025 +0100
@@ -369,7 +369,7 @@
                 warehouse = warehouses[0].id
             else:
                 warehouse = None
-            cls._default_warehouse_cache.set(None, warehouse)
+            warehouse = cls._default_warehouse_cache.set(None, warehouse)
         return warehouse
 
     @property
diff -r 9c7de9240347 -r 619fd425e3bb 
modules/stock_package_shipping_sendcloud/carrier.py
--- a/modules/stock_package_shipping_sendcloud/carrier.py       Fri Dec 12 
15:31:45 2025 +0100
+++ b/modules/stock_package_shipping_sendcloud/carrier.py       Fri Dec 19 
09:39:32 2025 +0100
@@ -94,8 +94,7 @@
             auth=self.auth, timeout=timeout, headers=HEADERS)
         response.raise_for_status()
         addresses = response.json()['sender_addresses']
-        self._addresses_sender_cache.set(self.id, addresses)
-        return addresses
+        return self._addresses_sender_cache.set(self.id, addresses)
 
     def get_sender_address(self, shipment_or_warehouse, pattern=None):
         pattern = pattern.copy() if pattern is not None else {}
@@ -131,8 +130,7 @@
             auth=self.auth, timeout=timeout, headers=HEADERS)
         response.raise_for_status()
         methods = response.json()['shipping_methods']
-        self._shiping_methods_cache.set(key, methods)
-        return methods
+        return self._shiping_methods_cache.set(key, methods)
 
     def get_shipping_method(self, shipment, package=None):
         pattern = self._get_shipping_method_pattern(shipment, package=package)
diff -r 9c7de9240347 -r 619fd425e3bb modules/timesheet_cost/company.py
--- a/modules/timesheet_cost/company.py Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/timesheet_cost/company.py Fri Dec 19 09:39:32 2025 +0100
@@ -46,7 +46,8 @@
             for cost_price in cost_prices:
                 employee_costs.append(
                     (cost_price.date, cost_price.cost_price))
-            self._cost_prices_cache.set(self.id, employee_costs)
+            employee_costs = self._cost_prices_cache.set(
+                self.id, employee_costs)
         return employee_costs
 
     def compute_cost_price(self, date=None):
diff -r 9c7de9240347 -r 619fd425e3bb modules/web_shop_shopify/web.py
--- a/modules/web_shop_shopify/web.py   Fri Dec 12 15:31:45 2025 +0100
+++ b/modules/web_shop_shopify/web.py   Fri Dec 19 09:39:32 2025 +0100
@@ -1027,7 +1027,8 @@
                             QUERY_LOCATIONS, {}, 'locations'):
                         locations.append(
                             (str(gid2id(location['id'])), location['name']))
-                self._shopify_locations_cache.set(self.shop.id, locations)
+                locations = self._shopify_locations_cache.set(
+                    self.shop.id, locations)
             except GraphQLException:
                 pass
         return locations
diff -r 9c7de9240347 -r 619fd425e3bb trytond/doc/ref/cache.rst
--- a/trytond/doc/ref/cache.rst Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/doc/ref/cache.rst Fri Dec 19 09:39:32 2025 +0100
@@ -54,7 +54,7 @@
 
 .. method:: Cache.set(key, value)
 
-   Set the ``value`` of the ``key`` in the cache.
+   Set and return the ``value`` of the ``key`` in the cache.
 
 .. method:: Cache.clear()
 
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/cache.py
--- a/trytond/trytond/cache.py  Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/cache.py  Fri Dec 19 09:39:32 2025 +0100
@@ -224,7 +224,8 @@
         else:
             expire = None
         try:
-            cache[key] = (expire, immutable(value))
+            value = immutable(value)
+            cache[key] = (expire, value)
         except TypeError:
             pass
         return value
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/action.py
--- a/trytond/trytond/ir/action.py      Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/action.py      Fri Dec 19 09:39:32 2025 +0100
@@ -336,8 +336,7 @@
                             value['name'] = (
                                 parent.rec_name + ' / ' + value['name'])
         keywords.sort(key=itemgetter('name'))
-        cls._get_keyword_cache.set(key, keywords)
-        return keywords
+        return cls._get_keyword_cache.set(key, keywords)
 
 
 class ActionMixin(ModelSQL):
@@ -421,7 +420,7 @@
         key = (name, action_id)
         groups = Action._groups_cache.get(key)
         if groups is not None:
-            return set(groups)
+            return groups
 
         domain = [
             (cls._action_name, '=', name),
@@ -430,8 +429,7 @@
             domain.append(('id', '=', action_id))
         actions = cls.search(domain)
         groups = {g.id for a in actions for g in a.groups}
-        Action._groups_cache.set(key, list(groups))
-        return groups
+        return Action._groups_cache.set(key, groups)
 
     @classmethod
     def on_modification(cls, mode, records, field_names=None):
@@ -749,7 +747,7 @@
         return template
 
     def set_template_cached(self, template):
-        self._template_cache.set(self.id, template)
+        return self._template_cache.set(self.id, template)
 
     @classmethod
     def validate_fields(cls, reports, field_names):
@@ -1096,7 +1094,7 @@
         key = (name, action_id)
         models = cls._get_models_cache.get(key)
         if models is not None:
-            return set(models)
+            return models
 
         domain = [
             (cls._action_name, '=', name),
@@ -1105,8 +1103,7 @@
             domain.append(('id', '=', action_id))
         actions = cls.search(domain)
         models = {a.model for a in actions if a.model}
-        cls._get_models_cache.set(key, models)
-        return models
+        return cls._get_models_cache.set(key, models)
 
     @classmethod
     def get_name(cls, name, model):
@@ -1129,8 +1126,7 @@
         if actions:
             action, = actions
             wiz_name = action.name
-        cls._get_name_cache.set(key, wiz_name)
-        return wiz_name
+        return cls._get_name_cache.set(key, wiz_name)
 
     @classmethod
     def on_modification(cls, mode, keywords, field_names=None):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/configuration.py
--- a/trytond/trytond/ir/configuration.py       Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/configuration.py       Fri Dec 19 09:39:32 2025 +0100
@@ -25,8 +25,7 @@
         language = cls(1).language
         if not language:
             language = config.get('database', 'language')
-        cls._get_language_cache.set(None, language)
-        return language
+        return cls._get_language_cache.set(None, language)
 
     def check(self):
         "Check configuration coherence on pool initialisation"
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/lang.py
--- a/trytond/trytond/ir/lang.py        Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/lang.py        Fri Dec 19 09:39:32 2025 +0100
@@ -387,14 +387,15 @@
                     exception=exception)) from exception
 
     def get_translatable_languages(cls):
-        res = cls._lang_cache.get('translatable_languages')
-        if res is None:
+        languages = cls._lang_cache.get('translatable_languages')
+        if languages is None:
             langs = cls.search([
                     ('translatable', '=', True),
                     ])
-            res = [x.code for x in langs]
-            cls._lang_cache.set('translatable_languages', res)
-        return res
+            languages = [x.code for x in langs]
+            languages = cls._lang_cache.set(
+                'translatable_languages', languages)
+        return languages
 
     @classmethod
     def check_modification(cls, mode, languages, values=None, external=False):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/message.py
--- a/trytond/trytond/ir/message.py     Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/message.py     Fri Dec 19 09:39:32 2025 +0100
@@ -37,7 +37,7 @@
                 text = translation.value or message.text
             else:
                 text = message.text
-            cls._message_cache.set(key, text)
+            text = cls._message_cache.set(key, text)
         return text if not variables else text % variables
 
     @classmethod
@@ -68,7 +68,7 @@
                 text = values[index] or fallback
             else:
                 text = fallback
-            cls._message_cache.set(key, text)
+            text = cls._message_cache.set(key, text)
         return text if not variables else text % variables
 
     def _get_translation(self, language, fuzzy=False):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/model.py
--- a/trytond/trytond/ir/model.py       Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/model.py       Fri Dec 19 09:39:32 2025 +0100
@@ -185,11 +185,8 @@
                 items = (
                     (m, n) for m, n in items
                     if issubclass(pool_get(m), classes))
-            items = list(items)
-            cls._get_names_cache.set(key, items)
-        else:
-            items = list(items)
-        return items
+            items = cls._get_names_cache.set(key, list(items))
+        return list(items)
 
     @classmethod
     def get_names(cls, classes=None):
@@ -198,7 +195,7 @@
         dict_ = cls._get_names_cache.get(key)
         if dict_ is None:
             dict_ = dict(cls.get_name_items())
-            cls._get_names_cache.set(key, dict_)
+            dict_ = cls._get_names_cache.set(key, dict_)
         return dict_
 
     @classmethod
@@ -476,7 +473,7 @@
             if fields:
                 field, = fields
                 name = field.string
-                cls._get_name_cache.set((model, field), name)
+                name = cls._get_name_cache.set((model, field), name)
             else:
                 name = field
         return name
@@ -1078,8 +1075,7 @@
         else:
             button, = buttons
             reset = [b.name for b in button.reset]
-        cls._reset_cache.set(key, reset)
-        return reset
+        return cls._reset_cache.set(key, reset)
 
     @classmethod
     def get_groups(cls, model, name):
@@ -1099,8 +1095,7 @@
         else:
             button, = buttons
             groups = set(g.id for g in button.groups)
-        cls._groups_cache.set(key, groups)
-        return groups
+        return cls._groups_cache.set(key, groups)
 
     @classmethod
     def get_view_attributes(cls, model, name):
@@ -1122,8 +1117,7 @@
                 'help': button.help,
                 'confirm': button.confirm,
                 }
-        cls._view_attributes_cache.set(key, attributes)
-        return attributes
+        return cls._view_attributes_cache.set(key, attributes)
 
 
 class ModelButtonGroup(DeactivableMixin, ModelSQL):
@@ -1374,8 +1368,8 @@
             cursor = Transaction().connection.cursor()
 
             cursor.execute(*table.select(table.model, group_by=[table.model]))
-            models = [m for m, in cursor]
-            cls._has_model_cache.set(None, models)
+            models = set(m for m, in cursor)
+            models = cls._has_model_cache.set(None, models)
         return model in models
 
     @classmethod
@@ -1446,8 +1440,7 @@
         except ValueError:
             raise KeyError(f"Reference to '{module}.{fs_id}' not found")
 
-        cls._get_id_cache.set(key, data.db_id)
-        return data.db_id
+        return cls._get_id_cache.set(key, data.db_id)
 
     @classmethod
     def dump_values(cls, values):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/rule.py
--- a/trytond/trytond/ir/rule.py        Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/rule.py        Fri Dec 19 09:39:32 2025 +0100
@@ -326,8 +326,7 @@
         elif clause_global:
             clause = clause_global
 
-        cls._domain_get_cache.set(key, clause)
-        return clause
+        return cls._domain_get_cache.set(key, clause)
 
     @classmethod
     def query_get(cls, model_name, mode='read'):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/translation.py
--- a/trytond/trytond/ir/translation.py Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/translation.py Fri Dec 19 09:39:32 2025 +0100
@@ -319,8 +319,7 @@
         Lang = pool.get('ir.lang')
         langs = Lang.search([])
         result = [(lang.code, lang.name) for lang in langs]
-        cls._get_language_cache.set(language, result)
-        return result
+        return cls._get_language_cache.set(language, result)
 
     @classmethod
     def view_attributes(cls):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/ir/ui/view.py
--- a/trytond/trytond/ir/ui/view.py     Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/ir/ui/view.py     Fri Dec 19 09:39:32 2025 +0100
@@ -197,7 +197,7 @@
             rng_name = os.path.join(os.path.dirname(__file__), type_ + '.rng')
             with open(rng_name, 'rb') as fp:
                 rng = etree.fromstring(fp.read())
-            cls._get_rng_cache.set(key, rng)
+            rng = cls._get_rng_cache.set(key, rng)
         return rng
 
     @property
@@ -333,8 +333,7 @@
             'arch': arch,
             'field_childs': self.field_childs,
             }
-        self._view_get_cache.set(key, result)
-        return result
+        return self._view_get_cache.set(key, result)
 
     @classmethod
     def inherit_apply(cls, tree, inherit):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/model/dictschema.py
--- a/trytond/trytond/model/dictschema.py       Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/model/dictschema.py       Fri Dec 19 09:39:32 2025 +0100
@@ -207,8 +207,7 @@
             return fields
         keys = cls.get_keys(cls.search([]))
         fields = {k['name']: k for k in keys}
-        cls._relation_fields_cache.set(cls.__name__, fields)
-        return fields
+        return cls._relation_fields_cache.set(cls.__name__, fields)
 
     @classmethod
     def on_modification(cls, mode, records, field_names=None):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/model/digits.py
--- a/trytond/trytond/model/digits.py   Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/model/digits.py   Fri Dec 19 09:39:32 2025 +0100
@@ -22,8 +22,7 @@
         if digits is not None:
             return digits
         digits = self._get_digits()
-        self._digits_cache.set(key, digits)
-        return digits
+        return self._digits_cache.set(key, digits)
 
     def _get_digits(self):
         return (None, self.digits)
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/model/modelsql.py
--- a/trytond/trytond/model/modelsql.py Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/model/modelsql.py Fri Dec 19 09:39:32 2025 +0100
@@ -736,7 +736,7 @@
         if count is None:
             count = transaction.database.estimated_count(
                 transaction.connection, cls.__table__())
-            cls._count_cache.set(cls.__name__, count)
+            count = cls._count_cache.set(cls.__name__, count)
         return count
 
     @classmethod
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/model/modelstorage.py
--- a/trytond/trytond/model/modelstorage.py     Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/model/modelstorage.py     Fri Dec 19 09:39:32 2025 +0100
@@ -783,7 +783,7 @@
         count = cls._count_cache.get(cls.__name__)
         if count is None:
             count = cls.search([], count=True)
-            cls._count_cache.set(cls.__name__, count)
+            count = cls._count_cache.set(cls.__name__, count)
         return count
 
     def resources(self):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/model/modelview.py
--- a/trytond/trytond/model/modelview.py        Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/model/modelview.py        Fri Dec 19 09:39:32 2025 +0100
@@ -273,7 +273,6 @@
         result = cls._fields_view_get_cache.get(key)
         if result:
             return result
-        result = {'model': cls.__name__}
         pool = Pool()
         View = pool.get('ir.ui.view')
 
@@ -297,10 +296,11 @@
 
         # if a view was found
         if view:
-            result = view.view_get(model=cls.__name__)
+            result = dict(view.view_get(model=cls.__name__))
 
         # otherwise, build some kind of default view
         else:
+            result = {}
             if view_type == 'form':
                 res = cls.fields_get()
                 xml = '''<?xml version="1.0"?>''' \
@@ -348,8 +348,7 @@
             tree, result['type'], view_id=view_id,
             field_children=result['field_childs'], level=level)
 
-        cls._fields_view_get_cache.set(key, result)
-        return result
+        return cls._fields_view_get_cache.set(key, result)
 
     @classmethod
     def view_toolbar_get(cls):
@@ -389,8 +388,7 @@
             'exports': exports,
             'emails': emails,
             }
-        cls._view_toolbar_get_cache.set(key, result)
-        return result
+        return cls._view_toolbar_get_cache.set(key, result)
 
     @classmethod
     def view_attributes(cls):
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/report/report.py
--- a/trytond/trytond/report/report.py  Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/report/report.py  Fri Dec 19 09:39:32 2025 +0100
@@ -392,7 +392,7 @@
             loader = relatorio.reporting.MIMETemplateLoader()
             klass = loader.factories[loader.get_type(mimetype)]
             template = klass(BytesIO(report.report_content))
-            report.set_template_cached(template)
+            template = report.set_template_cached(template)
         translate = cls._callback_loader(report, template)
         if translate:
             report_context = report_context.copy()
diff -r 9c7de9240347 -r 619fd425e3bb trytond/trytond/res/user.py
--- a/trytond/trytond/res/user.py       Fri Dec 12 15:31:45 2025 +0100
+++ b/trytond/trytond/res/user.py       Fri Dec 19 09:39:32 2025 +0100
@@ -634,8 +634,7 @@
                     & (group.active == Literal(True))),
                 order_by=[user_group.group.asc]))
         groups = tuple(g for g, in cursor)
-        cls._get_groups_cache.set(user, groups)
-        return groups
+        return cls._get_groups_cache.set(user, groups)
 
     @classmethod
     def _get_login(cls, login):

Reply via email to