From f677aa436ce3693cc030cf3bf6f44bcdf3a25123 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 6 Dec 2010 17:31:28 +0530 Subject: [PATCH] [IMP] account_voucher: Improve the code to get priority moves bzr revid: psi@tinyerp.co.in-20101206120128-jpl8ytja0r5uj7he --- addons/account_voucher/account_voucher.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 149e5641838..1dd361241ac 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -444,16 +444,14 @@ class account_voucher(osv.osv): moves = move_line_pool.browse(cr, uid, ids) priority_moves = [] + unpriority_moves = [] for line in moves: original_amount = line.credit or line.debit or 0.0 if original_amount == price: priority_moves.append(line) - - if priority_moves: - for line in moves: - if line not in priority_moves: - priority_moves.append(line) - moves = priority_moves + else: + unpriority_moves.append(line) + moves = priority_moves + unpriority_moves company_currency = journal.company_id.currency_id.id if company_currency != currency_id and ttype == 'payment':