← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-744789-qdp into lp:openobject-addons

 

qdp (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-744789-qdp into lp:openobject-addons.

Requested reviews:
  Olivier Dony (OpenERP) (odo)
Related bugs:
  Bug #744789 in OpenERP Addons: "[V6] Third party ledger : Initial Balance"
  https://bugs.launchpad.net/openobject-addons/+bug/744789

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-744789-qdp/+merge/58334

in the query_get() of account.move.line, if we don't give any other criteria in the context than the fiscalyear when computing an initial balance then it simply means that the entries returned will be exactly the same as without initial balance, which lead to count the entries twice...

this hack is a little nasty (not so say "a lot nasty"), but i can't think to something else.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-744789-qdp/+merge/58334
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-744789-qdp.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2011-03-25 15:38:54 +0000
+++ account/account_move_line.py	2011-04-19 15:46:29 +0000
@@ -93,6 +93,10 @@
         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']))
 


Follow ups