Commit ced0956c authored by Cédric Krier's avatar Cédric Krier
Browse files

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
parent e49c31a630b5
Pipeline #61719 passed with stages
in 8 minutes and 46 seconds
......@@ -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() {
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment