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
This commit is contained in:
@@ -3231,6 +3231,7 @@ function eval_pyson(value){
|
||||
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 @@ function eval_pyson(value){
|
||||
row_activate: this.activate.bind(this),
|
||||
readonly: true,
|
||||
limit: null,
|
||||
context: this.view.screen.context,
|
||||
breadcrumb: breadcrumb,
|
||||
});
|
||||
this.screen.windows.push(this);
|
||||
@@ -3986,12 +3988,16 @@ function eval_pyson(value){
|
||||
// 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,
|
||||
'context': context
|
||||
'context': context,
|
||||
'breadcrumb': breadcrumb,
|
||||
});
|
||||
},
|
||||
edit: function() {
|
||||
|
||||
@@ -90,13 +90,19 @@ class Many2Many(Widget):
|
||||
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,
|
||||
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 @@ class One2Many(Widget):
|
||||
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 @@ class O2M(GenericText):
|
||||
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 @@ class M2M(O2M):
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user