bzr revid: fp@tinyerp.com-20081014134146-0l4daj8ylf4b1k7y
This commit is contained in:
Fabien Pinckaers 2008-10-14 15:41:46 +02:00
commit be6cbdf7a2
10 changed files with 2287 additions and 1603 deletions

View File

@ -130,7 +130,7 @@
<font color="white">[[ data['form']['page_split'] == True or removeParentNode('para') ]] </font>
<font color="white">[[ repeatIn(objects, 'p') ]] [[ setLang(p.partner_id.lang) ]]</font>
</para>
<blockTable colWidths="50.0,37.0,120.0,135.0,69.0,72.0,63.0" repeatRows="1" style="tbl_heading">
<blockTable colWidths="50.0,30.0,42.0,220.0,69.0,72.0,63.0" repeatRows="1" style="tbl_heading">
<tr>
<td>
@ -202,7 +202,7 @@
</td>
</tr>
</blockTable>
<blockTable colWidths="45.0,37.0,120.0,135.0,69.0,72.0,63.0" style="Table2">
<blockTable colWidths="45.0,30.0,42.0,220.0,69.0,72.0,63.0" style="Table2">
<tr>
<td>
<para style="P15"><font face="Helvetica">[[ repeatIn(lines(p,data), 'line') ]]</font>[[ line['date'] ]]</para>

View File

@ -1,3 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
@ -35,50 +36,187 @@ from crm.report import report_businessopp
from report.interface import report_int
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
import reportlab.lib.colors
import reportlab.lib.colors as colors
#from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection
#from reportlab.graphics.charts.textlabels import BarChartLabel
#from reportlab.graphics import renderPM
import tools
class accounting_report1(report_sxw.rml_parse):
parents = {
'tr':1,
'li':1,
'story': 0,
'section': 0
}
class accounting_report_indicator(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(accounting_report1, self).__init__(cr, uid, name, context)
super(accounting_report_indicator, self).__init__(cr, uid, name, context)
self.ret_list = []
self.localcontext.update({
'time': time,
'test': self.test1,
# 'childs':self.process
'lines':self.lines,
'getarray':self.getarray,
})
self.count=0
self.list=[]
self.header_name=self.header_val=[]
def test1(self):
drawing = Drawing(400, 200)
def repeatIn(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[]):
self._node.data = ''
node = self._find_parent(self._node, nodes_parent or parents)
ns = node.nextSibling
#start
if not name=='array':
return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False)
value=['X-Axis']
value.extend(self.header_name)
type=['string'].extend(['float']*len(self.header_name))
width=[40]*(len(self.header_name)+1)
if not lst:
lst.append(1)
for ns in node.childNodes :
if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td :
width_str = ns._attrs['colWidths'].nodeValue
ns.removeAttribute('colWidths')
total_td = td * len(value)
if not width:
for v in value:
width.append(30)
for v in range(len(value)):
width_str +=',%d'%width[v]
ns.setAttribute('colWidths',width_str)
child_list = ns.childNodes
check=0
for child in child_list:
if child.nodeName=='tr':
lc = child.childNodes[1]
# for t in range(td):
i=0
for v in value:
newnode = lc.cloneNode(1)
if check==1:
t1="[[ %s['%s'] ]]"%(name,v)
else:
t1="%s"%(v)
newnode.childNodes[1].lastChild.data = t1
child.appendChild(newnode)
newnode=False
i+=1
check=1
return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False)
def lines(self,data):
res={}
result=[]
obj_inds=self.pool.get('account.report.report').browse(self.cr,self.uid,data['indicator_id'])
def find_child(obj):
self.list.append(obj)
if obj.child_ids:
for child in obj.child_ids:
find_child(child)
return True
find_child(obj_inds)
for obj_ind in self.list:
res = {
'id':obj_ind.id,
'name':obj_ind.name,
'code':obj_ind.code,
'expression':obj_ind.expression,
'disp_graph':obj_ind.disp_graph,
'note':obj_ind.note,
'type':obj_ind.type
}
result.append(res)
return result
def getarray(self,data,object):
res={}
result=[]
self.test1(data,object,intercall=True)
self.header_val=[str(x) for x in self.header_val]
temp_dict=zip(self.header_name,self.header_val)
res=dict(temp_dict)
res['X-Axis']='Value'
result.append(res)
return result
def test1(self,data,object,intercall=False):
path=tools.config['root_path']+"/Temp_report/Image"
obj_history=self.pool.get('account.report.history')
if data['select_base']=='year':
tuple_search=('fiscalyear_id','in',data['base_selection'][0][2])
else:
tuple_search=('period_id','in',data['base_selection'][0][2])
history_ids=obj_history.search(self.cr,self.uid,[('name','=',object['id']),tuple_search])
obj_his=obj_history.browse(self.cr,self.uid,history_ids)
data_val=[]
data_period=[]
for item in obj_his:
data_val.append(item.val)
data_period.append(item.period_id.name)
self.header_name=data_period
self.header_val=data_val
if intercall:
return True
self.count +=1
drawing = Drawing(400, 300)
data = [
(13, 5, 20, 22, 37, 45, 19, 4),
(11, 3, 10, 22, 30, 25, 29, 6),
tuple(data_val),
]
value_min=0.0
vmin=min(data_val)
vmax=max(data_val)
val_min=((vmin < 0.00 and vmin-2.00) or 0.00)
# calculating maximum
val_max=(vmax/(pow(10,len(str(int(vmax)))-2))+1)*pow(10,len(str(int(vmax)))-2)
bc = VerticalBarChart()
bc.x = 50
bc.y = 50
bc.height = 125
bc.height = 245
bc.width = 300
bc.data = data
bc.strokeColor = reportlab.lib.colors.black
bc.valueAxis.valueMin = 0
bc.valueAxis.valueMax = 50
bc.valueAxis.valueStep = 10
value_step=(abs(val_max)-abs(val_min))/5
bc.strokeColor = colors.black
bc.valueAxis.valueMin = val_min
bc.valueAxis.valueMax = val_max
bc.valueAxis.valueStep = value_step
bc.categoryAxis.labels.boxAnchor = 'ne'
bc.categoryAxis.labels.dx = 8
bc.categoryAxis.labels.dy = -2
bc.categoryAxis.labels.angle = 30
bc.categoryAxis.categoryNames = ['Jan-99','Feb-99','Mar-99',
'Apr-99','May-99','Jun-99','Jul-99','Aug-99']
bc.categoryAxis.categoryNames = data_period
drawing.add(bc)
# renderPM.drawToFile(drawing, 'example1.jpg','jpg')
return True
drawing.save(formats=['png'],fnRoot=path+str(self.count),title="helo")
# renderPM.drawToFile(drawing1, 'example1.jpg','jpg')
return path+str(self.count)+'.png'
report_sxw.report_sxw('report.print.indicators', 'account.report.history',
'addons/account_report/report/print_indicator.rml',
parser=accounting_report1, header=False)
parser=accounting_report_indicator, header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -10,6 +10,11 @@
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="CENTER"/>
<lineStyle kind="GRID" colorName="black"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
@ -49,7 +54,7 @@
<paraStyle name="P6" fontName="Times-Roman" fontSize="13.0" leading="16" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Times-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Times-Roman" fontSize="8.0" alignment="RIGHT" 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="P11" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
@ -127,7 +132,24 @@
</tr>
</blockTable>
<para style="P1">[[ o['disp_graph'] and setTag('para','image',{'file':test(data['form'],o)}) or removeParentNode('para') ]]</para>
<section>
<para style="P13">[[ repeatIn(getarray(data['form'],o),'array',td=len(data['form']['base_selection'][0][2])) ]]</para>
<blockTable colWidths="0.0" style="Table5">
<tr>
<td>
<para style="P9"> </para>
</td>
</tr>
<tr>
<td>
<para style="P9"> </para>
</td>
</tr>
</blockTable>
</section>
<para style="P3">
<font color="white"> </font>
</para>
<para style="P11"><b>Expression :</b> [[ o['expression'] ]]</para>
<para style="P11"><b>Notes :</b> [[ o['note'] ]]</para>
<para style="P3">

View File

@ -1,7 +1,9 @@
#############################################################################
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential

View File

@ -2,21 +2,21 @@
"name" : "l10n_lu",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"website" : "http://openerp.com",
"category" : "Vertical Modules/Parametrization",
"description": """
This module install
* the KLUWER Chart of Accounts,
* the Tax Code Chart for Luxembourg
* the main taxes used in Luxembourg
""",
"depends" : ["account"],
This module install:
*the KLUWER Chart of Accounts,
*the Tax Code Chart for Luxembourg
*the main taxes used in Luxembourg""",
"depends" : ["account","base"],
"init_xml" : [ ],
"demo_xml" : [ ],
"demo_xml" : [ "account.report.report.csv" ],
"update_xml" : [
"l10n_lu_data.xml",
"l10n_lu_wizard.xml",
"l10n_lu_report.xml",
"l10n_lu_wizard.xml"
],
"installable": True
}

View File

@ -0,0 +1,21 @@
"expression","note","parent_id","sequence","badness_limit","goodness_limit","type","code","name"
0,,,,0,2,"indicator","BILAN","Bilan"
"report('BIMMO','BSTOCK','BREAL','BDISPO')",,"BILAN",,0,1,"fiscal","Actif","Actif"
"balance('2')",,"Actif",,5,45,"indicator","BIMMO","Valeurs immobilisées"
"balance('3')",,"Actif",2,3,12,"indicator","BSTOCK","Stocks"
"balance('4')",,"Actif",3,0,78,"indicator","BREAL","Réalisable"
"balance('5')",,"Actif",4,4,12,"fiscal","BDISPO","Disponible"
"report('BCAP') + report('BRESNET')",,"BILAN",1,0,2,"fiscal","PASSIF","Passif"
"balance('1')",,"PASSIF",1,0,3,"indicator","BCAP","Capitaux propores"
"-balance('7')+balance('6')",,"PASSIF",,0,5,"fiscal","BRESNET","Résultat net"
0,,,,1,9,"fiscal","CRES","Compte des résultats"
"report('CCHAR','CBENEF')",,"CRES",,1,8,"fiscal","CRESACTIF","Résultat Actif"
"balance('6')",,"CRESACTIF",,0,0,"fiscal","CCHAR","Total des charges"
"report('CRESPROD')",,"CRES",,3,12,"fiscal","CRESPASSIF","Résultat Passif"
"-balance('7')",,"CRESPASSIF",,2,4,"fiscal","CRESPROD","Total des produits"
"-balance('7')+balance('6')",,"CRESACTIF",,"2",8,"fiscal","CBENEF","Résultat (Bénéfice)"
0,,,,0,7,"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",,0,9,"indicator","CIMMO","Couverture des immobilisations"
0,,,,0,0,"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",,0,0,"indicator","IFR","Indice du fond de roulement"
"balance('4','5') / balance('101','13','15','16','17','18')",,"ITRE",,0,6,"indicator","RTRE","Ratio de trésorerie"
1 expression note parent_id sequence badness_limit goodness_limit type code name
2 0 0 2 indicator BILAN Bilan
3 report('BIMMO','BSTOCK','BREAL','BDISPO') BILAN 0 1 fiscal Actif Actif
4 balance('2') Actif 5 45 indicator BIMMO Valeurs immobilisées
5 balance('3') Actif 2 3 12 indicator BSTOCK Stocks
6 balance('4') Actif 3 0 78 indicator BREAL Réalisable
7 balance('5') Actif 4 4 12 fiscal BDISPO Disponible
8 report('BCAP') + report('BRESNET') BILAN 1 0 2 fiscal PASSIF Passif
9 balance('1') PASSIF 1 0 3 indicator BCAP Capitaux propores
10 -balance('7')+balance('6') PASSIF 0 5 fiscal BRESNET Résultat net
11 0 1 9 fiscal CRES Compte des résultats
12 report('CCHAR','CBENEF') CRES 1 8 fiscal CRESACTIF Résultat Actif
13 balance('6') CRESACTIF 0 0 fiscal CCHAR Total des charges
14 report('CRESPROD') CRES 3 12 fiscal CRESPASSIF Résultat Passif
15 -balance('7') CRESPASSIF 2 4 fiscal CRESPROD Total des produits
16 -balance('7')+balance('6') CRESACTIF 2 8 fiscal CBENEF Résultat (Bénéfice)
17 0 0 7 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 0 9 indicator CIMMO Couverture des immobilisations
19 0 0 0 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 0 0 indicator IFR Indice du fond de roulement
21 balance('4','5') / balance('101','13','15','16','17','18') ITRE 0 6 indicator RTRE Ratio de trésorerie

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="config_call_account_template" model="ir.actions.todo">
<field name="name">Generate Chart of Accounts from a Chart Template</field>
<field name="note">Generate Chart of Accounts from a Chart Template. You will be asked to select the company, the chart template, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated.
This is the same wizard that runs from Financial Managament/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template.</field>
<field name="action_id" ref="account.action_wizard_multi_chart"/>
<field name="state">open</field>
</record>
<menuitem
id="legal_lu"
parent="account.menu_finance_legal_statement"
name="Luxemburg"/>
<wizard
id="wizard_print_vat"
menu="False"
model="account.tax.code"
name="l10n_lu.tax.report.wizard" string="Luxemburg VAT Declaration"/>
<menuitem
id="legal_lu_vat"
parent="legal_lu"
action="wizard_print_vat"/>
</data>
</openerp>

View File

@ -76,8 +76,8 @@ class product_product(osv.osv):
from account_invoice_line l
left join account_invoice i on (l.invoice_id = i.id)
left join product_template product on (product.id=l.product_id)
where l.product_id = %s and i.state in ('%s') and i.type in ('%s')
"""%(val.id,"','".join(states),"','".join(invoice_types))
where l.product_id = %s and i.state in ('%s') and i.type in ('%s') and i.date_invoice>='%s' and i.date_invoice<='%s'
"""%(val.id,"','".join(states),"','".join(invoice_types),date_from,date_to)
cr.execute(sql)
result=cr.fetchall()[0]
if 'sale_avg_price' in field_names or 'sale_num_invoiced' in field_names or 'turnover' in field_names or 'sale_expected' in field_names:

View File

@ -323,11 +323,14 @@ class stock_picking(osv.osv):
if isinstance(ids, (int, long)):
ids=[ids]
for pick in self.browse(cr, uid, ids, context):
cr.execute("""update stock_move set
date_planned=%s
sql_str="""update stock_move set
date_planned='%s'
where
picking_id=%d and
(date_planned=%s or date_planned>%s)""", (value,pick.id,pick.max_date,value))
picking_id=%d """ % (value,pick.id)
if pick.max_date:
sql_str += " and (date_planned='"+pick.max_date+"' or date_planned>'"+value+"')"
cr.execute(sql_str)
return True
def _set_minimum_date(self, cr, uid, ids, name, value, arg, context):
@ -335,11 +338,13 @@ class stock_picking(osv.osv):
if isinstance(ids, (int, long)):
ids=[ids]
for pick in self.browse(cr, uid, ids, context):
cr.execute("""update stock_move set
date_planned=%s
sql_str="""update stock_move set
date_planned='%s'
where
picking_id=%d and
(date_planned=%s or date_planned<%s)""", (value,pick.id,pick.min_date,value))
picking_id=%d """ % (value,pick.id)
if pick.min_date:
sql_str += " and (date_planned='"+pick.min_date+"' or date_planned<'"+value+"')"
cr.execute(sql_str)
return True
def get_min_max_date(self, cr, uid, ids, field_name, arg, context={}):