Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
ced0956c by Cédric Krier at 2023-01-21T19:37:19+01:00
Instantiate always Screen for xxx2Many fields with the same parameters
The screen must be instantiated with the context of the parent screen so
eventual field_view_get would give the same result.
The limit must always be set to None/null to ensure to load all the records.
The breadcrumb must be set to show navigation to the user.
Closes #3140
- - - - -
4 changed files:
- sao/src/view/form.js
- tryton/tryton/gui/window/view_form/view/form_gtk/many2many.py
- tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py
- tryton/tryton/gui/window/view_form/view/list_gtk/widget.py
Changes:
=====================================
sao/src/view/form.js
=====================================
@@ -3231,6 +3231,7 @@
row_activate: this.activate.bind(this),
exclude_field: attributes.relation_field || null,
limit: null,
+ context: this.view.screen.context,
pre_validate: attributes.pre_validate,
breadcrumb: breadcrumb,
});
@@ -3812,6 +3813,7 @@
row_activate: this.activate.bind(this),
readonly: true,
limit: null,
+ context: this.view.screen.context,
breadcrumb: breadcrumb,
});
this.screen.windows.push(this);
@@ -3986,8 +3988,11 @@
// Remove the first tree view as mode is form only
view_ids.shift();
}
- return new Sao.Screen(this.attributes.relation, {
+ var model = this.attributes.relation;
+ var breadcrumb = jQuery.extend([], this.view.screen.breadcrumb);
+ breadcrumb.push(this.attributes.string ||
Sao.common.MODELNAME.get(model));
+ return new Sao.Screen(model, {
'domain': domain,
'view_ids': view_ids,
'mode': ['form'],
'views_preload': this.attributes.views,
@@ -3990,8 +3995,9 @@
'domain': domain,
'view_ids': view_ids,
'mode': ['form'],
'views_preload': this.attributes.views,
- 'context': context
+ 'context': context,
+ 'breadcrumb': breadcrumb,
});
},
edit: function() {
=====================================
tryton/tryton/gui/window/view_form/view/form_gtk/many2many.py
=====================================
@@ -90,9 +90,13 @@
frame.set_shadow_type(Gtk.ShadowType.OUT)
vbox.pack_start(frame, expand=False, fill=True, padding=0)
- self.screen = Screen(attrs['relation'],
+ model = attrs['relation']
+ breadcrumb = list(self.view.screen.breadcrumb)
+ breadcrumb.append(
+ attrs.get('string') or common.MODELNAME.get(model))
+ self.screen = Screen(model,
view_ids=attrs.get('view_ids', '').split(','),
mode=['tree'], views_preload=attrs.get('views', {}),
order=attrs.get('order'),
row_activate=self._on_activate,
readonly=True,
@@ -94,9 +98,11 @@
view_ids=attrs.get('view_ids', '').split(','),
mode=['tree'], views_preload=attrs.get('views', {}),
order=attrs.get('order'),
row_activate=self._on_activate,
readonly=True,
- limit=None)
+ limit=None,
+ context=self.view.screen.context,
+ breadcrumb=breadcrumb)
self.screen.windows.append(self)
vbox.pack_start(self.screen.widget, expand=True, fill=True, padding=0)
=====================================
tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py
=====================================
@@ -168,6 +168,7 @@
row_activate=self._on_activate,
exclude_field=attrs.get('relation_field', None),
limit=None,
+ context=self.view.screen.context,
breadcrumb=breadcrumb)
self.screen.pre_validate = bool(int(attrs.get('pre_validate', 0)))
self.screen.windows.append(self)
=====================================
tryton/tryton/gui/window/view_form/view/list_gtk/widget.py
=====================================
@@ -998,6 +998,8 @@
screen = Screen(relation, mode=['tree', 'form'],
view_ids=self.attrs.get('view_ids', '').split(','),
exclude_field=field.attrs.get('relation_field'),
+ limit=None,
+ context=self.view.screen.context,
breadcrumb=breadcrumb)
screen.pre_validate = bool(int(self.attrs.get('pre_validate', 0)))
screen.group = group
@@ -1024,6 +1026,8 @@
screen = Screen(relation, mode=['tree', 'form'],
view_ids=self.attrs.get('view_ids', '').split(','),
exclude_field=field.attrs.get('relation_field'),
+ limit=None,
+ context=self.view.screen.context,
breadcrumb=breadcrumb)
screen.group = group
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/ced0956c41cd1192b98eb4a9e9e23f85c86b6240
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/ced0956c41cd1192b98eb4a9e9e23f85c86b6240
You're receiving this email because of your account on foss.heptapod.net.