From 08b18426f8d2ee566f9991d2bb2c6a559b0a8217 Mon Sep 17 00:00:00 2001 From: richierichrawr Date: Sat, 17 May 2014 23:46:08 -0400 Subject: [PATCH] Docstrings and return value Method comments should be docstrings. check5() return else condition not in loop. --- .../wizard/account_automatic_reconcile.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index f6f0c90b1e2..2ad701a9bf5 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -59,9 +59,11 @@ class account_automatic_reconcile(osv.osv_memory): #TODO: cleanup and comment this code... For now, it is awfulllll # (way too complex, and really slow)... def do_reconcile(self, cr, uid, credits, debits, max_amount, power, writeoff_acc_id, period_id, journal_id, context=None): - # for one value of a credit, check all debits, and combination of them - # depending on the power. It starts with a power of one and goes up - # to the max power allowed + """ + for one value of a credit, check all debits, and combination of them + depending on the power. It starts with a power of one and goes up + to the max power allowed. + """ move_line_obj = self.pool.get('account.move.line') if context is None: context = {} @@ -87,11 +89,14 @@ class account_automatic_reconcile(osv.osv_memory): return res return False - # for a list of credit and debit and a given power, check if there - # are matching tuples of credit and debits, check all debits, and combination of them - # depending on the power. It starts with a power of one and goes up - # to the max power allowed + def check4(list1, list2, power): + """ + for a list of credit and debit and a given power, check if there + are matching tuples of credit and debits, check all debits, and combination of them + depending on the power. It starts with a power of one and goes up + to the max power allowed. + """ def check3(value, list1, list2, list1power, power): for i in range(len(list1)): move = list1[i] @@ -120,6 +125,7 @@ class account_automatic_reconcile(osv.osv_memory): res = check4(list1, list2, p) if res: return res + return False ok = True reconciled = 0