Set view_id in the context when calling view_attributes

issue11091
review364531002
This commit is contained in:
Cédric Krier
2022-01-04 22:30:41 +01:00
parent f9569e7018
commit 51a08fb809
3 changed files with 9 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
* Set view_id in the context when calling view_attributes
* Add ip_address and device_cookie login method options
* Add support for Python 3.10
* Remove support for Python 3.6
+5
View File
@@ -182,6 +182,11 @@ Class methods:
encoded value. If the depends list is set its fields are added to the
view if the xpath matches at least one element.
.. note::
The``view_id`` is set to the
:attr:`~trytond.transaction.Transaction.context` when calling this method.
.. classmethod:: ModelView.parse_view(tree, type[, field_children[, level[, view_depends]]])
+3 -2
View File
@@ -378,8 +378,9 @@ class ModelView(Model):
# Update arch and compute fields from arch
parser = etree.XMLParser(remove_blank_text=True)
tree = etree.fromstring(result['arch'], parser)
result['arch'], result['fields'] = cls.parse_view(
tree, result['type'], result['field_childs'], level=level)
with Transaction().set_context(view_id=view_id):
result['arch'], result['fields'] = cls.parse_view(
tree, result['type'], result['field_childs'], level=level)
cls._fields_view_get_cache.set(key, result)
return result