summaryrefslogtreecommitdiff
path: root/addons/account_test/account_test_data.xml
diff options
context:
space:
mode:
Diffstat (limited to 'addons/account_test/account_test_data.xml')
-rw-r--r--addons/account_test/account_test_data.xml76
1 files changed, 22 insertions, 54 deletions
diff --git a/addons/account_test/account_test_data.xml b/addons/account_test/account_test_data.xml
index 4970bef6a0d..73bef38240b 100644
--- a/addons/account_test/account_test_data.xml
+++ b/addons/account_test/account_test_data.xml
@@ -1,6 +1,5 @@
-<?xml version="1.0"?>
-<openerp>
-<data>
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
<record model="accounting.assert.test" id="account_test_01">
<field name="sequence">1</field>
@@ -19,41 +18,23 @@ if res[0]['balance']!=0.0 and res[0]['balance'] is not None:
]]></field>
</record>
- <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">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()
-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]['debit_last_fyear']-rec[0]['debit_new_fyear']!=0) :
- result.append(_('* New fiscalyear debit and credit are:'))
- result.append(rec[0])
- result.append(_('* Last year debit and credit are:'))
- result.append(rec2[0])
-
-]]></field>
- </record>
-
<record model="accounting.assert.test" id="account_test_03">
<field name="sequence">3</field>
<field name="name">Test 3: Movement lines</field>
<field name="desc">Check if movement lines are balanced and have the same date and period</field>
- <field name="code_exec"><![CDATA[order_columns=['am_date','ml_date','am.period_id','ml.period_id','am.id']
+ <field name="code_exec"><![CDATA[order_columns=['am_date','ml_date','am.date','ml.date','am.id']
sql="""SELECT
am.id as move_id,
sum(debit)-sum(credit) as balance,
- am.period_id,
- ml.period_id,
+ am.date,
+ ml.date,
am.date as am_date,
ml.date as ml_date
FROM account_move am, account_move_line ml
WHERE
ml.move_id = am.id
-GROUP BY am.name, am.id, am.state, am.period_id, ml.period_id,am.period_id, ml.period_id,am.date, ml.date
-HAVING abs(sum(ml.debit-ml.credit)) <> 0 or am.period_id!=ml.period_id or (am.date!=ml.date)
+GROUP BY am.name, am.id, am.state, am.date, ml.date,am.date, ml.date,am.date, ml.date
+HAVING abs(sum(ml.debit-ml.credit)) <> 0 or am.date!=ml.date or (am.date!=ml.date)
"""
cr.execute(sql)
res = cr.dictfetchall()
@@ -64,7 +45,8 @@ result = res
]]></field>
</record>
- <record model="accounting.assert.test" id="account_test_04">
+<!-- TODO: rewrite test since the model of reconciliation has changed -->
+<!-- <record model="accounting.assert.test" id="account_test_04">
<field name="sequence">4</field>
<field name="name">Test 4: Totally reconciled mouvements</field>
<field name="desc">Check if the totally reconciled movements are balanced</field>
@@ -72,7 +54,7 @@ result = res
cr.execute("SELECT distinct reconcile_id from account_move_line where reconcile_id is not null")
rec_ids = cr.dictfetchall()
for record in rec_ids :
- cr.execute("SELECT distinct r.name,r.id from account_journal j,account_period p, account_move_reconcile r,account_move m, account_move_line ml where m.journal_id=j.id and m.period_id=p.id and ml.reconcile_id=%s and ml.move_id=m.id and ml.reconcile_id=r.id group by r.id,r.name having sum(ml.debit)-sum(ml.credit)<>0", (record['reconcile_id'],))
+ cr.execute("SELECT distinct r.name,r.id from account_journal j,account_period p, account_move_reconcile r,account_move m, account_move_line ml where m.journal_id=j.id and m.date=p.id and ml.reconcile_id=%s and ml.move_id=m.id and ml.reconcile_id=r.id group by r.id,r.name having sum(ml.debit)-sum(ml.credit)<>0", (record['reconcile_id'],))
reconcile_ids=cr.dictfetchall()
if reconcile_ids:
res.append(', '.join(["Reconcile name: %(name)s, id=%(id)s " % r for r in reconcile_ids]))
@@ -80,14 +62,14 @@ result = res
if result:
result.insert(0,_('* The test failed for these reconciled items(id/name):'))
]]></field>
- </record>
+ </record> -->
<record model="accounting.assert.test" id="account_test_05">
<field name="sequence">5</field>
<field name="name">Test 5.1 : Payable and Receivable accountant lines of reconciled invoices</field>
<field name="desc">Check that reconciled invoice for Sales/Purchases has reconciled entries for Payable and Receivable Accounts</field>
<field name="code_exec"><![CDATA[res = []
-cr.execute("SELECT distinct inv.number,inv.id from account_invoice inv, account_move m, account_move_line ml, account_account a where m.id=ml.move_id and ml.account_id=a.id and a.type in ('receivable','payable') and inv.move_id=m.id and ml.reconcile_id is not null;")
+cr.execute("SELECT distinct inv.number,inv.id from account_invoice inv, account_move m, account_move_line ml, account_account a where m.id=ml.move_id and ml.account_id=a.id and a.internal_type in ('receivable','payable') and inv.move_id=m.id and ml.reconciled is true;")
records= cr.dictfetchall()
rec = [r['id'] for r in records]
res = reconciled_inv()
@@ -105,7 +87,7 @@ if result:
<field name="code_exec"><![CDATA[res = reconciled_inv()
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),))
+ 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.reconciled is false and a.internal_type in ('receivable','payable') and ml.account_id=a.id and inv.id in %s",(tuple(res),))
records = cr.dictfetchall()
result = [rec for rec in records]
if result:
@@ -118,6 +100,7 @@ if res:
<field name="name">Test 6 : Invoices status</field>
<field name="desc">Check that paid/reconciled invoices are not in 'Open' state</field>
<field name="code_exec"><![CDATA[
+from openerp import _
res = []
column_order = ['number','id','name','state']
if reconciled_inv():
@@ -129,23 +112,9 @@ if result:
]]></field>
</record>
-
- <record model="accounting.assert.test" id="account_test_06_1">
- <field name="sequence">8</field>
- <field name="name">Test 7: « View  » account type</field>
- <field name="desc">Check that there's no move for any account with « View » account type</field>
- <field name="code_exec"><![CDATA[column_order=['name','ref','id','date']
-sql = "select id, name, ref, date from account_move_line where account_id in (select id from account_account where type = 'view')"
-cr.execute(sql)
-result = cr.dictfetchall()
-if result:
- result.insert(0,_('* Movement lines that need to be checked: '))
-]]></field>
- </record>
-
<record model="accounting.assert.test" id="account_test_07">
- <field name="sequence">9</field>
- <field name="name">Test 8 : Closing balance on bank statements</field>
+ <field name="sequence">8</field>
+ <field name="name">Test 7 : Closing balance on bank statements</field>
<field name="desc">Check on bank statement that the Closing Balance = Starting Balance + sum of statement lines</field>
<field name="code_exec"><![CDATA[column_order = ['name','difference']
cr.execute("SELECT s.balance_start+sum(m.amount)-s.balance_end_real as difference, s.name from account_bank_statement s inner join account_bank_statement_line m on m.statement_id=s.id group by s.id, s.balance_start, s.balance_end_real,s.name having abs(s.balance_start+sum(m.amount)-s.balance_end_real) > 0.000000001;")
@@ -154,10 +123,10 @@ if result:
result.insert(0,_('* Unbalanced bank statement that need to be checked: '))
]]></field>
</record>
-
- <record model="accounting.assert.test" id="account_test_08">
- <field name="sequence">10</field>
- <field name="name">Test 9 : Accounts and partners on account moves</field>
+ <!-- TODO account.period has been removed -->
+ <!-- <record model="accounting.assert.test" id="account_test_08">
+ <field name="sequence">9</field>
+ <field name="name">Test 8 : Accounts and partners on account moves</field>
<field name="desc">Check that general accounts and partners on account moves are active</field>
<field name="code_exec"><![CDATA[column_order=['partner_name','partner_active','account_name','move_line_id','period']
res = []
@@ -167,6 +136,5 @@ result = res
if result:
result.insert(0,_('* Here is the list of inactive partners and movement lines that are not correct: '))
]]></field>
- </record>
-</data>
-</openerp>
+ </record> -->
+</odoo>