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

Do not select first record by default

Closes #11814
parent 0efd47a8736f
Pipeline #61584 passed with stages
in 12 minutes and 58 seconds
* Do not select first record by default
* Use ``&`` and ``|`` as boolean operator in search widget
* Use toggle button and label on translate dialog
* Support border type of images
......
......@@ -1206,11 +1206,7 @@
if (this.group.parent) {
this.order = null;
}
if (group && group.length) {
this.current_record = group[0];
} else {
this.current_record = null;
}
this.current_record = null;
this.group.add_fields(fields);
for (name in fields_views) {
var views = fields_views[name];
......@@ -1313,11 +1309,7 @@
load: function(ids, set_cursor=true, modified=false, position=-1) {
this.group.load(ids, modified, position);
this.current_view.reset();
if (ids.length && this.current_view.view_type != 'calendar') {
this.current_record = this.group.get(ids[0]);
} else {
this.current_record = null;
}
this.current_record = null;
return this.display().then(() => {
if (set_cursor) {
this.set_cursor();
......@@ -1329,7 +1321,7 @@
if (this.current_record &&
~this.current_record.group.indexOf(this.current_record)) {
} else if (this.group && this.group.length &&
(this.current_view.view_type != 'calendar')) {
(this.current_view.view_type == 'form')) {
this.current_record = this.group[0];
} else {
this.current_record = null;
......@@ -1656,10 +1648,6 @@
// TODO delete children before parent
prm = this.group.delete_(records);
}
var top_record = records[0];
var top_group = top_record.group;
var idx = top_group.indexOf(top_record);
var path = top_record.get_path(this.group);
return prm.then(() => {
for (const record of records) {
record.group.remove(record, remove, force_remove, false);
......@@ -1683,20 +1671,7 @@
// TODO destroy
}
}
if (idx > 0) {
var record = top_group[idx - 1];
path.splice(-1, 1, [path[path.length - 1][0], record.id]);
} else {
path.splice(-1, 1);
}
if (!jQuery.isEmptyObject(path)) {
prms.push(this.group.get_by_path(path).then(record => {
this.current_record = record;
}));
} else if (this.group.length) {
this.current_record = this.group[0];
}
this.current_record = null;
return jQuery.when.apply(jQuery, prms).then(() => {
return this.display().done(() => {
this.set_cursor();
......
* Do not select first record by default
* Use ``&`` and ``|`` as boolean operator in search widget
* Use toggle button and label on translate dialog
* Manage domain on id in single value list as unique
......
......@@ -422,10 +422,7 @@
self.filter_widget = None
self.order = None
self.__group.add_fields(fields)
if len(group):
self.current_record = group[0]
else:
self.current_record = None
self.current_record = None
for name, views in fields_views.items():
self.__group.fields[name].views.update(views)
self.__group.exclude_field = self.exclude_field
......@@ -789,11 +786,6 @@
if not self.group.delete(records):
return False
top_record = records[0]
top_group = top_record.group
idx = top_group.index(top_record)
path = top_record.get_path(self.group)
for record in records:
# set current model to None to prevent __select_changed
# to save the previous_model as it can be already deleted.
......@@ -815,15 +807,7 @@
record.parent.save(force_reload=False)
record.destroy()
if idx > 0:
record = top_group[idx - 1]
path = path[:-1] + ((path[-1][0], record.id,),)
else:
path = path[:-1]
if path:
self.current_record = self.group.get_by_path(path)
elif len(self.group):
self.current_record = self.group[0]
self.current_record = None
self.set_cursor()
self.display()
return True
......@@ -961,7 +945,7 @@
if (self.current_record
and self.current_record in self.current_record.group):
pass
elif self.group and self.current_view.view_type != 'calendar':
elif self.group and self.current_view.view_type == 'form':
self.current_record = self.group[0]
else:
self.current_record = None
......
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