[ADD] account_test

bzr revid: qdp-launchpad@openerp.com-20121023111301-c41qvtxm1l5p0nq0
This commit is contained in:
Quentin (OpenERP) 2012-10-23 13:13:01 +02:00
parent d8e3f1d46b
commit 1498002350
12 changed files with 834 additions and 0 deletions

View File

@ -0,0 +1,2 @@
import account_test
import report

View File

@ -0,0 +1,42 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 CCI Connect asbl (http://www.cciconnect.be) All Rights Reserved.
# Philmer <philmer@cciconnect.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "OpenERP",
"version" : "1.0",
"author" : "OpenERP",
"category" : "Test accounting",
"website": "http://www.openerp.com",
"description": "Asserts on accounting",
"depends" : ["account"],
"update_xml" : [
"account_test_view.xml",
"account_test_report.xml",
"security/ir.model.access.csv",
"account_test_data.xml",
],
'demo_xml': [
"account_test_demo.xml",
],
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,65 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id: product_expiry.py 4304 2006-10-25 09:54:51Z ged $
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from osv import fields,osv
import pooler
import netsvc
import time
from xml import dom
CODE_EXEC_DEFAULT = '''\
res = []
cr.execute("select id, code from account_journal")
for record in cr.dictfetchall():
res.append(record['code'])
result = res
'''
class accounting_assert_test(osv.osv):
_name = "accounting.assert.test"
_order = "sequence"
_columns = {
'name': fields.char('Test Name', size=256, required=True, select=True, translate=True),
'desc': fields.text('Test Description', select=True, translate=True),
'code_exec': fields.text('Python code or SQL query', required=True),
'active': fields.boolean('Active'),
'sequence': fields.integer('Sequence'),
}
_defaults = {
'code_exec': lambda *a: CODE_EXEC_DEFAULT,
'active': lambda *a: True,
'sequence': lambda *a: 10,
}
accounting_assert_test()

View File

@ -0,0 +1,175 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="accounting.assert.test" id="account_test_01">
<field name="sequence">1</field>
<field name="name">Test 1: General balance</field>
<field name="desc">Check the balance: Debit sum = Credit sum</field>
<field name="code_exec"><![CDATA[sql="""SELECT
sum(debit)-sum(credit) as balance
FROM account_move_line
"""
cr.execute(sql)
result= cr.dictfetchall()
cr.execute(sql)
result=[]
res= cr.dictfetchall()
if res[0]['balance']!=0.0:
result=res
result.insert(0,_('* The difference of the balance is: '))
]]></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[res = []
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]['dedit_last_fyear']-rec[0]['dedit_new_fyear']!=0) :
res.append(rec[0])
res.insert(0,_('* New fiscalyear debit and credit are:'))
res.append(rec2[0])
res.insert(2,_('* Last year debit and credit are:'))
result = res
]]></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']
sql="""SELECT
am.id as move_id,
sum(debit)-sum(credit) as balance,
am.period_id,
ml.period_id,
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)
"""
cr.execute(sql)
res = cr.dictfetchall()
if res:
res.insert(0,_('* The test failed for these movement lines:'))
result = res
]]></field>
</record>
<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>
<field name="code_exec"><![CDATA[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'],))
reconcile_ids=cr.dictfetchall()
if reconcile_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):'))
]]></field>
</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;")
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: '))
]]></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: '))
]]></field>
</record>
<record model="accounting.assert.test" id="account_test_06">
<field name="sequence">7</field>
<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[
res = []
column_order = ['number','id','name','state']
if reconciled_inv():
cr.execute("select inv.name,inv.state,inv.id,inv.number from account_invoice inv where inv.state!='paid' and id in %s", (tuple(reconciled_inv()),))
res = cr.dictfetchall()
result = res
if result:
result.insert(0,_('* Invoices that need to be checked: '))
]]></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="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;")
result = cr.dictfetchall()
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>
<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 = []
cr.execute("SELECT l.id as move_line_id,a.name as account_name,a.code as account_code,r.name as partner_name,r.active as partner_active,p.name as period from account_period p,res_partner r, account_account a,account_move_line l where l.account_id=a.id and l.partner_id=r.id and (not r.active or not a.active) and l.period_id=p.id")
res = cr.dictfetchall()
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>

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="accounting.assert.test" id="account_test_demo_01">
<field name="name">Test 1</field>
<field name="desc">Test 1</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

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
id="account_assert_test_report"
model="accounting.assert.test"
name="account.test.assert.print"
rml="account_test/report/account_test.rml"
header="False"
string="Accounting Tests"/>
</data>
</openerp>

View File

@ -0,0 +1,56 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="account_assert_tree">
<field name="name">Tests</field>
<field name="model">accounting.assert.test</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Tests">
<field name="sequence"/>
<field name="name"/>
<field name="desc"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="account_assert_form">
<field name="name">Tests</field>
<field name="model">accounting.assert.test</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Tests">
<group colspan="4" col="4">
<field name="name"/>
<field name="active"/>
<field name="sequence"/>
<newline/>
<field name="desc" colspan="4" height="50" />
</group>
<separator string="Expression to evaluate" colspan="4"/>
<group colspan="4" col="4">
<separator string="Python Code" colspan="4" />
<newline />
<field colspan="4" name="code_exec" nolabel="1" width="100" height="400" />
<separator string="Code Help" colspan="4"/>
<newline />
<label colspan="4"><![CDATA[Example:
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()]]></label>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_accounting_assert">
<field name="name">Accounting Tests</field>
<field name="res_model">accounting.assert.test</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Accounting Tests" parent="account.menu_finance_reporting" id="menu_action_license" action="action_accounting_assert"/>
</data>
</openerp>

View File

@ -0,0 +1,264 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_test
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.16\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2011-11-13 15:05:26+0000\n"
"PO-Revision-Date: 2011-11-13 15:05:26+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_test
#: field:accounting.assert.test,desc:0
msgid "Test Description"
msgstr "Test Description"
#. module: account_test
#: constraint:ir.model:0
msgid "The Object name must start with x_ and not contain any special character !"
msgstr "Le nom de l'object doit commencer par x_ et ne doit pas contenir de caractères spéciaux !"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_02
msgid "Test 2: Opening a fiscal year"
msgstr "Test 2: Ouverture d'une année fiscale"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_03
msgid "Check if movement lines are balanced and have the same date and period"
msgstr "Vérifier que les lignes d'un même mouvement sont balancées, avec la même période et la même date"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_09_1
msgid "Test 9.1 : Gap in Invoices sequence"
msgstr "Test 9: Trous dans la numérotation des factures"
#. module: account_test
#: model:ir.actions.report.xml,name:account_test.account_assert_test_report
msgid "Accounting Tests"
msgstr "Tests Comptables"
#. module: account_test
#: field:accounting.assert.test,name:0
msgid "Test Name"
msgstr "Nom du test"
#. module: account_test
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr "Modèle non valide pour le définition de l'action"
#. module: account_test
#: field:accounting.assert.test,code_exec:0
msgid "Python code or SQL query"
msgstr "Code Python ou requête SQL"
#. module: account_test
#: rml:account.test.assert.print:0
msgid "Accouting tests on"
msgstr "Tests comptables sur"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_06
msgid "Check that paid/reconciled invoices are not in 'Open' state"
msgstr "Vérifier que les factures paid/reconcilied ne sont pas 'open'"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_11_2
msgid "Test 11.2: Analytical moves"
msgstr "Test 11.2: Lignes analytiques"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_09_2
msgid "Check that there's no gap in Bank Stetement sequence"
msgstr "Test 9: Trous dans la numérotation des extraits de comptes"
#. module: account_test
#: view:accounting.assert.test:0
msgid "Tests"
msgstr "Tests"
#. module: account_test
#: view:accounting.assert.test:0
msgid "Expression to evaluate"
msgstr "Expression à évaluer"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_06_1
msgid "Check that there's no move for any account with « View » account type"
msgstr "Vérifier qu'il n'y a pas de mouvements sur des comptes de type 'vue'"
#. module: account_test
#: model:ir.actions.act_window,name:account_test.action_accounting_assert
#: model:ir.ui.menu,name:account_test.menu_action_license
msgid "Accounting Tests"
msgstr "Tests Comptables"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_09_2
msgid "Test 9.2 : Gap in Bank Statement sequence"
msgstr "Test 9.2 : Trous dans la numérotation des extraits de comptes"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_01
msgid "Test 1: General balance"
msgstr "Test 1: Balance Générale"
#. module: account_test
#: model:ir.module.module,description:account_test.module_meta_information
msgid "Asserts on accounting"
msgstr "Asserts on accounting"
#. module: account_test
#: code:addons/account_test/report/account_test_report.py:0
#, python-format
msgid "The test was passed successfully"
msgstr "Le test est passé avec succès"
#. module: account_test
#: field:accounting.assert.test,active:0
msgid "Active"
msgstr "Active"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_06
msgid "Test 6 : Invoices status"
msgstr "Test 6: vérifier les factures"
#. module: account_test
#: model:ir.model,name:account_test.model_accounting_assert_test
msgid "accounting.assert.test"
msgstr "accounting.assert.test"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_05_2
msgid "Check that reconciled account moves, that define Payable and Receivable accounts, are belonging to reconciled invoices"
msgstr "Vérifier que les lignes de factures d'achat/vente réconciliées ont des écritures pour les comptes payables et recevables réconciliées"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_11_2
msgid "Check that amounts by analytical plan are equals to the amount of account move line"
msgstr "Vérifier que les montants par plan analytique sont égaux au montant de la ligne du mouvement comptable"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_11_1
msgid "Check that each account move line has at least 3 analytical moves"
msgstr "Vérifier que chaque ligne d'un mouvement comptable a au moins 3 lignes analytiques"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_07
msgid "Test 8 : Closing balance on bank statements"
msgstr "Test 8 : Vérification des lignes financières des extraits de comptes"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_07
msgid "Check on bank statement that the Closing Balance = Starting Balance + sum of statement lines"
msgstr "Vérifier que le solde de fin est égal au solde de début + la somme des mouvements"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_05
msgid "Test 5.1 : Payable and Receivable lines accounts of reconciled invoices"
msgstr "Test 5.1 : Vérification des lignes des comptes payables et recevables des factures réconciliées"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_03
msgid "Test 3: Movement lines"
msgstr "Test 3: Mouvements comptables"
#. module: account_test
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "XML Invalide pour cette vue"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_11_1
msgid "Test 11.1: Analytical moves"
msgstr "Test 11.1: Mouvements analytiques"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_05_2
msgid "Test 5.2 : Reconcilied invoices and Payable/Receivable accounts"
msgstr "Test 5.2 : Factures réconciliées et les lignes des comptes payables et recevables non réconciliées "
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_15
msgid "Test 15 : Analytical moves for Analytic multi plan"
msgstr "Test 15 : Mouvements analytiques"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_15
msgid "Check that analytic accounts used on lines are present in analytic sections of different plans"
msgstr "Vérifier que les centres de coûts présents dans les lignes sont bien présents dans les sections analytiques des différents plans"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_04
msgid "Test 4: Totally reconciled mouvements"
msgstr "Test 4: Vérification des reconcile complets"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_04
msgid "Check if the totally reconciled movements are balanced"
msgstr "Vérification des reconcile complets"
#. module: account_test
#: field:accounting.assert.test,sequence:0
msgid "Sequence"
msgstr "Séquence"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_02
msgid "Check if the balance of the new opened fiscal year matches with last year's balance"
msgstr "Vérifier que l'ouverture d'une année fiscale correspond au solde de l'année passée"
#. module: account_test
#: view:accounting.assert.test:0
msgid "Python Code"
msgstr "Code Python"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_08
msgid "Test 9 : Accounts and partners on account moves"
msgstr "Test 9 : Comptes et partenaires sur les mouvements comptables"
#. module: account_test
#: model:accounting.assert.test,name:account_test.account_test_06_1
msgid "Test 7: « View  » account type"
msgstr "Test 7: mouvements sur comptes type 'vue'"
#. module: account_test
#: model:ir.module.module,shortdesc:account_test.module_meta_information
msgid "OpenERP"
msgstr "OpenERP"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_05
msgid "Check that reconciled invoice for Sales/Purchases has reconciled entries for Payable and Receivable Accounts"
msgstr "Vérifier que les factures réconcilées ont des écritures comptables sur les comptes payables ou recevables réconciliées"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_09_1
msgid "Check that there's no gap in invoices sequence"
msgstr "Vérifier que les factures n'ont pas de trous dans leur numérotation"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_01
msgid "Check the balance: Debit sum = Credit sum"
msgstr "Vérifier la balance générale: somme débit = somme crédit"
#. module: account_test
#: model:accounting.assert.test,desc:account_test.account_test_14
msgid "Check that general accounts and partners on account moves are active"
msgstr "Vérifier que les comptes généraux ainsi que les partenaires renseignés sur les mouvements comptables sont actifs"
#. module: account_test
#: view:accounting.assert.test:0
msgid "Code Help"
msgstr "Code Help"

View File

@ -0,0 +1 @@
import account_test_report

View File

@ -0,0 +1,78 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tableau1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="1,1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,1" stop="1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#000000" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEAFTER" colorName="#000000" start="1,1" stop="1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Times-Roman" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Times-Roman" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<images/>
</stylesheet>
<story>
<para style="Heading">Accouting tests on [[ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") ]]</para>
<para style="Standard">
<font color="white"> </font>
</para>
<section>
<para style="Standard">[[repeatIn(objects,'o')]]</para>
<blockTable colWidths="482.0" style="Table1">
<tr>
<td>
<para style="Table Contents">[[ o.name ]]</para>
</td>
</tr>
<tr>
<td>
<para style="Table Contents"><i>[[ o.desc or '' ]]</i></para>
</td>
</tr>
</blockTable>
<blockTable colWidths="482.0" style="Tableau1">
<tr>
<td>
<para style="Table Contents">[[ repeatIn(execute_code(o.code_exec), 'test_result') ]]</para>
<para style="Table Contents">[[ test_result ]] </para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
</section>
</story>
</document>

View File

@ -0,0 +1,105 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import datetime
import time
import re
from report import report_sxw
from itertools import groupby
from operator import itemgetter
from tools.translate import _
#
# Use period and Journal for selection or resources
#
class report_assert_account(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_assert_account, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'datetime': datetime,
'execute_code': self.execute_code,
})
def execute_code(self, code_exec):
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)))
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
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:
acc_an_id = acc_an_id.parent_id
return acc_an_id.id
def order_columns(item, cols=None):
if cols is None:
cols = item.keys()
return [(col, item.get(col)) for col in cols if col in item.keys()]
localdict = {
'cr': self.cr,
'_': _,
'reconciled_inv' : reconciled_inv,
'group' : group,
'get_parent' : get_parent,
'now': datetime.datetime.now(),
'result': None,
'column_order': None,
}
exec code_exec in localdict
result = localdict['result']
column_order = localdict.get('column_order', None)
if not isinstance(result, (tuple, list, set)):
result = [result]
if not result:
result = [_('The test was passed successfully')]
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):
return ', '.join(["%s: %s" % (tup[0], tup[1]) for tup in order_columns(a, column_order)])
else:
return a
result = [_format(rec) for rec in result]
return result
report_sxw.report_sxw('report.account.test.assert.print', 'accounting.assert.test', 'addons/account_test/report/account_test.rml', parser=report_assert_account, header=False)

View File

@ -0,0 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_accounting_assert_test","accounting.assert.test","model_accounting_assert_test",base.group_system,1,1,1,1
"access_accounting_assert_test","accounting.assert.test","model_accounting_assert_test",account.group_account_manager,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_accounting_assert_test accounting.assert.test model_accounting_assert_test base.group_system 1 1 1 1
3 access_accounting_assert_test accounting.assert.test model_accounting_assert_test account.group_account_manager 1 0 0 0