[IMP] improved description of consistency test, code help and removed unused functions and condition
bzr revid: bde@tinyerp.com-20121127094911-rnidlbk1obfc48tm
This commit is contained in:
parent
3b3c32f58f
commit
7722389ade
|
@ -22,8 +22,7 @@ if res[0]['balance']!=0.0 and res[0]['balance'] is not None:
|
|||
<record model="accounting.assert.test" id="account_test_02">
|
||||
<field name="sequence">2</field>
|
||||
<field name="name">Test 2: Opening a fiscal year</field>
|
||||
<!--TODO : bad description of the test, does not really match what the SQL querry does, should adapt description name -->
|
||||
<field name="desc">Check if the balance of the new opened fiscal year matches with last year's balance</field>
|
||||
<field name="desc">Displays the debit and credit amount, of closed and newly created fiscal year, if the balance of current and newly created fiscal year mismatch</field>
|
||||
<field name="code_exec"><![CDATA[result = []
|
||||
cr.execute("select coalesce(sum(debit),0) as debit_new_fyear,coalesce(sum(credit),0) as credit_new_fyear from account_move_line where period_id in (select id from account_period where state='draft' and special order by id desc limit 1);")
|
||||
rec = cr.dictfetchall()
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<data>
|
||||
|
||||
<record model="accounting.assert.test" id="account_test_demo_01">
|
||||
<!-- TODO : change name and desc -->
|
||||
<field name="name">Test 1</field>
|
||||
<field name="desc">Test 1</field>
|
||||
<field name="sequence">11</field>
|
||||
<field name="name">Test 11: Consistency check between Account Move and Account Move Line</field>
|
||||
<field name="desc">Checks id of 'account_move' = move_id of 'account_move_line', and state of 'account_move_line' is valid, and having sum(debit-credit) != 0</field>
|
||||
<field name="domain_exec"></field>
|
||||
<field name="code_exec"><![CDATA[sql="""SELECT
|
||||
sum(debit) as sum_debit,
|
||||
|
|
|
@ -38,10 +38,16 @@
|
|||
<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, give detail on function that can be used, like
|
||||
'group(a,b)' 'reconciled_inv()' 'get_parent(a)' 'now()' ... -->
|
||||
<pre>
|
||||
You can write a query in order to create Consistency Test and you will get the result of the test
|
||||
in PDF format which can be accessed by Menu Reporting -> Accounting Tests, then select the test
|
||||
and print the report from Print button in header area.
|
||||
|
||||
You can also use the following functions:
|
||||
|
||||
get_parent(acc_id) : return parent id of analytic account(acc_id)
|
||||
reconciled_inv() : returns ids of records which are reconciled
|
||||
|
||||
Example:
|
||||
sql = 'select id, name, ref, date from account_move_line where account_id in
|
||||
(select id from account_account where type = 'view')'
|
||||
|
|
|
@ -43,16 +43,6 @@ 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
|
||||
elif b is None:
|
||||
return 1
|
||||
else:
|
||||
#if a is not None and b is not None:
|
||||
return cmp(int(a), int(b))
|
||||
|
||||
def reconciled_inv():
|
||||
reconciled_inv_ids = self.pool.get('account.invoice').search(self.cr, self.uid, [('reconciled','=',True)])
|
||||
return reconciled_inv_ids
|
||||
|
@ -86,12 +76,8 @@ class report_assert_account(report_sxw.rml_parse):
|
|||
|
||||
if not isinstance(result, (tuple, list, set)):
|
||||
result = [result]
|
||||
|
||||
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:
|
||||
def _format(a):
|
||||
if isinstance(a, dict):
|
||||
|
|
Loading…
Reference in New Issue