[FIX] account: fixed the filter used in manual reconciliation process
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 18 Mar 2013 14:43:42 +0000 (15:43 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 18 Mar 2013 14:43:42 +0000 (15:43 +0100)
bzr revid: qdp-launchpad@openerp.com-20130318144342-16w1dreej7yzr51n

1  2 
addons/account/account_move_line.py

@@@ -741,10 -741,8 +741,8 @@@ class account_move_line(osv.osv)
  
      def list_partners_to_reconcile(self, cr, uid, context=None):
          cr.execute(
-              """
-              SELECT partner_id
-              FROM (
-                 SELECT l.partner_id, p.last_reconciliation_date, SUM(l.debit) AS debit, SUM(l.credit) AS credit
+              """SELECT partner_id FROM (
 -                SELECT l.partner_id, p.last_reconciliation_date, SUM(l.debit) AS debit, SUM(l.credit) AS credit, MAX(l.date) AS max_reconcil_date
++                SELECT l.partner_id, p.last_reconciliation_date, SUM(l.debit) AS debit, SUM(l.credit) AS credit, MAX(l.date) AS max_date
                  FROM account_move_line l
                  RIGHT JOIN account_account a ON (a.id = l.account_id)
                  RIGHT JOIN res_partner p ON (l.partner_id = p.id)
                      AND l.state <> 'draft'
                      GROUP BY l.partner_id, p.last_reconciliation_date
                  ) AS s
-                 WHERE debit > 0 AND credit > 0
 -                WHERE debit > 0 AND credit > 0 AND (last_reconciliation_date IS NULL OR max_reconcil_date > last_reconciliation_date)
++                WHERE debit > 0 AND credit > 0 AND (last_reconciliation_date IS NULL OR max_date > last_reconciliation_date)
                  ORDER BY last_reconciliation_date""")
          ids = cr.fetchall()
          ids = len(ids) and [x[0] for x in ids] or []