[FIX] account_voucher: this fixes voucher issues,
authorRifakat <rha@tinyerp.com>
Thu, 1 Nov 2012 11:09:48 +0000 (16:39 +0530)
committerRifakat <rha@tinyerp.com>
Thu, 1 Nov 2012 11:09:48 +0000 (16:39 +0530)
* now credit note lines can be seen on the paymner voucher so that any invoice can be paid against the credit note

lp bug: https://launchpad.net/bugs/1054052 fixed

bzr revid: rha@tinyerp.com-20121101110948-rt8tm5igxxf5jd2b

addons/account_voucher/account_voucher.py

index 6630f42..c612179 100644 (file)
@@ -600,7 +600,7 @@ class account_voucher(osv.osv):
             account_type = 'receivable'
 
         if not context.get('move_line_ids', False):
-            ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context)
+            ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id), ('journal_id.type', 'not in', ('bank', 'cash'))], context=context)
         else:
             ids = context['move_line_ids']
         invoice_id = context.get('invoice_id', False)
@@ -612,10 +612,6 @@ class account_voucher(osv.osv):
         account_move_lines = move_line_pool.browse(cr, uid, ids, context=context)
 
         for line in account_move_lines:
-            if line.credit and line.reconcile_partial_id and ttype == 'receipt':
-                continue
-            if line.debit and line.reconcile_partial_id and ttype == 'payment':
-                continue
             if invoice_id:
                 if line.invoice.id == invoice_id:
                     #if the invoice linked to the voucher line is equal to the invoice_id in context
@@ -641,10 +637,6 @@ class account_voucher(osv.osv):
 
         #voucher line creation
         for line in account_move_lines:
-            if line.credit and line.reconcile_partial_id and ttype == 'receipt':
-                continue
-            if line.debit and line.reconcile_partial_id and ttype == 'payment':
-                continue
             if line.currency_id and currency_id==line.currency_id.id:
                 amount_original = abs(line.amount_currency)
                 amount_unreconciled = abs(line.amount_residual_currency)