[FIX] Corrected the Date criteria filtering behaviour for Account Balance Report(ref:ACH)
bzr revid: jvo@tinyerp.com-20090316114101-lkjq42vckyybnchi
This commit is contained in:
parent
84452b75da
commit
5285c6cbaf
|
@ -40,16 +40,22 @@ class account_move_line(osv.osv):
|
|||
else:
|
||||
fiscalyear_clause = '%s' % context['fiscalyear']
|
||||
state=context.get('state',False)
|
||||
where_move_state=''
|
||||
where_move_state = ''
|
||||
where_move_lines_by_date = ''
|
||||
|
||||
if context.get('date_from', False) and context.get('date_to', False):
|
||||
where_move_lines_by_date = " AND " +obj+".move_id in ( select id from account_move where date >= '" +context['date_from']+"' AND date <= '"+context['date_to']+"')"
|
||||
|
||||
if state:
|
||||
if state.lower() not in ['all']:
|
||||
where_move_state= " AND "+obj+".move_id in (select id from account_move where account_move.state = '"+state+"')"
|
||||
|
||||
|
||||
if context.get('periods', False):
|
||||
ids = ','.join([str(x) for x in context['periods']])
|
||||
return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) AND id in (%s)) %s" % (fiscalyear_clause, ids,where_move_state)
|
||||
return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) AND id in (%s)) %s %s" % (fiscalyear_clause, ids,where_move_state,where_move_lines_by_date)
|
||||
else:
|
||||
return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s)" % (fiscalyear_clause,where_move_state)
|
||||
return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s %s)" % (fiscalyear_clause,where_move_state,where_move_lines_by_date)
|
||||
|
||||
def default_get(self, cr, uid, fields, context={}):
|
||||
data = self._default_get(cr, uid, fields, context)
|
||||
|
|
|
@ -127,6 +127,8 @@ class account_balance(report_sxw.rml_parse):
|
|||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
elif form['state']== 'bydate':
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
self.transform_date_into_date_array(form)
|
||||
elif form['state'] == 'all' :
|
||||
self.transform_both_into_date_array(form)
|
||||
|
|
Loading…
Reference in New Issue