StringPartitioned evaluates the LazyString too early
When adding a field in a `__setup__` call and using `lazy_gettext` the following crash occurs: ``` Traceback (most recent call last): File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() File "/usr/lib/python3.11/threading.py", line 982, in run self._target(*self._args, **self._kwargs) File "/home/nicoe/projets/customers/coopengo/tryton/trytond/bin/trytond", line 51, in load Pool(name).init() File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/pool.py", line 209, in init restart = not load_modules( ^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/modules/__init__.py", line 599, in load_modules _load_modules(update) File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/modules/__init__.py", line 562, in _load_modules load_module_graph(graph, pool, update, lang, options) File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/modules/__init__.py", line 292, in load_module_graph pool.setup() File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/pool.py", line 304, in setup cls.__setup__() File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/modules/lazy_mixin/__init__.py", line 11, in __setup__ cls.parent_field = fields.Many2One( ^^^^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/model/fields/many2one.py", line 54, in __init__ super(Many2One, self).__init__(string=string, help=help, File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/model/fields/field.py", line 289, in __init__ self.string = string ^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/model/fields/field.py", line 327, in string self.__string = StringPartitioned(value) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/tools/string_.py", line 117, in __str__ return self._func(*self._args, **self._kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/i18n.py", line 18, in gettext language = Transaction().language ^^^^^^^^^^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/transaction.py", line 417, in language return self.context.get('language') or get_language() ^^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/transaction.py", line 415, in get_language return Config.get_language() ^^^^^^^^^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/ir/configuration.py", line 24, in get_language language = cls(1).language ^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/model/modelstorage.py", line 1615, in __init__ self._local_cache = local_cache(self.__class__, transaction) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/nicoe/projets/customers/coopengo/tryton/trytond/trytond/model/modelstorage.py", line 48, in local_cache return LRUDictTransaction(record_cache_size(transaction), Model._record) ^^^^^^^^^^^^^ AttributeError: type object 'ir.configuration' has no attribute '_record'. Did you mean: '_removed'? ``` This happens because `StringPartitioned` inherits from `str` and does not implement `__new__` thus calling the str version of `__new__`. which calls the `__str__` (cfr https://github.com/python/cpython/blob/05e47202a34e6ae05e699af1083455f5b8b59496/Objects/unicodeobject.c#L14611).
issue