Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions sao/src/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1218,11 +1218,7 @@
if (this.group.parent) {
this.order = null;
}
if (group && (group.length > 0)) {
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];
Expand Down Expand Up @@ -1326,11 +1322,7 @@
load: function(ids, set_cursor=true, modified=false, position=-1) {
this.group.load(ids, null, modified, position);
this.current_view.reset();
if ((ids.length > 0) && (this.current_view.view_type == 'tree')) {
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();
Expand Down Expand Up @@ -1384,7 +1376,7 @@
if (this.current_record &&
~this.current_record.group.indexOf(this.current_record)) {
} else if (this.group && this.group.length &&
(['form', 'tree'].includes(this.current_view.view_type))) {
(this.current_view.view_type == 'form')) {
this.current_record = this.group[0];
} else {
this.current_record = null;
Expand Down
8 changes: 6 additions & 2 deletions sao/src/view/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,12 @@
moreObserver.observe(more_button[0]);
}
}
}).done(
Sao.common.debounce(this.update_sum.bind(this), 250));
}).done(() => {
if (!this.record && this.rows.length) {
this.rows[0].select_row({});
}
Sao.common.debounce(this.update_sum.bind(this), 250)();
});
},
construct: function(extend) {
if (!extend) {
Expand Down
13 changes: 3 additions & 10 deletions tryton/tryton/gui/window/view_form/screen/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,7 @@ def __set_group(self, group):
self.filter_widget = None
self.order = None
self.__group.add_fields(fields)
if 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
Expand Down Expand Up @@ -1010,10 +1007,7 @@ def get_tree_domain(self, parent):
def load(self, ids, set_cursor=True, modified=False, position=-1):
self.group.load(ids, modified=modified, position=position)
self.current_view.reset()
if ids and self.current_view.view_type == 'tree':
self.current_record = self.group.get(ids[0])
else:
self.current_record = None
self.current_record = None
self.display(set_cursor=set_cursor)

def display(self, res_id=None, set_cursor=False, force=False):
Expand All @@ -1023,8 +1017,7 @@ def display(self, res_id=None, set_cursor=False, force=False):
if (self.current_record
and self.current_record in self.current_record.group):
pass
elif (self.group
and self.current_view.view_type in {'form', 'tree'}):
elif self.group and self.current_view.view_type == 'form':
self.current_record = self.group[0]
else:
self.current_record = None
Expand Down
5 changes: 5 additions & 0 deletions tryton/tryton/gui/window/view_form/view/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,11 @@ def display(self, force=False):
self.set_state()
self.update_arrow()
self.update_sum()
if not self.record and self.group:
record = self.group[0]
selection = self.treeview.get_selection()
selection.unselect_all()
selection.select_path(record.get_index_path(self.group))

# Set column visibility depending on attributes and domain
domain = []
Expand Down