From c9fee124ca40ee60a45280f9a3d654c342e687ca Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 27 Jan 2011 16:56:19 +0530 Subject: [PATCH] [FIX] Account_voucher: Reconcile with Write-Off => For write off option now it will consider amount_reconciled instead of amount on voucher line and if you pay via write off option and your amount=0 then it will consider voucher line now lp bug: https://launchpad.net/bugs/706107 fixed bzr revid: mra@mra-laptop-20110127112619-89hvzyc4ct3e34ws --- addons/account_voucher/account_voucher.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 886848c0902..bf5f059a376 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -722,13 +722,16 @@ class account_voucher(osv.osv): for line in inv.line_ids: #create one move line per voucher line where amount is not 0.0 - if not line.amount: + if not line.amount and not inv.payment_option == 'with_writeoff': continue #we check if the voucher line is fully paid or not and create a move line to balance the payment and initial invoice if needed if line.amount == line.amount_unreconciled: amount = line.move_line_id.amount_residual #residual amount in company currency else: - amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency) + if inv.payment_option == 'with_writeoff': + amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.amount_unreconciled or line.amount, context=context_multi_currency) + else: + amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency) move_line = { 'journal_id': inv.journal_id.id, 'period_id': inv.period_id.id, @@ -749,7 +752,6 @@ class account_voucher(osv.osv): line.type = 'cr' else: line.type = 'dr' - if (line.type=='dr'): line_total += amount move_line['debit'] = amount