[IMP] Make default for filter on journal wizards
bzr revid: mra@mra-laptop-20100712054220-o5btsche3x483l9o
This commit is contained in:
@@ -58,7 +58,8 @@ class journal_print(report_sxw.rml_parse, account_journal_common_default):
|
||||
'sum_credit': self._sum_credit,
|
||||
'get_start_period': self.get_start_period,
|
||||
'get_end_period': self.get_end_period,
|
||||
'get_account': self.get_account
|
||||
'get_account': self._get_account,
|
||||
'get_filter': self._get_filter
|
||||
})
|
||||
|
||||
def lines(self, period_id, journal_id=[]):
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
|
||||
<td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td>
|
||||
<td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td>
|
||||
<td><para style="terp_default_Centre_8">[[ data and 'form' in data and data['form']['filter'] or 'No Filter' ]]</para></td>
|
||||
<td><para style="terp_default_Centre_8">[[ get_filter(data) or removeParentNode('para') ]] </para></td>
|
||||
<td><para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] </para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
@@ -71,11 +71,21 @@ class account_journal_common_default(object):
|
||||
return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr, self.uid, data['form']['period_to']).name
|
||||
return ''
|
||||
|
||||
def get_account(self, data):
|
||||
def _get_account(self, data):
|
||||
if data.get('form', False) and data['form'].get('chart_account_id', False):
|
||||
return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr, self.uid, data['form']['chart_account_id']).name
|
||||
return ''
|
||||
|
||||
def _get_filter(self, data):
|
||||
if data.get('form', False) and data['form'].get('filter', False):
|
||||
if data['form']['filter'] == 'filter_date':
|
||||
return 'Date'
|
||||
elif data['form']['filter'] == 'filter_period':
|
||||
return 'Periods'
|
||||
else:
|
||||
return 'No Filter'
|
||||
return ''
|
||||
|
||||
def _sum_debit_period(self, period_id, journal_id=None):
|
||||
journals = journal_id or self.journal_ids
|
||||
if not journals:
|
||||
|
||||
@@ -54,6 +54,7 @@ class journal_print(report_sxw.rml_parse, account_journal_common_default):
|
||||
'lines': self.lines,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'get_filter': self._get_filter
|
||||
# 'get_start_date': self.get_start_date,
|
||||
# 'get_end_date': self.get_end_date
|
||||
})
|
||||
|
||||
@@ -43,7 +43,8 @@ class journal_print(report_sxw.rml_parse, account_journal_common_default):
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'get_start_date': self.get_start_date,
|
||||
'get_end_date': self.get_end_date
|
||||
'get_end_date': self.get_end_date,
|
||||
'get_filter': self._get_filter
|
||||
})
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
|
||||
@@ -31,7 +31,7 @@ class account_common_report(osv.osv_memory):
|
||||
_columns = {
|
||||
'chart_account_id': fields.many2one('account.account', 'Chart of account', help='Select Charts of Accounts', required=True, domain = [('parent_id','=',False)]),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
|
||||
'filter': fields.selection([('filter_no', 'No filters'), ('filter_date', 'Date'), ('filter_period', 'Periods')], "Filter by:", required=True),
|
||||
'filter': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods')], "Filter by:", required=True),
|
||||
'period_from': fields.many2one('account.period', 'Start period'),
|
||||
'period_to': fields.many2one('account.period', 'End period'),
|
||||
#not used. Do we really need it? 'period_ids': fields.many2many('account.period', 'ledger_period_rel', 'ledger_id', 'period_id', 'Periods'),
|
||||
@@ -122,6 +122,7 @@ class account_common_report(osv.osv_memory):
|
||||
else:
|
||||
data['form']['periods'] = []
|
||||
return self._print_report(cr, uid, ids, data, query_line, context=context)
|
||||
|
||||
account_common_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user