[FIX] base: make NameManager.available_fields a dict
Until version 13.0, ir.ui.view:postprocess_and_fields returned a tuple
of a string and a dict of field information.
With aae1d57829, it now returns a
defaultdict instead of the dict.
This dict comes from NameManager.available_fields, which is initialized
as a defaultdict. There is no apparent reason to have a defaultdict in
this place, apart from the usage in has_field.
Furthermore, using a defaultdict has a side-effect in the search_view
computed field of all the ir.actions.act_window. On a database, if you
access env.ref('base.paper_format_action').search_view it will contain
a stringified dict, and the string default_dict(<class 'dict'>, {...})
is used in place of just {...} under the fields key.
closes odoo/odoo#53235
X-original-commit: 4586d0fbf0bdd5959b274611c58df911e50f4ef2
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
This commit is contained in:
@@ -1842,7 +1842,7 @@ class NameManager:
|
||||
""" An object that manages all the named elements in a view. """
|
||||
|
||||
def __init__(self, validate, Model):
|
||||
self.available_fields = collections.defaultdict(dict)
|
||||
self.available_fields = dict()
|
||||
self.mandatory_fields = dict()
|
||||
self.mandatory_parent_fields = dict()
|
||||
self.available_actions = set()
|
||||
@@ -1852,7 +1852,7 @@ class NameManager:
|
||||
self.fields_get = self.Model.fields_get()
|
||||
|
||||
def has_field(self, name, info=()):
|
||||
self.available_fields[name].update(info)
|
||||
self.available_fields.setdefault(name, {}).update(info)
|
||||
|
||||
def has_action(self, name):
|
||||
self.available_actions.add(name)
|
||||
|
||||
Reference in New Issue
Block a user