Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits: 05665ef1 by Cédric Krier at 2022-12-31T00:57:23+01:00 Implement listed records for calendar and list-form views - - - - - 6 changed files: - sao/src/screen.js - sao/src/view/calendar.js - sao/src/view/list_form.js - tryton/tryton/gui/window/view_form/screen/screen.py - tryton/tryton/gui/window/view_form/view/calendar_.py - tryton/tryton/gui/window/view_form/view/list_form.py Changes: ===================================== sao/src/screen.js ===================================== @@ -1437,7 +1437,9 @@ } }, get listed_records() { - if (this.current_view && this.current_view.view_type == 'tree') { + if (this.current_view && + ~['tree', 'calendar', 'list-form'].indexOf( + this.current_view.view_type)) { return this.current_view.listed_records; } else if (this.current_record) { return [this.current_record]; ===================================== sao/src/view/calendar.js ===================================== @@ -340,7 +340,10 @@ }, get_selected_date: function(){ return this.el.fullCalendar('getDate'); - } + }, + get listed_records() { + return this.events.map(e => e.record); + }, }); }()); ===================================== sao/src/view/list_form.js ===================================== @@ -105,6 +105,9 @@ } return records; }, + get listed_records() { + this.group.slice(); + }, set_cursor: function(new_, reset_view) { if (new_) { this.el.animate({ ===================================== tryton/tryton/gui/window/view_form/screen/screen.py ===================================== @@ -1173,7 +1173,9 @@ @property def listed_records(self): - if self.current_view and self.current_view.view_type == 'tree': + if (self.current_view + and self.current_view.view_type in { + 'tree', 'calendar', 'list-form'}): return self.current_view.listed_records elif self.current_record: return [self.current_record] ===================================== tryton/tryton/gui/window/view_form/view/calendar_.py ===================================== @@ -170,3 +170,8 @@ def get_fields(self): return [] + + @property + def listed_records(self): + event_store = self.widgets['goocalendar'].event_store + return [e.record for e in event_store.get_events()] ===================================== tryton/tryton/gui/window/view_form/view/list_form.py ===================================== @@ -115,6 +115,10 @@ return [ self._model.get_item(r.get_index()).record for r in selected_rows] + @property + def listed_records(self): + return list(self._model.group) + def group_list_changed(self, group, action, *args): if action == 'record-added': record, position = args View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/05665ef113c43decc2a92961bd802b0197db07c6 -- View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/05665ef113c43decc2a92961bd802b0197db07c6 You're receiving this email because of your account on foss.heptapod.net.