[FIX]some minor corrections and TODO comments

bzr revid: csn@openerp.com-20121120162930-hwj1ilshe99uvyau
This commit is contained in:
Cedric Snauwaert 2012-11-20 17:29:30 +01:00
parent 982223b577
commit d9c266eeb4
4 changed files with 18 additions and 14 deletions

View File

@ -56,9 +56,9 @@ class accounting_assert_test(osv.osv):
}
_defaults = {
'code_exec': lambda *a: CODE_EXEC_DEFAULT,
'active': lambda *a: True,
'sequence': lambda *a: 10,
'code_exec': CODE_EXEC_DEFAULT,
'active': True,
'sequence': 10,
}
accounting_assert_test()

View File

@ -30,7 +30,7 @@ cr.execute("select coalesce(sum(debit),0) as debit_new_fyear,coalesce(sum(credit
rec = cr.dictfetchall()
cr.execute("select coalesce(sum(debit),0) as debit_last_fyear,coalesce(sum(credit),0) as credit_last_fyear from account_move_line where period_id in (select period_id from account_fiscalyear where state='done' order by id desc limit 1);")
rec2= cr.dictfetchall()
if (rec2[0]['credit_last_fyear']-rec[0]['credit_new_fyear']!=0) or (rec2[0]['dedit_last_fyear']-rec[0]['dedit_new_fyear']!=0) :
if (rec2[0]['credit_last_fyear']-rec[0]['credit_new_fyear']!=0) or (rec2[0]['debit_last_fyear']-rec[0]['debit_new_fyear']!=0) :
res.append(rec[0])
res.insert(0,_('* New fiscalyear debit and credit are:'))
res.append(rec2[0])
@ -61,7 +61,7 @@ cr.execute(sql)
res = cr.dictfetchall()
if res:
res.insert(0,_('* The test failed for these movement lines:'))
result = res
result = res
]]></field>
</record>
@ -80,7 +80,7 @@ for record in rec_ids :
res.append(', '.join(["Reconcile name: %(name)s, id=%(id)s " % r for r in reconcile_ids]))
result = res
if result:
res.insert(0,_('* The test failed for these reconciled items(id/name):'))
result.insert(0,_('* The test failed for these reconciled items(id/name):'))
]]></field>
</record>
@ -101,18 +101,19 @@ if result:
]]></field>
</record>
<record model="accounting.assert.test" id="account_test_05_2">
<field name="sequence">6</field>
<field name="name">Test 5.2 : Reconcilied invoices and Payable/Receivable accounts</field>
<field name="desc">Check that reconciled account moves, that define Payable and Receivable accounts, are belonging to reconciled invoices</field>
<field name="code_exec"><![CDATA[res = reconciled_inv()
cr.execute("SELECT distinct inv.number,inv.id from account_invoice inv, account_move_line ml, account_account a, account_move m where m.id=ml.move_id and inv.move_id=m.id and inv.id=inv.move_id and ml.reconcile_id is null and a.type in ('receivable','payable') and ml.account_id=a.id and inv.id in %s",(tuple(res),))
records = cr.dictfetchall()
groups = group(list(records),'number')
result = [rec for rec in records]
if result:
result.insert(0,_('* Invoices that need to be checked: '))
result=[]
if res:
cr.execute("SELECT distinct inv.number,inv.id from account_invoice inv, account_move_line ml, account_account a, account_move m where m.id=ml.move_id and inv.move_id=m.id and inv.id=inv.move_id and ml.reconcile_id is null and a.type in ('receivable','payable') and ml.account_id=a.id and inv.id in %s",(tuple(res),))
records = cr.dictfetchall()
groups = group(list(records),'number')
result = [rec for rec in records]
if result:
result.insert(0,_('* Invoices that need to be checked: '))
]]></field>
</record>

View File

@ -38,6 +38,8 @@
<field colspan="4" name="code_exec" nolabel="1"/>
</group>
<group string="Code Help">
<!--TODO : better explanation on how to write those test, especially on variable result that must be present or
we won't see the result of the tests good or bad -->
<pre>
Example:
sql = 'select id, name, ref, date from account_move_line where account_id in

View File

@ -43,6 +43,7 @@ class report_assert_account(report_sxw.rml_parse):
def group(lst, col):
return dict((k, [v for v in itr]) for k, itr in groupby(sorted(lst, key=lambda x: x[col]), itemgetter(col)))
#TODO what is this method used for, name unclear and doesn't seem to be used
def sort_by_intified_num(a, b):
if a is None:
return -1
@ -56,7 +57,6 @@ class report_assert_account(report_sxw.rml_parse):
reconciled_inv_ids = self.pool.get('account.invoice').search(self.cr, self.uid, [('reconciled','=',True)])
return reconciled_inv_ids
def get_parent(acc_id):
acc_an_id = self.pool.get('account.analytic.account').browse(self.cr, self.uid, acc_id).parent_id
while acc_an_id.parent_id:
@ -89,6 +89,7 @@ class report_assert_account(report_sxw.rml_parse):
if not result:
result = [_('The test was passed successfully')]
#TODO: not sure this condition is needed, it is only a subcategory of the final else
elif all([isinstance(x, dict) for x in result]):
result = [', '.join(["%s: %s" % (k, v) for k, v in order_columns(rec, column_order)]) for rec in result]
else: