[FIX] account: fix error on initial balance if we don't give any criteria
lp bug: https://launchpad.net/bugs/744789 fixed bzr revid: qdp-launchpad@openerp.com-20110419153459-fpd1zitw5ud3lzct
This commit is contained in:
parent
2c3c064a22
commit
26e21b097e
|
@ -93,6 +93,10 @@ class account_move_line(osv.osv):
|
|||
else:
|
||||
query = 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)
|
||||
|
||||
if initial_bal and not context.get('periods', False) and not where_move_lines_by_date:
|
||||
#we didn't pass any filter in the context, and the initial balance can't be computed using only the fiscalyear otherwise entries will be summed twice
|
||||
#so we have to invalidate this query
|
||||
query += " AND 1=2"
|
||||
if context.get('journal_ids', False):
|
||||
query += ' AND '+obj+'.journal_id IN (%s)' % ','.join(map(str, context['journal_ids']))
|
||||
|
||||
|
|
Loading…
Reference in New Issue