[REF]remove some unused lines and add some tips message

bzr revid: csn@openerp.com-20121127140359-pvf025717k4m2wsu
This commit is contained in:
Cedric Snauwaert 2012-11-27 15:03:59 +01:00
parent 7722389ade
commit 2d123cbdc6
4 changed files with 13 additions and 44 deletions

View File

@ -29,6 +29,10 @@
Asserts on accounting.
======================
With this module you can manually check consistencies and inconsistencies of accounting module from menu Reporting/Accounting/Accounting Tests.
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.
""",
'depends' : ['account'],
'data' : [
@ -37,9 +41,6 @@ With this module you can manually check consistencies and inconsistencies of acc
'account_test_report.xml',
'account_test_data.xml',
],
'demo': [
'account_test_demo.xml',
],
'active': False,
'installable': True
}

View File

@ -22,7 +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>
<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="desc">Check if the balance of the new opened fiscal year matches with last year's balance</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()
@ -92,7 +92,6 @@ records= cr.dictfetchall()
rec = [r['id'] for r in records]
res = reconciled_inv()
invoices = set(rec).difference(set(res))
groups = group(list(records),'number')
result = [rec for rec in records if rec['id'] in invoices]
if result:
result.insert(0,_('* Invoices that need to be checked: '))
@ -108,7 +107,6 @@ 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: '))

View File

@ -1,30 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="accounting.assert.test" id="account_test_demo_01">
<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,
sum(credit) as sum_credit,
sum(debit-credit) as balance,
am.id as move_id,
am.state,
am.period_id
FROM account_move am, account_move_line ml
WHERE
ml.move_id = am.id
AND
ml.state = 'valid'
GROUP BY am.name, am.id, am.state, am.period_id
HAVING abs(sum(ml.debit-ml.credit)) <> 0"""
cr.execute(sql)
result = cr.dictfetchall()
]]></field>
</record>
</data>
</openerp>

View File

@ -39,15 +39,15 @@
</group>
<group string="Code Help">
<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.
Code should always return a result value. If result is an empty list, it means that
the test is succesful. Otherwise it will print what is inside result.
Code must be python with correct indentation (if needed).
Here is a list of function that you can use in your test :
- group(lst, col) :
- reconciled_inv() : return the list of all reconciled invoices
- get_parent(acc_id) : get parent analytical account
- now() : return current datetime
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')'