From 2b0a7a577654a8d9db973a139f91e1bb31054f65 Mon Sep 17 00:00:00 2001 From: "Nimesh (Open ERP)" Date: Tue, 4 Dec 2012 15:31:06 +0530 Subject: [PATCH] [FIX] fix the problem of partial payment and purchase invoice will go to paid status even if the price is 0 in product. bzr revid: nco@tinyerp.com-20121204100106-64i2borf2dyj8jt8 --- addons/account/account_invoice.py | 7 +++++++ addons/account_voucher/account_voucher.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index f89f7828269..75ce4daef5b 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -674,6 +674,9 @@ class account_invoice(osv.osv): return super(account_invoice, self).copy(cr, uid, id, default, context) def test_paid(self, cr, uid, ids, *args): + for inv in self.browse(cr, uid, ids): + if inv.amount_total == 0.0: + return True res = self.move_line_id_payment_get(cr, uid, ids) if not res: return False @@ -851,6 +854,8 @@ class account_invoice(osv.osv): if context is None: context = {} for inv in self.browse(cr, uid, ids, context=context): + if inv.amount_total == 0.0: + continue if not inv.journal_id.sequence_id: raise osv.except_osv(_('Error!'), _('Please define sequence on the journal related to this invoice.')) if not inv.invoice_line: @@ -1037,6 +1042,8 @@ class account_invoice(osv.osv): self.write(cr, uid, ids, {}) for obj_inv in self.browse(cr, uid, ids, context=context): + if obj_inv.amount_total == 0.0: + continue id = obj_inv.id invtype = obj_inv.type number = obj_inv.number diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index ffc7cf1769d..f3a90b70f83 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -596,7 +596,7 @@ class account_voucher(osv.osv): This function returns True if the line is considered as noise and should not be displayed """ if line.reconcile_partial_id: - sign = 1 if ttype == 'receipt' else -1 + sign = 1 if ttype in ['payment', 'receipt'] else -1 if currency_id == line.currency_id.id: if line.amount_residual_currency * sign <= 0: return True