From d7e0e18d7f7499b0129cf7f9c1cd233481fe5ec4 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 18 Jun 2010 13:58:11 +0530 Subject: [PATCH] [FIX] account: pay and reconcile with creation of move with good type bzr revid: mra@mra-laptop-20100618082811-ky4wb3w14f8sd6iw --- addons/account/invoice.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index c895529b760..a55a0299169 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1077,16 +1077,18 @@ class account_invoice(osv.osv): amount_currency = False currency_id = False + pay_journal = self.pool.get('account.journal').read(cr, uid, pay_journal_id, ['type'], context=context) + if invoice.type in ('in_invoice', 'out_invoice'): + if pay_journal['type'] == 'bank': + entry_type = 'bank_pay_voucher' # Bank payment + else: + entry_type = 'pay_voucher' # Cash payment + else: + entry_type = 'cont_voucher' if invoice.type in ('in_invoice', 'in_refund'): ref = invoice.reference - entry_type = 'journal_pur_voucher' - if invoice.type == 'in_refund': - entry_type = 'cont_voucher' else: ref = self._convert_ref(cr, uid, invoice.number) - entry_type = 'journal_sale_vou' - if invoice.type == 'out_refund': - entry_type = 'cont_voucher' # Pay attention to the sign for both debit/credit AND amount_currency l1 = {