[FIX] account_move_line: takes into account the ir_rules when listing the partenrs...
authorChris Biersbach <cbi@openerp.com>
Tue, 26 Mar 2013 09:34:13 +0000 (10:34 +0100)
committerChris Biersbach <cbi@openerp.com>
Tue, 26 Mar 2013 09:34:13 +0000 (10:34 +0100)
bzr revid: cbi@openerp.com-20130326093413-j0e8hpb0eqig1too

addons/account/account_move_line.py

index 2d03ea8..082d654 100644 (file)
@@ -753,9 +753,14 @@ class account_move_line(osv.osv):
                 ) AS s
                 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 []
-        return self.pool.get('res.partner').name_get(cr, uid, ids, context=context)
+        ids = [x[0] for x in cr.fetchall()]
+        if not ids: 
+            return []
+
+        # To apply the ir_rules
+        partner_obj = self.pool.get('res.partner')
+        ids = partner_obj.search(cr, uid, [('id', 'in', ids)], context=context)
+        return partner_obj.name_get(cr, uid, ids, context=context)
 
     def reconcile_partial(self, cr, uid, ids, type='auto', context=None, writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False):
         move_rec_obj = self.pool.get('account.move.reconcile')