From 27f614acc835e2ed8507983d1e874b582ac196e5 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 1 Jun 2011 12:56:41 +0530 Subject: [PATCH] [IMP]account_voucher: Can pay Sales Receipt multiple times bzr revid: ara@tinyerp.com-20110601072641-jh2336y9c6dxkj36 --- addons/account_voucher/account_voucher.py | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 5411fcd14da..f851b259378 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -145,18 +145,25 @@ class account_voucher(osv.osv): def _check_paid(self, cr, uid, ids, name, args, context=None): res = {} for id in ids: - res[id] = self.test_paid(cr, uid, [id], context=context) - return res - - def test_paid(self, cr, uid, ids, context): - ok = False - for voucher in self.browse(cr, uid, ids, context=context): - if voucher.pay_now == 'pay_later': + for voucher in self.browse(cr, uid, ids, context=context): for line in voucher.move_ids: if (line.account_id.type, 'in', ('receivable', 'payable')) and line.reconcile_id: - ok = True - elif voucher.pay_now == 'pay_now' and voucher.state == 'posted': - ok = True + res[id] = True + return res + +# def test_paid(self, cr, uid, ids, context): +# ok = False +# for voucher in self.browse(cr, uid, ids, context=context): +# for line in voucher.move_ids: +# if line.amount_residual: +# print ">>>", line.amount_residual +# ok = True +# if voucher.pay_now == 'pay_later': +# for line in voucher.move_ids: +# if (line.account_id.type, 'in', ('receivable', 'payable')) and line.reconcile_id: +# ok = True +# elif voucher.pay_now == 'pay_now' and voucher.state == 'posted': +# ok = True return ok def _compute_writeoff_amount(self, cr, uid, line_dr_ids, line_cr_ids, amount):