From b1c9dc503b4d814e862a3cd930165500f386c033 Mon Sep 17 00:00:00 2001 From: Vincent Vinet Date: Fri, 2 Jan 2015 14:04:14 -0500 Subject: [PATCH] allow default order to be overriden with function --- .../report/common_reports.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/account_financial_report_webkit/report/common_reports.py b/account_financial_report_webkit/report/common_reports.py index 871a2c1f..fbbf1e5a 100644 --- a/account_financial_report_webkit/report/common_reports.py +++ b/account_financial_report_webkit/report/common_reports.py @@ -493,6 +493,11 @@ class CommonReportHeaderWebkit(common_report_header): _('No valid filter'), _('Please set a valid time filter')) def _get_move_line_select(self): + ''' + Get the columns to put in the SQL SELECT for _get_move_line_datas + + See _get_move_line_datas for available tables and aliases + ''' return """ l.id AS id, l.date AS ldate, @@ -522,9 +527,13 @@ class CommonReportHeaderWebkit(common_report_header): l.date_maturity """ - def _get_move_line_datas(self, move_line_ids, - order='per.special DESC, l.date ASC, \ - per.date_start ASC, m.name ASC'): + def _get_move_line_order(self): + ''' Get the default SQL ORDER statement for _get_move_line_datas ''' + return 'per.special DESC, l.date ASC, per.date_start ASC, m.name ASC' + + def _get_move_line_datas(self, move_line_ids, order=None): + if order is None: + order = self._get_move_line_order() # Possible bang if move_line_ids is too long # We can not slice here as we have to do the sort. # If slice has to be done it means that we have to reorder in python