From a707a20efe086fd889c00502fa58617866a09c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Sat, 30 Nov 2024 10:24:52 +0100 Subject: [PATCH] Parse child of group tags at the end This allows to preserve the order of the state widgets in the form which is important when evaluating the emptiness of a group Closes #13622 (grafted from b01fd46f44f2923cbd5a91323c592fa8cfb18a57) --HG-- branch : 6.0 --- sao/src/view/form.js | 4 +++- tryton/tryton/gui/window/view_form/view/form.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sao/src/view/form.js b/sao/src/view/form.js index 0a6d306fd1..5abbe39614 100644 --- a/sao/src/view/form.js +++ b/sao/src/view/form.js @@ -181,7 +181,6 @@ function eval_pyson(value){ var group = new Sao.View.Form.Container( Number(node.getAttribute('col') || 4)); this.view.containers.push(group); - this.parse_child(node, group); if (attributes.xalign === undefined) { attributes.xalign = 0.5; @@ -206,6 +205,9 @@ function eval_pyson(value){ this.view.state_widgets.push(widget); this.container.add(widget, attributes); + // Parse the children at the end to preserve the order of the state + // widgets + this.parse_child(node, group); }, _parse_hpaned: function(node, attributes) { this._parse_paned(node, attributes, 'horizontal'); diff --git a/tryton/tryton/gui/window/view_form/view/form.py b/tryton/tryton/gui/window/view_form/view/form.py index 246b327028..aeb1315006 100644 --- a/tryton/tryton/gui/window/view_form/view/form.py +++ b/tryton/tryton/gui/window/view_form/view/form.py @@ -379,7 +379,6 @@ class FormXMLViewParser(XMLViewParser): group = Container.constructor( int(attributes.get('col', 4)), attributes.get('homogeneous', False)) - self.parse_child(node, group) if 'name' in attributes and attributes['name'] == self.exclude_field: self.container.add(None, attributes) @@ -403,6 +402,9 @@ class FormXMLViewParser(XMLViewParser): bool(attributes.get('yexpand')))) self.view.state_widgets.append(widget) self.container.add(widget, attributes) + # Parse the children at the end to preserve the order of the state + # widgets + self.parse_child(node, group) def _parse_hpaned(self, node, attributes): self._parse_paned(node, attributes, Gtk.HPaned)