New Module:

account_report: fiscal statement and reports /+ indicators
L10N_BE:
	demo data for fiscal report:
		bilan
		compte des r?\233sultats
		Indicateurs

bzr revid: fp@tinyerp.com-23e471e88a1d7b0e23304ab674652c87e8b737c5
This commit is contained in:
Fabien Pinckaers 2007-04-24 17:22:54 +00:00
parent 821d591125
commit 2f2eb64099
7 changed files with 360 additions and 3 deletions

View File

@ -0,0 +1,29 @@
##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# 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.
#
##############################################################################
import account

View File

@ -0,0 +1,17 @@
{
"name" : "Reporting for accounting",
"version" : "1.0",
"depends" : ["account"],
"author" : "Tiny",
"description": """Financial and accounting reporting""",
"website" : "http://tinyerp.com/module_account.html",
"category" : "Generic Modules/Accounting",
"init_xml" : [ ],
"demo_xml" : [ ],
"update_xml" : [ "account_view.xml" ],
# "translations" : {
# "fr": "i18n/french_fr.csv"
# },
"active": False,
"installable": True
}

View File

@ -0,0 +1,148 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
#
# 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.
#
##############################################################################
import time
import netsvc
from osv import fields, osv
from tools.misc import currency
import mx.DateTime
from mx.DateTime import RelativeDateTime, now, DateTime, localtime
class account_report(osv.osv):
_name = "account.report.report"
_description = "Account reporting"
def _amount_get(self, cr, uid, ids, field_name, arg, context={}):
def _calc_credit(*code):
acc = self.pool.get('account.account')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0)
def _calc_debit(*code):
acc = self.pool.get('account.account')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0)
def _calc_balance(*code):
acc = self.pool.get('account.account')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.balance+y, acc.browse(cr, uid, acc_id, context),0)
def _calc_report(*code):
acc = self.pool.get('account.report.report')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0)
result = {}
for rep in self.browse(cr, uid, ids, context):
objdict = {
'debit': _calc_debit,
'credit': _calc_credit,
'balance': _calc_balance,
'report': _calc_report,
}
if field_name=='status':
fld_name = 'expression_status'
else:
fld_name = 'expression'
try:
val = eval(getattr(rep, fld_name), objdict)
except:
val = 0.0
if field_name=='status':
if val<-1:
result[rep.id] = 'very bad'
elif val<0:
result[rep.id] = 'bad'
elif val==0:
result[rep.id] = 'normal'
elif val<1:
result[rep.id] = 'good'
else:
result[rep.id] = 'excellent'
else:
result[rep.id] = val
return result
def onchange_parent_id(self, cr, uid, ids, parent_id):
v={}
if parent_id:
acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
v['type']=acc.type
if int(acc.style)<6:
v['style']=str(int(acc.style)+1)
return {'value':v}
_columns = {
'name': fields.char('Name', size=64, required=True),
'active': fields.boolean('Active'),
'sequence': fields.integer('Sequence'),
'code': fields.char('Code', size=64, required=True),
'type': fields.selection([('fiscal', 'Fiscal statement'),('indicator','Indicator'),('other','Others')], 'Type', required=True),
'expression': fields.char('Expression', size=240, required=True),
'expression_status': fields.char('Status expression', size=240, required=True),
'parent_id': fields.many2one('account.report.report', 'Parent'),
'child_ids': fields.one2many('account.report.report', 'parent_id', 'Childs'),
'note': fields.text('Note'),
'amount': fields.function(_amount_get, method=True, string='Value'),
'status': fields.function(_amount_get,
method=True,
type="selection",
selection=[
('very bad', 'Very Bad'),
('bad', 'Bad'),
('normal', ''),
('good', 'Good'),
('excellent', 'Excellent')
],
string='Status'
),
'style': fields.selection([('1','Header 1'), ('2','Header 2'), ('3','Header 3'), ('4','Header 4'), ('5','Normal'), ('6', 'Small')], 'Style', required=True),
}
_defaults = {
'style': lambda *args: '5',
'active': lambda *args: True,
'type': lambda *args: 'indicator'
}
def name_search(self, cr, user, name, args=[], operator='ilike', context={}):
ids = []
if name:
ids = self.search(cr, user, [('code','=',name)]+ args)
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args)
else:
ids = self.search(cr, user, args)
return self.name_get(cr, user, ids, context=context)
#
# Put an expression to valid expression and expression_status
#
_constraints = [
]
_sql_constraints = [
('code_uniq', 'unique (code)', 'The code of the report entry must be unique !')
]
account_report()

View File

@ -0,0 +1,143 @@
<?xml version="1.0"?>
<terp>
<data>
<record model="ir.ui.view" id="view_account_report_form">
<field name="name">account.report.report.form</field>
<field name="model">account.report.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Accounting reporting">
<notebook>
<page string="General">
<field name="name" select="1" colspan="3"/>
<field name="code" select="1"/>
<field name="active" select="1"/>
<field name="parent_id" on_change="onchange_parent_id(parent_id)"/>
<field name="sequence"/>
<field name="type" select="1"/>
<field name="style"/>
<newline/>
<field name="expression" colspan="4"/>
<field name="expression_status" colspan="4"/>
<separator string="Legend of operators" colspan="4"/>
<label string="Account cebit:" align="1.0"/>
<label string="debit('ACCOUNT_CODE')" align="0.0"/>
<label string="Account credit:" align="1.0"/>
<label string="credit('ACCOUNT_CODE')" align="0.0"/>
<label string="Account balance:" align="1.0"/>
<label string="balance('ACCOUNT_CODE')" align="0.0"/>
<label string="Report amount:" align="1.0"/>
<label string="report('REPORT_CODE')" align="0.0"/>
<label string="Operators:" align="1.0"/>
<label string="+ - * / ( )" align="0.0"/>
<label string="Exemple: (balance('6','45') - credit('7')) / report('RPT1')" colspan="4"/>
<separator string="Return value for status" colspan="4"/>
<group colspan="1" col="2">
<label string="&lt; -1:" align="1.0"/>
<label string="Very bad" align="0.0"/>
<label string="-1:" align="1.0"/>
<label string="Bad" align="0.0"/>
<label string="0:" align="1.0"/>
<label string="Normal" align="0.0"/>
<label string="1:" align="1.0"/>
<label string="Good" align="0.0"/>
<label string="&gt; 1:" align="1.0"/>
<label string="Very Good" align="0.0"/>
</group>
</page><page string="Notes">
<field name="note" nolabel="1" colspan="4"/>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_account_report_form">
<field name="name">account.report.report.form</field>
<field name="res_model">account.report.report</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem
name="Financial Management/Configuration/Reporting"
id="menu_action_account_report_form"
action="action_account_report_form"/>
<record model="ir.actions.act_window" id="action_account_report_tree">
<field name="name">account.report.report.tree</field>
<field name="res_model">account.report.report</field>
<field name="view_type">tree</field>
</record>
<menuitem
name="Financial Management/Configuration/Reporting/Structured reporting"
id="menu_action_account_report_tree_define"
action="action_account_report_tree"/>
<record model="ir.ui.view" id="view_account_report_tree">
<field name="name">account.report.report.tree</field>
<field name="model">account.report.report</field>
<field name="type">tree</field>
<field name="priority" eval="8"/>
<field name="field_parent">child_ids</field>
<field name="arch" type="xml">
<tree string="Accounting reporting">
<field name="code"/>
<field name="name"/>
<field name="status"/>
<field name="amount"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_account_report_tree_view">
<field name="name">account.report.report.tree</field>
<field name="res_model">account.fiscalyear</field>
<field name="view_type">tree</field>
<field name="view_id" ref="view_account_report_tree"/>
<field name="domain">[('parent_id','=',False)]</field>
</record>
<menuitem
name="Financial Management/Reporting/Account reportings"
id="menu_action_account_report_tree_view"
action="action_account_report_tree_view"/>
<record model="ir.actions.act_window" id="action_account_report_tree_view_fiscal">
<field name="name">account.report.report.tree</field>
<field name="res_model">account.fiscalyear</field>
<field name="view_type">tree</field>
<field name="view_id" ref="view_account_report_tree"/>
<field name="domain">[('type','=','fiscal'),('parent_id','=',False)]</field>
</record>
<menuitem
name="Financial Management/Reporting/Account reportings/Fiscal Statements"
id="menu_action_account_report_tree_view_fiscal"
action="action_account_report_tree_view_fiscal"/>
<record model="ir.actions.act_window" id="action_account_report_tree_view_indicator">
<field name="name">account.report.report.tree</field>
<field name="res_model">account.fiscalyear</field>
<field name="view_type">tree</field>
<field name="view_id" ref="view_account_report_tree"/>
<field name="domain">[('type','=','indicator'),('parent_id','=',False)]</field>
</record>
<menuitem
name="Financial Management/Reporting/Account reportings/Indicators"
id="menu_action_account_report_tree_view_indicator"
action="action_account_report_tree_view_indicator"/>
<record model="ir.actions.act_window" id="action_account_report_tree_view_other">
<field name="name">account.report.report.tree</field>
<field name="res_model">account.fiscalyear</field>
<field name="view_type">tree</field>
<field name="view_id" ref="view_account_report_tree"/>
<field name="domain">[('type','=','other'),('parent_id','=',False)]</field>
</record>
<menuitem
name="Financial Management/Reporting/Account reportings/Others"
id="menu_action_account_report_tree_view_other"
action="action_account_report_tree_view_other"/>
</data>
</terp>

View File

@ -148,7 +148,6 @@ class account_invoice_line(osv.osv):
cur_obj = self.pool.get('res.currency')
ait_obj = self.pool.get('account.invoice.tax')
cur = inv.currency_id
for line in inv.invoice_line:
price_unit = line.price_unit
if line.product_id:

View File

@ -3,9 +3,9 @@
"version" : "1.0",
"author" : "Tiny",
"category" : "Localisation/Account charts",
"depends" : ["base", "account"],
"depends" : ["base", "account", "account_report"],
"init_xml" : [],
"demo_xml" : ["account_demo.xml"],
"demo_xml" : ["account_demo.xml","account.report.report.csv"],
"update_xml" : ["account_pcmn_belgium.xml"],
"active": False,
"installable": True

View File

@ -0,0 +1,21 @@
expression,note,parent_id,sequence,expression_status,style,type,code,name
0,,,,0,1,indicator,BILAN,Bilan
"report('BIMMO','BSTOCK','BREAL','BDISPO')",,BILAN,,0,2,fiscal,Actif,Actif
balance('2'),,Actif,,0,3,indicator,BIMMO,Valeurs immobilisées
balance('3'),,Actif,2,0,3,indicator,BSTOCK,Stocks
balance('4'),,Actif,3,0,3,indicator,BREAL,Réalisable
balance('5'),,Actif,4,0,3,fiscal,BDISPO,Disponible
report('BCAP') + report('BRESNET'),,BILAN,1,0,2,fiscal,PASSIF,Passif
balance('1'),,PASSIF,1,0,5,indicator,BCAP,Capitaux propores
-balance('7')+balance('6'),,PASSIF,,0,3,fiscal,BRESNET,Résultat net
0,,,,0,1,fiscal,CRES,Compte des résultats
"report('CCHAR','CBENEF')",,CRES,,0,2,fiscal,CRESACTIF,Résultat Actif
balance('6'),,CRESACTIF,,0,2,fiscal,CCHAR,Total des charges
report('CRESPROD'),,CRES,,0,2,fiscal,CRESPASSIF,Résultat Passif
-balance('7'),,CRESPASSIF,,0,2,fiscal,CRESPROD,Total des produits
-balance('7')+balance('6'),,CRESACTIF,,0,2,fiscal,CBENEF,Résultat (Bénéfice)
0,,,,0,3,indicator,IIMMO,Immobilisations
"balance('1')/balance(map(str(range(21,29))))","Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité.",IIMMO,,"balance('1')/balance(map(str(range(21,29)))) - 1",3,indicator,CIMMO,Couverture des immobilisations
0,,,,0,2,indicator,ITRE,Trésorerie
"balance('3','4','5') / balance('101','13','15','16','17','18')",Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme,ITRE,,"balance('3','4','5') / balance('101','13','15','16','17','18')",3,indicator,IFR,Indice du fond de roulement
"balance('4','5') / balance('101','13','15','16','17','18')",,ITRE,,"balance('4','5') / balance('101','13','15','16','17','18')",5,indicator,RTRE,Ratio de trésorerie
1 expression note parent_id sequence expression_status style type code name
2 0 0 1 indicator BILAN Bilan
3 report('BIMMO','BSTOCK','BREAL','BDISPO') BILAN 0 2 fiscal Actif Actif
4 balance('2') Actif 0 3 indicator BIMMO Valeurs immobilisées
5 balance('3') Actif 2 0 3 indicator BSTOCK Stocks
6 balance('4') Actif 3 0 3 indicator BREAL Réalisable
7 balance('5') Actif 4 0 3 fiscal BDISPO Disponible
8 report('BCAP') + report('BRESNET') BILAN 1 0 2 fiscal PASSIF Passif
9 balance('1') PASSIF 1 0 5 indicator BCAP Capitaux propores
10 -balance('7')+balance('6') PASSIF 0 3 fiscal BRESNET Résultat net
11 0 0 1 fiscal CRES Compte des résultats
12 report('CCHAR','CBENEF') CRES 0 2 fiscal CRESACTIF Résultat Actif
13 balance('6') CRESACTIF 0 2 fiscal CCHAR Total des charges
14 report('CRESPROD') CRES 0 2 fiscal CRESPASSIF Résultat Passif
15 -balance('7') CRESPASSIF 0 2 fiscal CRESPROD Total des produits
16 -balance('7')+balance('6') CRESACTIF 0 2 fiscal CBENEF Résultat (Bénéfice)
17 0 0 3 indicator IIMMO Immobilisations
18 balance('1')/balance(map(str(range(21,29)))) Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité. IIMMO balance('1')/balance(map(str(range(21,29)))) - 1 3 indicator CIMMO Couverture des immobilisations
19 0 0 2 indicator ITRE Trésorerie
20 balance('3','4','5') / balance('101','13','15','16','17','18') Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme ITRE balance('3','4','5') / balance('101','13','15','16','17','18') 3 indicator IFR Indice du fond de roulement
21 balance('4','5') / balance('101','13','15','16','17','18') ITRE balance('4','5') / balance('101','13','15','16','17','18') 5 indicator RTRE Ratio de trésorerie