merged new_report_apa
bzr revid: patelamit2003@gmail.com-20080926083718-5wj6rl9pk7y6z55t
This commit is contained in:
commit
80debb8028
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>new-report-apa</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?>
|
||||
|
||||
<pydev_project>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.4</pydev_property>
|
||||
</pydev_project>
|
|
@ -141,7 +141,9 @@ class account_account(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
pos = 0
|
||||
|
||||
while pos<len(args):
|
||||
|
||||
if args[pos][0]=='code' and args[pos][1] in ('like','ilike') and args[pos][2]:
|
||||
args[pos] = ('code', '=like', str(args[pos][2].replace('%',''))+'%')
|
||||
if args[pos][0]=='journal_id':
|
||||
|
@ -157,6 +159,7 @@ class account_account(osv.osv):
|
|||
ids1 += map(lambda x: x.id, jour.account_control_ids)
|
||||
args[pos] = ('id','in',ids1)
|
||||
pos+=1
|
||||
|
||||
return super(account_account,self).search(cr, uid, args, offset, limit,
|
||||
order, context=context, count=count)
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import invoice
|
|||
import overdue
|
||||
import aged_trial_balance
|
||||
import tax_report
|
||||
import general_ledger_landscape
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
|
@ -28,113 +27,194 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import xml
|
||||
import copy
|
||||
from operator import itemgetter
|
||||
import time
|
||||
import datetime
|
||||
from report import report_sxw
|
||||
|
||||
class account_balance(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(account_balance, self).__init__(cr, uid, name, context)
|
||||
self.sum_debit = 0.0
|
||||
self.sum_credit = 0.0
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'get_fiscalyear':self.get_fiscalyear,
|
||||
'get_periods':self.get_periods,
|
||||
})
|
||||
self.context = context
|
||||
|
||||
def get_fiscalyear(self, form):
|
||||
fisc_id = form['fiscalyear']
|
||||
if fisc_id:
|
||||
self.cr.execute("select name from account_fiscalyear where id = %d" %(int(fisc_id)))
|
||||
else:
|
||||
self.cr.execute("select name from account_fiscalyear where state='draft'")
|
||||
res=self.cr.fetchall()
|
||||
result=''
|
||||
for r in res:
|
||||
result+=r[0]+","
|
||||
return str(result and result[:-1]) or ''
|
||||
|
||||
|
||||
def get_periods(self, form):
|
||||
periods=form['periods'][0][2]
|
||||
if periods:
|
||||
period_ids = ",".join([str(x) for x in form['periods'][0][2] if x])
|
||||
self.cr.execute("select name from account_period where id in (%s)" % (period_ids))
|
||||
else:
|
||||
if form['fiscalyear']:
|
||||
self.cr.execute("select name from account_period where fiscalyear_id = %d"%(int(form['fiscalyear'])))
|
||||
_name = 'report.account.account.balance'
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(account_balance, self).__init__(cr, uid, name, context)
|
||||
self.sum_debit = 0.00
|
||||
self.sum_credit = 0.00
|
||||
self.date_lst = []
|
||||
self.date_lst_string = ''
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'moveline':self.moveline,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'get_fiscalyear':self.get_fiscalyear,
|
||||
'get_periods':self.get_periods,
|
||||
})
|
||||
self.context = context
|
||||
|
||||
def get_fiscalyear(self, form):
|
||||
res=[]
|
||||
if form.has_key('fiscalyear'):
|
||||
fisc_id = form['fiscalyear']
|
||||
if not (fisc_id):
|
||||
return ''
|
||||
self.cr.execute("select name from account_fiscalyear where id = %d" %(int(fisc_id)))
|
||||
res=self.cr.fetchone()
|
||||
return res and res[0] or ''
|
||||
|
||||
def get_periods(self, form):
|
||||
result=''
|
||||
if form.has_key('periods'):
|
||||
period_ids = ",".join([str(x) for x in form['periods'][0][2] if x])
|
||||
self.cr.execute("select name from account_period where id in (%s)" % (period_ids))
|
||||
res=self.cr.fetchall()
|
||||
for r in res:
|
||||
result+=r[0]+", "
|
||||
return str(result and result[:-1]) or ''
|
||||
|
||||
def lines(self, form, ids={}, done=None, level=1):
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
if not ids:
|
||||
return []
|
||||
if not done:
|
||||
done={}
|
||||
res={}
|
||||
result_acc=[]
|
||||
ctx = self.context.copy()
|
||||
if form.has_key('fiscalyear'):
|
||||
self.transform_period_into_date_array(form)
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
else:
|
||||
self.cr.execute("select name from account_period")
|
||||
res=self.cr.fetchall()
|
||||
result=''
|
||||
for r in res:
|
||||
result+=r[0]+","
|
||||
return str(result and result[:-1]) or ''
|
||||
|
||||
def lines(self, form, ids={}, done=None, level=1):
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
if not ids:
|
||||
return []
|
||||
if not done:
|
||||
done={}
|
||||
result = []
|
||||
ctx = self.context.copy()
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['target_move'] = form['target_move']
|
||||
ctx['state']=form['state']
|
||||
accounts = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx)
|
||||
def cmp_code(x, y):
|
||||
return cmp(x.code, y.code)
|
||||
accounts.sort(cmp_code)
|
||||
for account in accounts:
|
||||
if account.id in done:
|
||||
continue
|
||||
done[account.id] = 1
|
||||
res = {
|
||||
'code': account.code,
|
||||
'name': account.name,
|
||||
'level': level,
|
||||
'debit': account.debit,
|
||||
'credit': account.credit,
|
||||
'balance': account.balance,
|
||||
'leef': not bool(account.child_id)
|
||||
}
|
||||
self.sum_debit += account.debit
|
||||
self.sum_credit += account.credit
|
||||
if not (res['credit'] or res['debit']) and not account.child_id:
|
||||
continue
|
||||
if account.child_id:
|
||||
def _check_rec(account):
|
||||
if not account.child_id:
|
||||
return bool(account.credit or account.debit)
|
||||
for c in account.child_id:
|
||||
if _check_rec(c):
|
||||
return True
|
||||
return False
|
||||
if not _check_rec(account):
|
||||
self.transform_date_into_date_array(form)
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
|
||||
accounts = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx)
|
||||
def cmp_code(x, y):
|
||||
return cmp(x.code, y.code)
|
||||
accounts.sort(cmp_code)
|
||||
for account in accounts:
|
||||
if account.id in done:
|
||||
continue
|
||||
|
||||
result.append(res)
|
||||
if account.child_id:
|
||||
ids2 = [(x.code,x.id) for x in account.child_id]
|
||||
ids2.sort()
|
||||
result += self.lines(form, [x[1] for x in ids2], done, level+1)
|
||||
return result
|
||||
|
||||
def _sum_credit(self):
|
||||
return self.sum_credit
|
||||
|
||||
def _sum_debit(self):
|
||||
return self.sum_debit
|
||||
|
||||
done[account.id] = 1
|
||||
res = {
|
||||
'lid' :'',
|
||||
'date':'',
|
||||
'jname':'',
|
||||
'ref':'',
|
||||
'lname':'',
|
||||
'debit1':'',
|
||||
'credit1':'',
|
||||
'balance1' :'',
|
||||
'id' : account.id,
|
||||
'code': account.code,
|
||||
'name': account.name,
|
||||
'level': level,
|
||||
'debit': account.debit,
|
||||
'credit': account.credit,
|
||||
'balance': account.balance,
|
||||
'leef': not bool(account.child_id),
|
||||
}
|
||||
self.sum_debit += account.debit
|
||||
self.sum_credit += account.credit
|
||||
if not (res['credit'] or res['debit']) and not account.child_id:
|
||||
continue
|
||||
if account.child_id:
|
||||
def _check_rec(account):
|
||||
if not account.child_id:
|
||||
return bool(account.credit or account.debit)
|
||||
for c in account.child_id:
|
||||
if _check_rec(c):
|
||||
return True
|
||||
return False
|
||||
if not _check_rec(account):
|
||||
continue
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if res['credit'] <> 0 or res['debit'] <> 0 or res['balance'] <> 0:
|
||||
result_acc.append(res)
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if res['balance'] <> 0:
|
||||
result_acc.append(res)
|
||||
else:
|
||||
result_acc.append(res)
|
||||
res1 = self.moveline(form, account.id,res['level'])
|
||||
if res1:
|
||||
for r in res1:
|
||||
result_acc.append(r)
|
||||
if account.code=='0':
|
||||
result_acc.pop(-1)
|
||||
if account.child_id:
|
||||
ids2 = [(x.code,x.id) for x in account.child_id]
|
||||
ids2.sort()
|
||||
result_acc += self.lines(form, [x[1] for x in ids2], done, level+1)
|
||||
return result_acc
|
||||
|
||||
def moveline(self,form,ids,level):
|
||||
res={}
|
||||
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
|
||||
self.cr.execute(
|
||||
"SELECT l.id as lid,l.date,j.code as jname, l.ref, l.name as lname, l.debit as debit1, l.credit as credit1 " \
|
||||
"FROM account_move_line l " \
|
||||
"LEFT JOIN account_journal j " \
|
||||
"ON (l.journal_id = j.id) " \
|
||||
"WHERE l.account_id = '"+str(ids)+"' " \
|
||||
"AND l.date IN (" + self.date_lst_string + ") " \
|
||||
"ORDER BY l.id")
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
for r in res:
|
||||
sum = r['debit1'] - r['credit1']
|
||||
r['balance1'] = sum
|
||||
r['id'] =''
|
||||
r['code']= ''
|
||||
r['name']=''
|
||||
r['level']=level
|
||||
r['debit']=''
|
||||
r['credit']=''
|
||||
r['balance']=''
|
||||
r['leef']=''
|
||||
return res or ''
|
||||
|
||||
def date_range(self,start,end):
|
||||
start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d")))
|
||||
end = datetime.date.fromtimestamp(time.mktime(time.strptime(end,"%Y-%m-%d")))
|
||||
full_str_date = []
|
||||
#
|
||||
r = (end+datetime.timedelta(days=1)-start).days
|
||||
#
|
||||
date_array = [start+datetime.timedelta(days=i) for i in range(r)]
|
||||
for date in date_array:
|
||||
full_str_date.append(str(date))
|
||||
return full_str_date
|
||||
|
||||
#
|
||||
def transform_period_into_date_array(self,form):
|
||||
## Get All Period Date
|
||||
if not form['periods'][0][2] :
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',form['fiscalyear'])])
|
||||
else:
|
||||
periods_id = form['periods'][0][2]
|
||||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
|
||||
self.date_lst = date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_date_into_date_array(self,form):
|
||||
return_array = self.date_range(form['date_from'],form['date_to'])
|
||||
self.date_lst = return_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def _sum_credit(self):
|
||||
return self.sum_credit
|
||||
|
||||
def _sum_debit(self):
|
||||
return self.sum_debit
|
||||
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=2)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -2,116 +2,91 @@
|
|||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="35.0" y1="35.0" width="525" height="772"/>
|
||||
<frame id="first" x1="57.0" y1="57.0" width="481" height="700"/>
|
||||
<pageGraphics>
|
||||
<drawRightString x="297.5" y="0.7cm"><pageNumber/> / </drawRightString>
|
||||
<drawString x="297.5" y="0.7cm"><pageCount/></drawString>
|
||||
</pageGraphics>
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
|
||||
<drawString x="16.2cm" y="28.1cm">Account Balance - [[ company.currency_id.name ]]</drawString>
|
||||
|
||||
<!--COL 2-->
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.0cm" y="1cm"> [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]]</drawString>
|
||||
<drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1cm 27.7cm 20cm 27.7cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
</pageGraphics>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table6">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<blockLeftPadding length="0" start="0,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockLeftPadding length="0" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="2.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" fontSize="8.0" leading="14" spaceBefore="0.0" spaceAfter="6.0" alignment="RIGHT"/>
|
||||
<paraStyle name="P9" fontName="Helvetica-Bold" alignment="CENTER" fontSize="14.5" leftIndent="-5.0"/>
|
||||
<paraStyle name="P9b" fontName="Helvetica" fontSize="8" leftIndent="-5.0" alignment="LEFT"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12a" fontName="Helvetica" fontSize="8.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
|
||||
|
||||
<paraStyle name="P3a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" fontSize="9.0" leading="14" spaceBefore="0.0" spaceAfter="6.0" alignment="RIGHT"/>
|
||||
<paraStyle name="P9" fontName="Helvetica-Bold" alignment="CENTER" fontSize="12" leftIndent="-5.0"/>
|
||||
<paraStyle name="P9b" fontName="Helvetica" fontSize="9" leftIndent="0.0" alignment="LEFT"/>
|
||||
<paraStyle name="P9a" fontName="Helvetica-Bold" fontSize="9" leftIndent="0.0" alignment="LEFT"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="9.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12a" fontName="Helvetica" fontSize="9.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
|
||||
<blockTableStyle id="TrLevel7">
|
||||
<blockLeftPadding length="0" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel6">
|
||||
<blockLeftPadding length="60" start="1,0" stop="1,0"/>
|
||||
<blockLeftPadding length="0" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel5">
|
||||
<blockLeftPadding length="40" start="1,0" stop="1,0"/>
|
||||
<blockLeftPadding length="0" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel4">
|
||||
<blockLeftPadding length="20" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="1,0" stop="1,0"/>
|
||||
<blockLeftPadding length="0" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel3">
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="1,0" stop="-1,0"/>
|
||||
<blockLeftPadding length="0" start="0,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel2">
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="1,0" stop="1,0"/>
|
||||
<blockTopPadding length="13" start="0,0" stop="-1,0"/>
|
||||
<blockBottomPadding length="2" start="0,0" stop="-1,0"/>
|
||||
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel1">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<blockTopPadding length="26" start="0,0" stop="-1,0"/>
|
||||
<blockBottomPadding length="2" start="0,0" stop="-1,0"/>
|
||||
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
|
||||
<blockLeftPadding length="0" start="0,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="TrLevel1">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<blockLeftPadding length="0" start="0,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<paraStyle
|
||||
name="Level7"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level6"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level5"
|
||||
fontName="Helvetica"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level4"
|
||||
|
@ -119,36 +94,35 @@
|
|||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level3"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level2"
|
||||
firstLineIndent="-0.03cm"
|
||||
fontName="Helvetica-Bold"
|
||||
fontSize="8.0" />
|
||||
<paraStyle name="Level1"
|
||||
<paraStyle name="Level2"
|
||||
fontSize="8.0"
|
||||
fontName="Helvetica-Bold"
|
||||
/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
<paraStyle name="Level1"
|
||||
fontSize="8.0"
|
||||
fontName="Helvetica-Bold"
|
||||
/>
|
||||
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P9"> Account Balance</para>
|
||||
|
||||
<blockTable colWidths="527.00" style="Table4" repeatRows="1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9a">[[ get_fiscalyear(data['form']) or removeParentNode('tr') ]]:</para>
|
||||
<para style="P9b"><i> [[ get_periods(data['form']) or removeParentNode('tr') ]]</i></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P9b">[[ get_fiscalyear(data['form']) ]]: <i> [[ get_periods(data['form']) ]] </i></para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="52,248.0,73.0,72.0,82.0" style="Table2" repeatRows="1">
|
||||
<blockTable colWidths="50.0,248.0,73.0,72.0,87.0" style="Table1" repeatRows="1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12a">Code</para>
|
||||
|
@ -166,25 +140,45 @@
|
|||
<para style="P10">Balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P14">[[ repeatIn(lines(data['form']), 'a') ]]<i>[[ a['code'] ]]</i></para></td>
|
||||
<td>
|
||||
|
||||
<para style="P14">[[ setTag('tr','tr',{'style':'TrLevel'+str(a['level']), 'paraStyle':('Level'+str(a['level']))}) ]]<font></font>
|
||||
[[ a['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(a['debit'] or '') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(a['credit'] or '') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"><u>[[ (a['leef'] and removeParentNode('para')) or formatLang(a['balance'] or '') ]]</u></para>
|
||||
<para style="P3">[[ ((not a['leef']) and removeParentNode('para')) or formatLang(a['balance'] or '') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</story>
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="50.0,248.0,73.0,72.0,82.0" style="Table3">
|
||||
<para style="P2">[[ repeatIn(lines(data['form']), 'a') ]]</para>
|
||||
<tr>
|
||||
<td><para style="P14">[[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]]<i>[[ a['code'] or removeParentNode('tr') ]]</i></para></td>
|
||||
<td>
|
||||
<para style="P14">[[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]]<font color="white">[[ (a['level']<6 and removeParentNode('font') or '... '*(a['level']-4)) ]]</font>[[ setTag('blockTable','blockTable',{'style':'TrLevel'+str(a['level'])}) ]][[ a['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(a['debit']) and '%.2f'%a['debit'] or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(a['credit']) and '%.2f'%a['credit'] or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ (a['level']<4) and setTag('para','para',{'style':'P3a'}) ]]<u>[[ (a['leef'] and removeParentNode('para')) or formatLang(a['balance']) and '%.2f'%a['balance'] or '' ]]</u></para>
|
||||
<para style="P3">[[ ((not a['leef']) and removeParentNode('para')) or formatLang(a['balance']) and formatLang(a['balance']) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P14">[[ a['jname'] or removeParentNode('tr') ]]</para></td>
|
||||
<td>
|
||||
<para style="P14"><font color="white">[[ '... '*(a['level']-3) ]]</font>[[ a['lname'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(a['debit1']) and '%.2f'%a['debit1'] or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(a['credit1']) and '%.2f'%a['credit1'] or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(a['balance1']) and '%.2f'%a['balance1'] or '']]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -30,166 +27,172 @@
|
|||
|
||||
import time
|
||||
import pooler
|
||||
import rml_parse
|
||||
from report import report_sxw
|
||||
|
||||
class aged_trial_report(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(aged_trial_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_lines': self._get_lines,
|
||||
'get_total': self._get_total,
|
||||
'get_before': self._get_before,
|
||||
'get_for_period': self._get_for_period,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
})
|
||||
class aged_trial_report(rml_parse.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(aged_trial_report, self).__init__(cr, uid, name, context)
|
||||
self.line_query = ''
|
||||
self.total_account = []
|
||||
|
||||
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_lines': self._get_lines,
|
||||
'get_total': self._get_total,
|
||||
'get_direction': self._get_direction,
|
||||
'get_for_period': self._get_for_period,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
|
||||
})
|
||||
|
||||
|
||||
def _get_lines(self, form):
|
||||
|
||||
if (form['result_selection'] == 'customer' ):
|
||||
self.ACCOUNT_TYPE = "('receivable')"
|
||||
elif (form['result_selection'] == 'supplier'):
|
||||
self.ACCOUNT_TYPE = "('payable')"
|
||||
else:
|
||||
self.ACCOUNT_TYPE = "('payable','receivable')"
|
||||
|
||||
|
||||
def _add_header(self, node):
|
||||
return True
|
||||
res = []
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
self.line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': form['fiscalyear']})
|
||||
self.cr.execute("SELECT DISTINCT res_partner.id AS id, " \
|
||||
"res_partner.name AS name " \
|
||||
"FROM res_partner,account_move_line AS line, account_account,account_move_reconcile AS recon " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (line.partner_id=res_partner.id) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"ORDER BY res_partner.name", (form['date1'],form['company_id']))
|
||||
partners = self.cr.dictfetchall()
|
||||
## mise a 0 du total
|
||||
for i in range(7):
|
||||
self.total_account.append(0)
|
||||
#
|
||||
|
||||
for partner in partners:
|
||||
values = {}
|
||||
## If choise selection is in the future
|
||||
if form['direction_selection'] == 'future':
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (COALESCE(date_maturity,date) < %s) AND (partner_id=%d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form['date1'], partner['id'],form['date1'], form['company_id']))
|
||||
before = self.cr.fetchone()
|
||||
|
||||
self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
|
||||
|
||||
def _get_lines(self, form):
|
||||
self.form=form
|
||||
res = []
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': form['fiscalyear'],'state':form['state']})
|
||||
self.cr.execute("SELECT DISTINCT res_partner.id AS id, " \
|
||||
"res_partner.name AS name, res_partner.ref AS code " \
|
||||
"FROM res_partner, account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (line.reconcile_id IS NULL) " \
|
||||
"AND (line.partner_id=res_partner.id) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active " \
|
||||
"ORDER BY res_partner.name", (form['company_id'],))
|
||||
partners = self.cr.dictfetchall()
|
||||
for partner in partners:
|
||||
values = {}
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN (" + form['computation'] +")) " \
|
||||
"AND (date < %s) AND (partner_id=%d) " \
|
||||
"AND (reconcile_id IS NULL) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form['0']['start'], partner['id'], form['company_id']))
|
||||
before = self.cr.fetchone()
|
||||
values['before'] = before and before[0] or ""
|
||||
for i in range(5):
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN (" + form['computation'] + ")) " \
|
||||
"AND (date >= %s) AND (date <= %s) " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND (reconcile_id IS NULL) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form[str(i)]['start'], form[str(i)]['stop'],
|
||||
partner['id'], form['company_id']))
|
||||
during = self.cr.fetchone()
|
||||
values[str(i)] = during and during[0] or ""
|
||||
values['direction'] = before and before[0] or 0.0
|
||||
else:
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (COALESCE(date_maturity,date) > %s) AND (partner_id=%d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form['date1'], partner['id'],form['date1'], form['company_id']))
|
||||
after = self.cr.fetchone()
|
||||
self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
|
||||
values['direction'] = after and after[0] or ""
|
||||
#print str(values['direction'])
|
||||
for i in range(5):
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (COALESCE(date_maturity,date) BETWEEN %s AND %s) " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form[str(i)]['start'], form[str(i)]['stop'],partner['id'],form['date1'] ,form['company_id']))
|
||||
during = self.cr.fetchone()
|
||||
# Ajout du compteur
|
||||
self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
|
||||
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + form['computation'] + ")) " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND (reconcile_id IS NULL) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(partner['id'], form['company_id']))
|
||||
total = self.cr.fetchone()
|
||||
values['total'] = total and total[0] or 0.0
|
||||
values['name'] = partner['name']
|
||||
values['ref'] = partner['code']
|
||||
t = 0.0
|
||||
for i in range(5)+['before']:
|
||||
t+= float(values.get(str(i), 0.0) or 0.0)
|
||||
if values['total']:
|
||||
res.append(values)
|
||||
total = 0.0
|
||||
totals = {}
|
||||
for r in res:
|
||||
total += float(r['total'] or 0.0)
|
||||
for i in range(5)+['before']:
|
||||
totals.setdefault(str(i), 0.0)
|
||||
totals[str(i)] += float(r[str(i)] or 0.0)
|
||||
if form['sorting_on']=='amount':
|
||||
res.sort(lambda x,y:cmp(y['total'],x['total']))
|
||||
return res
|
||||
#print str(during)
|
||||
values[str(i)] = during and during[0] or ""
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(partner['id'],form['date1'],form['company_id']))
|
||||
total = self.cr.fetchone()
|
||||
values['total'] = total and total[0] or 0.0
|
||||
## Add for total
|
||||
self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
|
||||
print self.total_account,">>>>>>>>>>>>>Total>>>>>>>>>>>>>>>>"
|
||||
values['name'] = partner['name']
|
||||
#t = 0.0
|
||||
#for i in range(5)+['direction']:
|
||||
# t+= float(values.get(str(i), 0.0) or 0.0)
|
||||
#values['total'] = t
|
||||
|
||||
if values['total']:
|
||||
|
||||
res.append(values)
|
||||
|
||||
total = 0.0
|
||||
|
||||
totals = {}
|
||||
for r in res:
|
||||
total += float(r['total'] or 0.0)
|
||||
for i in range(5)+['direction']:
|
||||
totals.setdefault(str(i), 0.0)
|
||||
totals[str(i)] += float(r[str(i)] or 0.0)
|
||||
return res
|
||||
|
||||
def _get_total(self, fiscalyear, company_id):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': fiscalyear,'state':self.datas['form']['state']})
|
||||
self.cr.execute("SELECT SUM(debit - credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + self.form['computation'] + ")) "\
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND partner_id is NOT NULL " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(company_id,))
|
||||
total = self.cr.fetchone()
|
||||
return total and total[0] or 0.0
|
||||
|
||||
|
||||
|
||||
def _get_total(self,pos):
|
||||
print self.total_account,"========_get_total========"
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
|
||||
def _get_before(self, date, fiscalyear, company_id):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': fiscalyear,'state':self.datas['form']['state']})
|
||||
self.cr.execute("SELECT SUM(debit - credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + self.form['computation'] + ")) " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND (date < %s) " \
|
||||
"AND partner_id IS NOT NULL " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(date, company_id))
|
||||
before = self.cr.fetchone()
|
||||
return before and before[0] or 0.0
|
||||
|
||||
def _get_direction(self,pos):
|
||||
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
|
||||
def _get_for_period(self, period, fiscalyear, company_id):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': fiscalyear,'state':self.datas['form']['state']})
|
||||
self.cr.execute("SELECT SUM(debit - credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + self.form['computation'] + ")) " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND (date >= %s) " \
|
||||
"AND (date <= %s) " \
|
||||
"AND partner_id IS NOT NULL " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(period['start'], period['stop'], company_id))
|
||||
period = self.cr.fetchone()
|
||||
return period and period[0] or 0.0
|
||||
def _get_for_period(self,pos):
|
||||
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
|
||||
report_sxw.report_sxw(
|
||||
'report.account.aged.trial.balance',
|
||||
'res.partner',
|
||||
'addons/account/report/aged_trial_balance.rml',
|
||||
parser=aged_trial_report, header=False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner',
|
||||
'addons/account/report/aged_trial_balance.rml',parser=aged_trial_report,header=False)
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<template pageSize="(1120.0,770.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="57.0" y1="57.0" width="728" height="481"/>
|
||||
<frame id="first" x1="20.0" y1="35.0" width="1080" height="650"/>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
<!--<stroke color="darkblue"/>-->
|
||||
|
||||
<!--TITLE COMPANY-->
|
||||
<!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
|
||||
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.5cm" y="25.00cm">[[ company.name ]]</drawString>
|
||||
<drawString x="33.90cm" y="25.00cm">Age Partner Balance - [[ get_currency(data['form']) ]]</drawString>
|
||||
|
||||
<!--COL 2-->
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
|
||||
<drawString x="1.5cm" y="0.90cm"> [[ time.strftime('%Y-%m-%d %H:%M', time.localtime()) ]]</drawString>
|
||||
<drawString x="36.90cm" y="0.90cm">Page <pageNumber/></drawString>
|
||||
|
||||
<!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1.5cm 24.70cm 38.00cm 24.70cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
</pageGraphics>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
|
@ -13,231 +40,158 @@
|
|||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="8,0" stop="8,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="8,0" stop="8,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="8,0" stop="8,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="8,-1" stop="8,-1"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockTableStyle id="Table2">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="LEFT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" 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="P1" fontName="Helvetica" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="8.3" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2_content" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Total" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Total_right" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="15.0" leading="20" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica" fontSize="8.3" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="content" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="8.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<blockTable colWidths="198.0,313.0,217.0" repeatRows="1" style="Table1">
|
||||
<blockTable colWidths="300.0,100.0,100.0,100.0,100.0,105.0,105.0,125.0" style="Table2" repeatRows="1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">Partners</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Aged Trial balance</para>
|
||||
<para style="P8">[[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not due' ]] [[data['form']['date1'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">From the beginning</para>
|
||||
<para style="P2">to [[ formatLang(data['form']['4']['stop'], date=True) ]]</para>
|
||||
<para style="P8">[[ data['form']['4']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['3']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['2']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['1']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['0']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Total</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<para style="P3"> <font color="white">[[ (get_lines(data['form']), 'partner') == False or removeParentNode('para') ]]</font></para>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total">Account Total</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_direction('6') ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('4') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('3') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('2') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('1') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('0') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_total('5') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">[[ get_company(data['form']) ]]</para>
|
||||
<para style="P3">[[ repeatIn(get_lines(data['form']), 'partner') ]]</para>
|
||||
<para style="P2_content">[[ partner['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="content">[[ (partner['direction']) or 0.0 ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Currency: [[ get_currency(data['form']) ]]</para>
|
||||
<para style="content">[[ (partner['4']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['3']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['2']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['1']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['0']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['total']) or 0.0 ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P10">Printing date: [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="109.0,109.0,71.0,71.0,71.0,71.0,71.0,71.0,85.0" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">Partners</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['4']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['3']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['2']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['1']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['0']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">Before [[ formatLang(data['form']['0']['start'], date=True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">Total</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="109.0,109.0,71.0,71.0,71.0,71.0,71.0,71.0,85.0" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">[[ repeatIn(get_lines(data['form']), 'partner') ]]</para>
|
||||
<para style="P9">[[ partner['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ partner['ref'] or ' ' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['4'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['3'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['2'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['1'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['0'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['before'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['total'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="218.0,71.0,71.0,71.0,71.0,71.0,71.0,85.0" style="Tableau3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">Account total</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['4'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['3'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['2'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang( get_for_period(data['form']['1'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['0'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_before(data['form']['0']['start'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ formatLang(get_total( data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P10">
|
||||
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2005-2006 CamptoCamp
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -29,160 +27,336 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from mx.DateTime import *
|
||||
from report import report_sxw
|
||||
import xml
|
||||
import rml_parse
|
||||
import pooler
|
||||
|
||||
class general_ledger(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(general_ledger, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_debit_account': self._sum_debit_account,
|
||||
'sum_credit_account': self._sum_credit_account,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'check_lines': self.check_lines,
|
||||
class general_ledger(rml_parse.rml_parse):
|
||||
_name = 'report.account.general.ledger'
|
||||
|
||||
|
||||
|
||||
def preprocess(self, objects, data, ids):
|
||||
##
|
||||
self.borne_date = self.get_min_date(data['form'])
|
||||
##
|
||||
new_ids = []
|
||||
if (data['model'] == 'account.account'):
|
||||
new_ids = ids
|
||||
else:
|
||||
new_ids.append(data['form']['Account_list'])
|
||||
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
|
||||
super(general_ledger, self).preprocess(objects, data, new_ids)
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(general_ledger, self).__init__(cr, uid, name, context)
|
||||
self.query = ""
|
||||
self.child_ids = ""
|
||||
self.tot_currency = 0.0
|
||||
self.period_sql = ""
|
||||
self.sold_accounts = {}
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_debit_account': self._sum_debit_account,
|
||||
'sum_credit_account': self._sum_credit_account,
|
||||
'sum_solde_account': self._sum_solde_account,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'sum_solde': self._sum_solde,
|
||||
'get_children_accounts': self.get_children_accounts,
|
||||
'sum_currency_amount_account': self._sum_currency_amount_account
|
||||
})
|
||||
self.context = context
|
||||
def _calc_contrepartie(self,cr,uid,ids, context={}):
|
||||
result = {}
|
||||
#for id in ids:
|
||||
# result.setdefault(id, False)
|
||||
|
||||
for account_line in self.pool.get('account.move.line').browse(cr, uid, ids, context):
|
||||
# For avoid long text in the field we will limit it to 5 lines
|
||||
#
|
||||
#
|
||||
#
|
||||
result[account_line.id] = ' '
|
||||
num_id_move = str(account_line.move_id.id)
|
||||
num_id_line = str(account_line.id)
|
||||
account_id = str(account_line.account_id.id)
|
||||
# search the basic account
|
||||
# We have the account ID we will search all account move line from now until this time
|
||||
# We are in the case of we are on the top of the account move Line
|
||||
cr.execute('SELECT distinct(ac.code) as code_rest,ac.name as name_rest from account_account AS ac, account_move_line mv\
|
||||
where ac.id = mv.account_id and mv.move_id = ' + num_id_move +' and mv.account_id <> ' + account_id )
|
||||
res_mv = cr.dictfetchall()
|
||||
# we need a result more than 2 line to make the test so we will made the the on 1 because we have exclude the current line
|
||||
if (len(res_mv) >=1):
|
||||
concat = ''
|
||||
rup_id = 0
|
||||
for move_rest in res_mv:
|
||||
concat = concat + move_rest['code_rest'] + '|'
|
||||
result[account_line.id] = concat
|
||||
if rup_id >5:
|
||||
# we need to stop the computing and to escape but before we will add "..."
|
||||
result[account_line.id] = concat + '...'
|
||||
break
|
||||
rup_id+=1
|
||||
|
||||
})
|
||||
self.context = context
|
||||
self.tmp_list2=[]
|
||||
self.final_list=[]
|
||||
#print str(result)
|
||||
return result
|
||||
|
||||
def get_children_accounts(self, account, form):
|
||||
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
|
||||
[('parent_id', 'child_of', self.ids)])
|
||||
res = []
|
||||
ctx = self.context.copy()
|
||||
## We will make the test for period or date
|
||||
## We will now make the test
|
||||
#
|
||||
if form.has_key('fiscalyear'):
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
else:
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
##
|
||||
|
||||
#
|
||||
self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
for child_id in account.search(self.cr, self.uid,
|
||||
[('parent_id', 'child_of', [account.id])]):
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
#print "Type de vue :" + form['display_account']
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
if ( sold_account <> 0.0):
|
||||
res.append(child_account)
|
||||
else:
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
|
||||
##
|
||||
if form['soldeinit']:
|
||||
## We will now compute solde initiaux
|
||||
for move in res:
|
||||
SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date < '" + self.borne_date['max_date'] + "'" + " AND l.date > '" + self.borne_date['min_date'] + "'"
|
||||
self.cr.execute(SOLDEINIT)
|
||||
resultat = self.cr.dictfetchall()
|
||||
if resultat[0] :
|
||||
if resultat[0]['sum_debit'] == None:
|
||||
sum_debit = 0
|
||||
else:
|
||||
sum_debit = resultat[0]['sum_debit']
|
||||
if resultat[0]['sum_credit'] == None:
|
||||
sum_credit = 0
|
||||
else:
|
||||
sum_credit = resultat[0]['sum_credit']
|
||||
|
||||
move.init_credit = sum_credit
|
||||
move.init_debit = sum_debit
|
||||
|
||||
else:
|
||||
move.init_credit = 0
|
||||
move.init_debit = 0
|
||||
|
||||
##
|
||||
return res
|
||||
|
||||
def get_min_date(self,form):
|
||||
## Get max born from account_fiscal year
|
||||
#
|
||||
sql = """ select min(fy.date_start) from account_fiscalyear
|
||||
As fy where fy.state <> 'close'
|
||||
"""
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['min']
|
||||
#
|
||||
##
|
||||
if form.has_key('fiscalyear'):
|
||||
## This function will return the most aged date
|
||||
periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
"""
|
||||
else:
|
||||
periods_id = ','.join(map(str, periods))
|
||||
sql = """
|
||||
Select min(p.date_start) from account_period as p where p.id in ( """ + periods_id + """)
|
||||
"""
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
borne_max = res[0]['min']
|
||||
else:
|
||||
borne_max = form['date_from']
|
||||
date_borne = {
|
||||
'min_date': borne_min,
|
||||
'max_date': borne_max,
|
||||
}
|
||||
return date_borne
|
||||
|
||||
|
||||
|
||||
def lines(self, account, form):
|
||||
inv_types = {
|
||||
'out_invoice': 'CI: ',
|
||||
'in_invoice': 'SI: ',
|
||||
'out_refund': 'OR: ',
|
||||
'in_refund': 'SR: ',
|
||||
}
|
||||
### We will now compute solde initaux
|
||||
|
||||
if form['sortbydate'] == 'sort_date':
|
||||
sorttag = 'l.date'
|
||||
else:
|
||||
sorttag = 'j.code'
|
||||
sql = """
|
||||
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name , l.debit, l.credit, l.period_id
|
||||
FROM account_move_line l LEFT JOIN res_currency c on (l.currency_id=c.id) JOIN account_journal j on (l.journal_id=j.id)
|
||||
AND account_id = %d AND %s
|
||||
ORDER by %s"""%(account.id,self.query,sorttag)
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
for l in res:
|
||||
line = self.pool.get('account.move.line').browse(self.cr, self.uid, l['id'])
|
||||
l['move'] = line.move_id.name
|
||||
self.cr.execute('Select id from account_invoice where move_id =%s'%(line.move_id.id))
|
||||
tmpres = self.cr.dictfetchall()
|
||||
if len(tmpres) > 0 :
|
||||
inv = self.pool.get('account.invoice').browse(self.cr, self.uid, tmpres[0]['id'])
|
||||
l['ref'] = inv_types[inv.type] + ': '+str(inv.number)
|
||||
if line.partner_id :
|
||||
l['partner'] = line.partner_id.name
|
||||
else :
|
||||
l['partner'] = ''
|
||||
sum += l['debit'] - l ['credit']
|
||||
c = time.strptime(l['date'],"%Y-%m-%d")
|
||||
l['date'] = time.strftime("%d-%m-%Y",c)
|
||||
l['progress'] = sum
|
||||
l['line_corresp'] = self._calc_contrepartie(self.cr,self.uid,[l['id']])[l['id']]
|
||||
# Modification du amount Currency
|
||||
if (l['credit'] > 0):
|
||||
if l['amount_currency'] != None:
|
||||
l['amount_currency'] = abs(l['amount_currency']) * -1
|
||||
|
||||
#
|
||||
if l['amount_currency'] != None:
|
||||
self.tot_currency = self.tot_currency + l['amount_currency']
|
||||
return res
|
||||
|
||||
def _sum_debit_account(self, account, form):
|
||||
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
|
||||
## Add solde init to the result
|
||||
#
|
||||
sum_debit = self.cr.fetchone()[0] or 0.0
|
||||
if form['soldeinit']:
|
||||
sum_debit += account.init_debit
|
||||
#
|
||||
##
|
||||
return sum_debit
|
||||
|
||||
def _sum_credit_account(self, account, form):
|
||||
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id,self.query))
|
||||
## Add solde init to the result
|
||||
#
|
||||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
if form['soldeinit']:
|
||||
sum_credit += account.init_credit
|
||||
#
|
||||
##
|
||||
|
||||
return sum_credit
|
||||
|
||||
def _sum_solde_account(self, account, form):
|
||||
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s"%(account.id,self.query))
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
if form['soldeinit']:
|
||||
sum_solde += account.init_debit - account.init_credit
|
||||
|
||||
return sum_solde
|
||||
|
||||
|
||||
def recur(self,list1):
|
||||
tmp_list3 =list1
|
||||
self.tmp_list2 =list1
|
||||
# print "self list",self.tmp_list2
|
||||
for i in range(0,len(list1)):
|
||||
if list1[i] in self.final_list:
|
||||
continue
|
||||
self.final_list.append(list1[i])
|
||||
# print "finallly",self.final_list
|
||||
if list1[i].child_id:
|
||||
def _sum_debit(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
|
||||
sum_debit = self.cr.fetchone()[0] or 0.0
|
||||
return sum_debit
|
||||
|
||||
tmp_list4=(hasattr(list1[i],'child_id') and list(list1[i].child_id) or [])
|
||||
|
||||
self.tmp_list2 +=tmp_list4
|
||||
def _sum_credit(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
|
||||
## Add solde init to the result
|
||||
#
|
||||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
return sum_credit
|
||||
|
||||
self.tmp_list2+=self.recur(tmp_list4)
|
||||
|
||||
return self.final_list
|
||||
|
||||
def repeatIn(self, lst, name,nodes_parent=False):
|
||||
|
||||
if name=='o':
|
||||
list_final=[]
|
||||
if not lst:
|
||||
return super(general_ledger,self).repeatIn(lst, name,nodes_parent)
|
||||
try:
|
||||
tmp_list = list(lst)
|
||||
if tmp_list:
|
||||
tmp_list = self.recur(tmp_list)
|
||||
else:
|
||||
return super(general_ledger,self).repeatIn(lst, name,nodes_parent)
|
||||
|
||||
lst = list(set([x for x in tmp_list]))
|
||||
|
||||
final={}
|
||||
# for x in lst:
|
||||
# final[x]=x.id
|
||||
# final1=sorted(final.items(), lambda x, y: cmp(x[1], y[1]))
|
||||
#
|
||||
# for a in final1:
|
||||
# list_final.append(a[0])
|
||||
list_final=tmp_list
|
||||
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
|
||||
list_final=lst
|
||||
ret_data = super(general_ledger,self).repeatIn(list_final, name,nodes_parent)
|
||||
|
||||
return ret_data
|
||||
|
||||
def check_lines(self, account, form):
|
||||
result = self.lines(account, form, history=True)
|
||||
res = [{'code':account.code,'name':account.name}]
|
||||
if not result:
|
||||
res = []
|
||||
return res
|
||||
|
||||
def lines(self, account, form, history=False):
|
||||
self.ids +=[account.id]
|
||||
if not account.check_history and not history:
|
||||
return []
|
||||
|
||||
ctx = self.context.copy()
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['state']=form['state']
|
||||
query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
self.cr.execute("SELECT l.date, j.code, l.ref, l.name, l.debit, l.credit "\
|
||||
"FROM account_move_line l, account_journal j "\
|
||||
"WHERE l.journal_id = j.id "\
|
||||
"AND account_id = %d AND "+query+" "\
|
||||
"ORDER by l.id", (account.id,))
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
|
||||
for l in res:
|
||||
sum += l['debit'] - l ['credit']
|
||||
l['progress'] = sum
|
||||
return res
|
||||
|
||||
def _sum_debit_account(self, account, form):
|
||||
ctx = self.context.copy()
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['state']=form['state']
|
||||
query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %d AND "+query, (account.id,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit_account(self, account, form):
|
||||
ctx = self.context.copy()
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['state']=form['state']
|
||||
query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %d AND "+query, (account.id,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_debit(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
ctx = self.context.copy()
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['state']=form['state']
|
||||
query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.ids))+") AND "+query)
|
||||
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
ctx = self.context.copy()
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['state']=form['state']
|
||||
query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.ids))+") AND "+query)
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
def _sum_solde(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
|
||||
# print ("SELECT (sum(debit) - sum(credit)) as Test "\
|
||||
# "FROM account_move_line l "\
|
||||
# "WHERE l.account_id in ("+','.join(map(str, child_ids))+") AND "+query+period_sql)
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
return sum_solde
|
||||
|
||||
def _set_get_account_currency_code(self, account_id):
|
||||
self.cr.execute("SELECT c.code as code "\
|
||||
"FROM res_currency c,account_account as ac "\
|
||||
"WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
|
||||
result = self.cr.fetchone()
|
||||
if result:
|
||||
self.account_currency = result[0]
|
||||
else:
|
||||
self.account_currency = False
|
||||
|
||||
|
||||
def _sum_currency_amount_account(self, account, form):
|
||||
self._set_get_account_currency_code(account.id)
|
||||
if self.account_currency:
|
||||
return_field = str(self.tot_currency) + self.account_currency
|
||||
self.tot_currency = 0.0
|
||||
return return_field
|
||||
else:
|
||||
self.tot_currency = 0.0
|
||||
return ' '
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/general_ledger.rml', parser=general_ledger, header=False)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -3,236 +3,331 @@
|
|||
<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"/>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
<!--<stroke color="darkblue"/>-->
|
||||
|
||||
<!--TITLE COMPANY-->
|
||||
<!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
|
||||
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
|
||||
<drawString x="17.7cm" y="28.1cm">General Ledger</drawString>
|
||||
|
||||
<!--COL 2-->
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.0cm" y="1cm"> [[ time.strftime("%d-%m-%Y %H:%M", time.localtime()) ]]</drawString>
|
||||
<drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
|
||||
<!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
|
||||
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1cm 27.7cm 20cm 27.7cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
</pageGraphics>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<stylesheet>
|
||||
|
||||
<blockTableStyle id="tbl_header">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="tbl_content">
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,0"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table7">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table8">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
|
||||
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="14.0" leading="17"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" rightIndent="0.0" leftIndent="0.0" fontName="Times-Bold" fontSize="10.0" leading="13"/>
|
||||
<paraStyle name="P16" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="8.0" leading="10"/>
|
||||
<paraStyle name="P17" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P18" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P19" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P20" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P21" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P22" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P23" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<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="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="8.3" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="date" fontName="Helvetica" fontSize="8.3" leading="10" spaceBefore="0.0" spaceAfter="6.0" alignment="CENTER"/>
|
||||
<paraStyle name="P2_content" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.3" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3_centre" fontName="Helvetica" fontSize="8.3" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3_content" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="8.3" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4_content" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="14.0" leading="17"/>
|
||||
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="10.0" leading="8" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P16" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P17" fontName="Helvetica" alignment="LEFT" fontSize="12.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica-Bold" fontSize="8.5"/>
|
||||
<paraStyle name="Account" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<blockTable colWidths="126.0,217.0,138.0" repeatRows="1" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">General ledger</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">[[ company.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Currency: [[ company.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P10">Printing date: [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P11">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="48.0,34.0,50.0,145.0,69.0,72.0,64.0" repeatRows="1" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P13">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">Ref.</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">Entry label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">Progressive balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Text body">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="482.0" style="Table7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P17">[[ repeatIn(objects, 'o') ]] </para>
|
||||
<para style="P17">[[ repeatIn(check_lines(o,data['form']), 'acc') ]]</para>
|
||||
<para style="P17">
|
||||
<font face="Times-Bold" size="10.0">[[ acc and acc['code'] or removeParentNode('para') ]] [[ acc and acc['name'] or removeParentNode('para') ]]</font>
|
||||
</para>
|
||||
<blockTable colWidths="44.0,38.0,50.0,144.0,69.0,72.0,64.0" style="Table8">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P14"><font face="Times-Roman">[[ repeatIn(lines(o, data['form']), 'line') ]]</font>[[ line['date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ formatLang(line['debit']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ formatLang(line['credit']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ formatLang(line['progress']) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P14">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P14">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">TOTAL (<font face="Times-Roman" size="10.0">[[ acc and acc['code'] or removeParentNode('para') ]]):</font></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_debit_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_credit_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="277.0,69.0,72.0,63.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P8">TOTAL:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_debit(data['form'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_credit(data['form'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
<blockTable colWidths="54.0,155.0,70.0,20.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3_centre">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Partner</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Ref</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Mvt</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Entry Label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Crebit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">Balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<td>
|
||||
<blockTable colWidths="48.0,155.0,70.0,20.0,80.0,59.0,52.0,54.0" style="tbl_content">
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="273.00,100.0,52.5,52.5,52.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[ sum_debit_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[sum_credit_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
[[ data['form']['soldeinit'] == True or removeParentNode('tr') ]]
|
||||
<td>
|
||||
<para style="P16"></para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P3">Balance Initial</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ o.init_debit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ o.init_credit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ (o.init_debit - o.init_credit) or '0.0' ]]</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td>
|
||||
<para style="P3">[[ line['date'] ]]</para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P3">[[ line['partner'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['move'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<blockTable colWidths="59.0,125.0,66.0,20.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3_centre">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Partner</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Ref</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Mvt</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Entry Label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Crebit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Balance</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Currency</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<td>
|
||||
<blockTable colWidths="54.0,125.0,66.0,20.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content" >
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="259.00,100.0,50.0,50.0,49.0" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[ sum_debit_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[sum_credit_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>[[ data['form']['soldeinit'] == True or removeParentNode('tr') ]]
|
||||
<td>
|
||||
<para style="P16"></para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P3">Balance Initial</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ o.init_debit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ o.init_credit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ (o.init_debit - o.init_credit) or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4"> </para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td>
|
||||
<para style="P3">[[ line['date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['partner'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['move'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] ]]</para>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
</story>
|
||||
|
||||
|
||||
|
||||
</document>
|
||||
|
|
|
@ -0,0 +1,359 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 CamptoCamp
|
||||
#
|
||||
# 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
|
||||
from mx.DateTime import *
|
||||
from report import report_sxw
|
||||
import xml
|
||||
import rml_parse
|
||||
import pooler
|
||||
|
||||
class general_ledger_landscape(rml_parse.rml_parse):
|
||||
_name = 'report.account.general.ledger_landscape'
|
||||
|
||||
|
||||
def preprocess(self, objects, data, ids):
|
||||
##
|
||||
self.borne_date = self.get_min_date(data['form'])
|
||||
##
|
||||
new_ids = []
|
||||
if (data['model'] == 'account.account'):
|
||||
new_ids = ids
|
||||
else:
|
||||
new_ids.append(data['form']['Account_list'])
|
||||
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
|
||||
super(general_ledger_landscape, self).preprocess(objects, data, new_ids)
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(general_ledger_landscape, self).__init__(cr, uid, name, context)
|
||||
self.query = ""
|
||||
self.child_ids = ""
|
||||
self.tot_currency = 0.0
|
||||
self.period_sql = ""
|
||||
self.sold_accounts = {}
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_debit_account': self._sum_debit_account,
|
||||
'sum_credit_account': self._sum_credit_account,
|
||||
'sum_solde_account': self._sum_solde_account,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'sum_solde': self._sum_solde,
|
||||
'get_children_accounts': self.get_children_accounts,
|
||||
'sum_currency_amount_account': self._sum_currency_amount_account
|
||||
})
|
||||
self.context = context
|
||||
def _calc_contrepartie(self,cr,uid,ids, context={}):
|
||||
result = {}
|
||||
#for id in ids:
|
||||
# result.setdefault(id, False)
|
||||
|
||||
for account_line in self.pool.get('account.move.line').browse(cr, uid, ids, context):
|
||||
# For avoid long text in the field we will limit it to 5 lines
|
||||
#
|
||||
#
|
||||
#
|
||||
result[account_line.id] = ' '
|
||||
num_id_move = str(account_line.move_id.id)
|
||||
num_id_line = str(account_line.id)
|
||||
account_id = str(account_line.account_id.id)
|
||||
# search the basic account
|
||||
# We have the account ID we will search all account move line from now until this time
|
||||
# We are in the case of we are on the top of the account move Line
|
||||
cr.execute('SELECT distinct(ac.code) as code_rest,ac.name as name_rest from account_account AS ac, account_move_line mv\
|
||||
where ac.id = mv.account_id and mv.move_id = ' + num_id_move +' and mv.account_id <> ' + account_id )
|
||||
res_mv = cr.dictfetchall()
|
||||
# we need a result more than 2 line to make the test so we will made the the on 1 because we have exclude the current line
|
||||
if (len(res_mv) >=1):
|
||||
concat = ''
|
||||
rup_id = 0
|
||||
for move_rest in res_mv:
|
||||
concat = concat + move_rest['code_rest'] + '|'
|
||||
result[account_line.id] = concat
|
||||
if rup_id >5:
|
||||
# we need to stop the computing and to escape but before we will add "..."
|
||||
result[account_line.id] = concat + '...'
|
||||
break
|
||||
rup_id+=1
|
||||
|
||||
#print str(result)
|
||||
return result
|
||||
|
||||
def get_min_date(self,form):
|
||||
## Get max born from account_fiscal year
|
||||
#
|
||||
sql = """ select min(fy.date_start) from account_fiscalyear
|
||||
As fy where fy.state <> 'close'
|
||||
"""
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['min']
|
||||
#
|
||||
##
|
||||
if form.has_key('fiscalyear'):
|
||||
## This function will return the most aged date
|
||||
periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
"""
|
||||
else:
|
||||
periods_id = ','.join(map(str, periods))
|
||||
sql = """
|
||||
Select min(p.date_start) from account_period as p where p.id in ( """ + periods_id + """)
|
||||
"""
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
borne_max = res[0]['min']
|
||||
else:
|
||||
borne_max = form['date_from']
|
||||
date_borne = {
|
||||
'min_date': borne_min,
|
||||
'max_date': borne_max,
|
||||
}
|
||||
return date_borne
|
||||
|
||||
|
||||
|
||||
def get_children_accounts(self, account, form):
|
||||
|
||||
|
||||
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
|
||||
[('parent_id', 'child_of', self.ids)])
|
||||
#
|
||||
res = []
|
||||
ctx = self.context.copy()
|
||||
## We will make the test for period or date
|
||||
## We will now make the test
|
||||
#
|
||||
if form.has_key('fiscalyear'):
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
else:
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
##
|
||||
|
||||
#
|
||||
self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
|
||||
for child_id in self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])]):
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
#print "Type de vue :" + form['display_account']
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
if ( sold_account <> 0.0):
|
||||
res.append(child_account)
|
||||
else:
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
##
|
||||
if form['soldeinit']:
|
||||
## We will now compute solde initiaux
|
||||
for move in res:
|
||||
SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date < '" + self.borne_date['max_date'] + "'" + " AND l.date > '" + self.borne_date['min_date'] + "'"
|
||||
self.cr.execute(SOLDEINIT)
|
||||
resultat = self.cr.dictfetchall()
|
||||
if resultat[0] :
|
||||
if resultat[0]['sum_debit'] == None:
|
||||
sum_debit = 0
|
||||
else:
|
||||
sum_debit = resultat[0]['sum_debit']
|
||||
if resultat[0]['sum_credit'] == None:
|
||||
sum_credit = 0
|
||||
else:
|
||||
sum_credit = resultat[0]['sum_credit']
|
||||
|
||||
move.init_credit = sum_credit
|
||||
move.init_debit = sum_debit
|
||||
|
||||
else:
|
||||
move.init_credit = 0
|
||||
move.init_debit = 0
|
||||
|
||||
##
|
||||
return res
|
||||
|
||||
def lines(self, account, form):
|
||||
inv_types = {
|
||||
'out_invoice': 'CI: ',
|
||||
'in_invoice': 'SI: ',
|
||||
'out_refund': 'OR: ',
|
||||
'in_refund': 'SR: ',
|
||||
}
|
||||
|
||||
if form['sortbydate'] == 'sort_date':
|
||||
sorttag = 'l.date'
|
||||
else:
|
||||
sorttag = 'j.code'
|
||||
sql = """
|
||||
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name, l.debit, l.credit, l.period_id
|
||||
FROM account_move_line l LEFT JOIN res_currency c on (l.currency_id=c.id) JOIN account_journal j on (l.journal_id=j.id)
|
||||
AND account_id = %d AND %s
|
||||
ORDER by %s"""%(account.id,self.query,sorttag)
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
for l in res:
|
||||
line = self.pool.get('account.move.line').browse(self.cr, self.uid, l['id'])
|
||||
l['move'] = line.move_id.name
|
||||
self.cr.execute('Select id from account_invoice where move_id =%s'%(line.move_id.id))
|
||||
tmpres = self.cr.dictfetchall()
|
||||
if len(tmpres) > 0 :
|
||||
inv = self.pool.get('account.invoice').browse(self.cr, self.uid, tmpres[0]['id'])
|
||||
l['ref'] = inv_types[inv.type] + ': '+str(inv.number)
|
||||
if line.partner_id :
|
||||
l['partner'] = line.partner_id.name
|
||||
else :
|
||||
l['partner'] = ''
|
||||
sum += l['debit'] - l ['credit']
|
||||
c = time.strptime(l['date'],"%Y-%m-%d")
|
||||
l['date'] = time.strftime("%d-%m-%Y",c)
|
||||
l['progress'] = sum
|
||||
l['line_corresp'] = self._calc_contrepartie(self.cr,self.uid,[l['id']])[l['id']]
|
||||
# Modification du amount Currency
|
||||
if (l['credit'] > 0):
|
||||
if l['amount_currency'] != None:
|
||||
l['amount_currency'] = abs(l['amount_currency']) * -1
|
||||
|
||||
#
|
||||
if l['amount_currency'] != None:
|
||||
self.tot_currency = self.tot_currency + l['amount_currency']
|
||||
return res
|
||||
|
||||
def _sum_debit_account(self, account, form):
|
||||
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
|
||||
## Add solde init to the result
|
||||
#
|
||||
sum_debit = self.cr.fetchone()[0] or 0.0
|
||||
if form['soldeinit']:
|
||||
sum_debit += account.init_debit
|
||||
#
|
||||
##
|
||||
return sum_debit
|
||||
|
||||
def _sum_credit_account(self, account, form):
|
||||
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id,self.query))
|
||||
## Add solde init to the result
|
||||
#
|
||||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
if form['soldeinit']:
|
||||
sum_credit += account.init_credit
|
||||
#
|
||||
##
|
||||
|
||||
return sum_credit
|
||||
|
||||
def _sum_solde_account(self, account, form):
|
||||
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s"%(account.id,self.query))
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
if form['soldeinit']:
|
||||
sum_solde += account.init_debit - account.init_credit
|
||||
|
||||
return sum_solde
|
||||
|
||||
def _sum_debit(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
|
||||
sum_debit = self.cr.fetchone()[0] or 0.0
|
||||
return sum_debit
|
||||
|
||||
def _sum_credit(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
|
||||
## Add solde init to the result
|
||||
#
|
||||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
return sum_credit
|
||||
|
||||
def _sum_solde(self, form):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
|
||||
# print ("SELECT (sum(debit) - sum(credit)) as Test "\
|
||||
# "FROM account_move_line l "\
|
||||
# "WHERE l.account_id in ("+','.join(map(str, child_ids))+") AND "+query+period_sql)
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
return sum_solde
|
||||
|
||||
def _set_get_account_currency_code(self, account_id):
|
||||
self.cr.execute("SELECT c.code as code "\
|
||||
"FROM res_currency c,account_account as ac "\
|
||||
"WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
|
||||
result = self.cr.fetchone()
|
||||
if result:
|
||||
self.account_currency = result[0]
|
||||
else:
|
||||
self.account_currency = False
|
||||
|
||||
|
||||
def _sum_currency_amount_account(self, account, form):
|
||||
self._set_get_account_currency_code(account.id)
|
||||
if self.account_currency:
|
||||
return_field = str(self.tot_currency) + self.account_currency
|
||||
self.tot_currency = 0.0
|
||||
return return_field
|
||||
else:
|
||||
self.tot_currency = 0.0
|
||||
return ' '
|
||||
|
||||
report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/general_ledger_landscape.rml', parser=general_ledger_landscape, header=False)
|
|
@ -0,0 +1,421 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(1120.0,770.0)" title="Test" author="Martin Simon" allowSplitting="20" >
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="22.0" y1="35.0" width="1080" height="680"/>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
<!--<stroke color="darkblue"/>-->
|
||||
|
||||
<!--TITLE COMPANY-->
|
||||
<!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
|
||||
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.3cm" y="25.50cm">[[ company.name ]]</drawString>
|
||||
<drawString x="36.00cm" y="25.50cm">General Ledger</drawString>
|
||||
|
||||
<!--COL 2-->
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.3cm" y="0.90cm"> [[ time.strftime("%d-%m-%Y %H:%M", time.localtime()) ]]</drawString>
|
||||
<drawString x="37.20cm" y="0.90cm">Page <pageNumber/></drawString>
|
||||
|
||||
<!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
|
||||
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1.3cm 24.9cm 38.3cm 24.9cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
</pageGraphics>
|
||||
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
|
||||
<blockTableStyle id="tbl_header">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="tbl_content">
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,0"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
|
||||
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="8.3" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="date" fontName="Helvetica" fontSize="8.3" leading="10" spaceBefore="0.0" spaceAfter="6.0" alignment="CENTER"/>
|
||||
<paraStyle name="P2_content" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.3" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3_content" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="8.3" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4_content" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="14.0" leading="17"/>
|
||||
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="10.0" leading="8" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P16" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P17" fontName="Helvetica" alignment="LEFT" fontSize="12.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica-Bold" fontSize="8.5"/>
|
||||
<paraStyle name="Account" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
|
||||
|
||||
<blockTable colWidths="55.0,35.0,180.0, 90.0,30.0,345.0,50.0,69.0,72.0,64.0,58.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="date">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="date">JNRL</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P2">Partner</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P2">Ref</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P2">Mvt</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P3">Entry Label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font> </para>
|
||||
<para style="P3">Counterpart</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P4">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P4">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P4">Balance</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12"><font color="white"> </font></para>
|
||||
<para style="P4">Currency</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<td>
|
||||
|
||||
<blockTable colWidths="50.0,35.0,180.0, 90.0,30.0,345.0,50.0,69.0,72.0,64.0,58.0" style="tbl_content" >
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="400.0,374.0,69.0,72.0,64.0" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[ sum_debit_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[ sum_credit_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ sum_solde_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>[[ data['form']['soldeinit'] == True or removeParentNode('tr') ]]
|
||||
<td>
|
||||
<para style="P3_content">Balance Initial</para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ o.init_debit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ o.init_credit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ (o.init_debit - o.init_credit) or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content"> </para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td>
|
||||
|
||||
<para style="P2_content">[[ line['date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['partner'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['move'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content">[[ strip_name(line['line_corresp'],55) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ line['debit'] and line['debit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ line['credit'] and line['credit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ line['progress'] and line['progress'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</blockTable>
|
||||
|
||||
|
||||
<blockTable colWidths="55.0,35.0,196.0,90.0,30.0,390.0,50.0,69.0,72.0,64.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="date">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="date">JNRL</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">Partner</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">Ref</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">Mvt</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P3">Entry Label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P3">Counterpart</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">Balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<blockTable colWidths="50.0,35.0,196.0, 90.0,30.0,390.0,50.0,69.0,72.0,64.0" style="tbl_content" >[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="400.0,435.0,69.0,72.0,64.0" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[ sum_debit_account(o, data['form']) or '0.0']]</u></para>
|
||||
</td>
|
||||
<td alignment="right">
|
||||
<para style="P9b"><u>[[sum_credit_account(o, data['form']) or '0.0']]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>[[ data['form']['soldeinit'] == True or removeParentNode('tr') ]]
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P3_content">Solde Initial</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content"></para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P4_content">[[ o.init_debit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ o.init_credit or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ o.init_debit - o.init_credit or '0.0' ]]</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td>
|
||||
<para style="P2_content">[[ line['date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['partner'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2_content">[[ line['move'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3_content">[[ strip_name(line['line_corresp'],55) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ line['debit'] and line['debit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ line['credit'] and line['credit'] or '0.0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4_content">[[ line['progress'] and line['progress'] or '0.0' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
||||
|
||||
</story>
|
||||
</document>
|
|
@ -127,7 +127,7 @@
|
|||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_Tax_Content_Table">
|
||||
<blockTableStyle id="Table_Main_Table">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,0" stop="0,-1"/>
|
||||
|
@ -137,8 +137,6 @@
|
|||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
|
@ -148,24 +146,16 @@
|
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="5,2" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="5,2" stop="5,2"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="6,2" stop="6,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#ffffff" start="6,2" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="6,2" stop="6,2"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,4" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,4" stop="0,4"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="1,4" stop="1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#ffffff" start="1,4" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,4" stop="1,4"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_Tax_Header">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
@ -181,32 +171,22 @@
|
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_Format_Border">
|
||||
<blockTableStyle id="Table_Table_Border_White">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#ffffff" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_Border_Color_Formating">
|
||||
<blockTableStyle id="Table_Final_Border">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#ffffff" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_Coment_Payment_Term">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_Payment_Terms">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
@ -296,7 +276,7 @@
|
|||
<para style="terp_tblheader_General_Centre">Invoice Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Partner Code</para>
|
||||
<para style="terp_tblheader_General_Centre">Partner Ref.</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
@ -316,7 +296,7 @@
|
|||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="211.0,62.0,63.0,63.0,51.0,74.0" style="Table_Header_Invoice_Line">
|
||||
<blockTable colWidths="211.0,62.0,63.0,63.0,36.0,89.0" style="Table_Header_Invoice_Line">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description</para>
|
||||
|
@ -334,13 +314,13 @@
|
|||
<para style="terp_tblheader_Details_Right">Disc. (%)</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Price</para>
|
||||
<para style="terp_tblheader_Details_Centre">Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(o.invoice_line,'l') ]]</para>
|
||||
<blockTable colWidths="211.0,62.0,36.0,27.0,63.0,51.0,46.0,26.0" style="Table_Invoice_Line_Content">
|
||||
<blockTable colWidths="211.0,62.0,36.0,27.0,63.0,36.0,62.0,26.0" style="Table_Invoice_Line_Content">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ l.name ]]</para>
|
||||
|
@ -369,41 +349,43 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Note">[[ repeatIn((l.note and l.note.splitlines()) or [], 'note') ]]</para>
|
||||
<para style="terp_default_Note">[[ note or removeParentNode('para') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_Note">[[ format(l.note or removeParentNode('tr')) ]]</para>
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Note">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
|
@ -477,11 +459,11 @@
|
|||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="196.0,334.0" style="Table_Tax_Content_Table">
|
||||
<blockTable colWidths="530.0" style="Table_Main_Table">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">[[ format(o.amount_tax or removeParentNode('blockTable')) ]]</para>
|
||||
<blockTable colWidths="65.0,62.0,68.0" style="Table_Tax_Header">
|
||||
<blockTable colWidths="54.0,58.0,67.0" style="Table_Tax_Header">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Tax</para>
|
||||
|
@ -498,16 +480,11 @@
|
|||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">[[ repeatIn(o.tax_line,'t') ]]</para>
|
||||
<blockTable colWidths="64.0,63.0,69.0" style="Table_Tax_Content">
|
||||
<blockTable colWidths="53.0,60.0,65.0" style="Table_Tax_Content">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ t.name ]]</para>
|
||||
|
@ -521,16 +498,23 @@
|
|||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="167.0,167.0" style="Table_Format_Border">
|
||||
<blockTable colWidths="53.0,60.0,65.0" style="Table_Table_Border_White">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
|
@ -539,15 +523,15 @@
|
|||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="196.0,334.0" style="Table_Border_Color_Formating">
|
||||
<blockTable colWidths="180.0,350.0" style="Table_Final_Border">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
|
@ -573,8 +557,5 @@
|
|||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
from report import report_sxw
|
||||
import xml.dom.minidom
|
||||
import os, time
|
||||
import osv
|
||||
import re
|
||||
import tools
|
||||
import pooler
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
class rml_parse(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(rml_parse, self).__init__(cr, uid, name, context=None)
|
||||
self.localcontext.update({
|
||||
'comma_me': self.comma_me,
|
||||
'format_date': self._get_and_change_date_format_for_swiss,
|
||||
'strip_name' : self._strip_name,
|
||||
'explode_name' : self._explode_name,
|
||||
})
|
||||
|
||||
def comma_me(self,amount):
|
||||
#print "#" + str(amount) + "#"
|
||||
if not amount:
|
||||
amount = 0.0
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
amount = str(amount)
|
||||
if (amount == '0'):
|
||||
return ' '
|
||||
orig = amount
|
||||
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
|
||||
if orig == new:
|
||||
return new
|
||||
else:
|
||||
return self.comma_me(new)
|
||||
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
|
||||
ellipsis = ellipsis or ''
|
||||
try:
|
||||
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
|
||||
except Exception, e:
|
||||
return False
|
||||
def _strip_name(self, name, maxlen=50):
|
||||
return self._ellipsis(name, maxlen, '...')
|
||||
|
||||
def _get_and_change_date_format_for_swiss (self,date_to_format):
|
||||
date_formatted=''
|
||||
if date_to_format:
|
||||
date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
|
||||
return date_formatted
|
||||
|
||||
def _explode_name(self,chaine,length):
|
||||
# We will test if the size is less then account
|
||||
full_string = ''
|
||||
if (len(str(chaine)) <= length):
|
||||
return chaine
|
||||
#
|
||||
else:
|
||||
chaine = unicode(chaine,'utf8').encode('iso-8859-1')
|
||||
rup = 0
|
||||
for carac in chaine:
|
||||
rup = rup + 1
|
||||
if rup == length:
|
||||
full_string = full_string + '\n'
|
||||
full_string = full_string + carac
|
||||
rup = 0
|
||||
else:
|
||||
full_string = full_string + carac
|
||||
|
||||
return full_string
|
||||
|
||||
def makeAscii(self,str):
|
||||
try:
|
||||
Stringer = str.encode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
Stringer = str.encode("utf-16")
|
||||
except UnicodeDecodeError:
|
||||
print "UTF_16 Error"
|
||||
Stringer = str
|
||||
else:
|
||||
return Stringer
|
||||
else:
|
||||
return Stringer
|
||||
return Stringer
|
||||
def explode_this(self,chaine,length):
|
||||
#chaine = self.repair_string(chaine)
|
||||
chaine = rstrip(chaine)
|
||||
ast = list(chaine)
|
||||
i = length
|
||||
while i <= len(ast):
|
||||
ast.insert(i,'\n')
|
||||
i = i + length
|
||||
chaine = str("".join(ast))
|
||||
return chaine
|
||||
def repair_string(self,chaine):
|
||||
ast = list(chaine)
|
||||
UnicodeAst = []
|
||||
_previouslyfound = False
|
||||
i = 0
|
||||
#print str(ast)
|
||||
while i < len(ast):
|
||||
elem = ast[i]
|
||||
try:
|
||||
Stringer = elem.encode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
to_reencode = elem + ast[i+1]
|
||||
print str(to_reencode)
|
||||
Good_char = to_reencode.decode('utf-8')
|
||||
UnicodeAst.append(Good_char)
|
||||
i += i +2
|
||||
else:
|
||||
UnicodeAst.append(elem)
|
||||
i += i + 1
|
||||
|
||||
|
||||
return "".join(UnicodeAst)
|
||||
|
||||
def ReencodeAscii(self,str):
|
||||
print sys.stdin.encoding
|
||||
try:
|
||||
Stringer = str.decode("ascii")
|
||||
except UnicodeEncodeError:
|
||||
print "REENCODING ERROR"
|
||||
return str.encode("ascii")
|
||||
except UnicodeDecodeError:
|
||||
print "DECODING ERROR"
|
||||
return str.encode("ascii")
|
||||
|
||||
else:
|
||||
print Stringer
|
||||
return Stringer
|
||||
|
||||
|
||||
# def _add_header(self, node):
|
||||
# rml_head = tools.file_open('specific_param/report/header/corporate_rml_header_ch.rml').read()
|
||||
# head_dom = xml.dom.minidom.parseString(rml_head)
|
||||
# #for frame in head_dom.getElementsByTagName('frame'):
|
||||
# # frame.parentNode.removeChild(frame)
|
||||
# node2 = head_dom.documentElement
|
||||
# for tag in node2.childNodes:
|
||||
# if tag.nodeType==tag.ELEMENT_NODE:
|
||||
# found = self._find_node(node, tag.localName)
|
||||
# # rml_frames = found.getElementsByTagName('frame')
|
||||
# if found:
|
||||
# if tag.hasAttribute('position') and (tag.getAttribute('position')=='inside'):
|
||||
# found.appendChild(tag)
|
||||
# else:
|
||||
# found.parentNode.replaceChild(tag, found)
|
||||
# # for frame in rml_frames:
|
||||
# # tag.appendChild(frame)
|
||||
# return True
|
||||
|
||||
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -30,92 +27,206 @@
|
|||
|
||||
import time
|
||||
import pooler
|
||||
import rml_parse
|
||||
import copy
|
||||
from report import report_sxw
|
||||
import pdb
|
||||
import re
|
||||
|
||||
class tax_report(report_sxw.rml_parse):
|
||||
class tax_report(rml_parse.rml_parse):
|
||||
_name = 'report.account.vat.declaration'
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(tax_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_period': self._get_period,
|
||||
'get_codes': self._get_codes,
|
||||
'get_general': self._get_general,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
'get_lines' : self._get_lines,
|
||||
})
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(tax_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_period': self._get_period,
|
||||
'get_codes': self._get_codes,
|
||||
'get_general': self._get_general,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
})
|
||||
|
||||
def comma_me(self,amount):
|
||||
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
amount = str(amount)
|
||||
if (amount == '0'):
|
||||
return ' '
|
||||
orig = amount
|
||||
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
|
||||
if orig == new:
|
||||
return new
|
||||
else:
|
||||
return self.comma_me(new)
|
||||
def _get_lines(self, based_on,period_list,company_id=False, parent=False, level=0):
|
||||
res = self._get_codes(based_on,parent,level,period_list)
|
||||
res = self._add_codes(based_on,res,period_list)
|
||||
|
||||
i = 0
|
||||
top_result = []
|
||||
|
||||
while i < len(res):
|
||||
|
||||
res_dict = { 'code' : res[i][1].code,
|
||||
'name' : res[i][1].name,
|
||||
'debit' : 0,
|
||||
'credit' : 0,
|
||||
'tax_amount' : res[i][1].sum_period,
|
||||
'type' : 1,
|
||||
'level' : res[i][0],
|
||||
'pos' : 0
|
||||
}
|
||||
|
||||
top_result.append(res_dict)
|
||||
res_general = self._get_general(res[i][1].id,period_list,company_id,based_on)
|
||||
ind_general = 0
|
||||
while ind_general < len(res_general) :
|
||||
res_general[ind_general]['type'] = 2
|
||||
res_general[ind_general]['pos'] = 0
|
||||
res_general[ind_general]['level'] = res_dict['level'] + ' '
|
||||
top_result.append(res_general[ind_general])
|
||||
ind_general+=1
|
||||
i+=1
|
||||
#array_result = self.sort_result(top_result)
|
||||
return top_result
|
||||
#return array_result
|
||||
|
||||
def _add_header(self, node):
|
||||
return True
|
||||
def _get_period(self, period_id):
|
||||
return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name
|
||||
|
||||
def _get_period(self, period_id):
|
||||
return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name
|
||||
def _get_general(self, tax_code_id,period_list ,company_id, based_on):
|
||||
res=[]
|
||||
period_sql_list = ','.join(map(str, period_list[0][2]))
|
||||
|
||||
if based_on == 'payments':
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id, \
|
||||
account.name AS name, \
|
||||
account.code AS code \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account, \
|
||||
account_move AS move \
|
||||
LEFT JOIN account_invoice invoice ON \
|
||||
(invoice.move_id = move.id) \
|
||||
WHERE line.state<>%s \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND move.id = line.move_id \
|
||||
AND ((invoice.state = %s) \
|
||||
OR (invoice.id IS NULL)) \
|
||||
GROUP BY account.id,account.name,account.code', ('draft',tax_code_id,
|
||||
company_id, 'paid'))
|
||||
|
||||
def _get_general(self, tax_code_id, period_id, company_id, based_on):
|
||||
res=[]
|
||||
if based_on == 'payments':
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account, \
|
||||
account_move AS move \
|
||||
LEFT JOIN account_invoice invoice ON \
|
||||
(invoice.move_id = move.id) \
|
||||
WHERE line.state<>%s \
|
||||
AND line.period_id = %d \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND move.id = line.move_id \
|
||||
AND ((invoice.state = %s) \
|
||||
OR (invoice.id IS NULL)) \
|
||||
GROUP BY account.id', ('draft', period_id, tax_code_id,
|
||||
company_id, 'paid'))
|
||||
else :
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account \
|
||||
WHERE line.state <> %s \
|
||||
AND line.period_id = %d \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND account.active \
|
||||
GROUP BY account.id', ('draft', period_id, tax_code_id,
|
||||
company_id))
|
||||
res = self.cr.dictfetchall()
|
||||
i = 0
|
||||
while i<len(res):
|
||||
res[i]['account'] = self.pool.get('account.account').browse(self.cr, self.uid, res[i]['account_id'])
|
||||
i+=1
|
||||
return res
|
||||
else :
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id, \
|
||||
account.name AS name, \
|
||||
account.code AS code \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account \
|
||||
WHERE line.state <> %s \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND account.active \
|
||||
GROUP BY account.id,account.name,account.code', ('draft',tax_code_id,
|
||||
company_id))
|
||||
res = self.cr.dictfetchall()
|
||||
#AND line.period_id IN ('+ period_sql_list +') \
|
||||
|
||||
i = 0
|
||||
while i<len(res):
|
||||
res[i]['account'] = self.pool.get('account.account').browse(self.cr, self.uid, res[i]['account_id'])
|
||||
i+=1
|
||||
return res
|
||||
|
||||
def _get_codes(self, period_id, based_on, parent=False, level=0):
|
||||
tc = self.pool.get('account.tax.code')
|
||||
ids = tc.search(self.cr, self.uid, [('parent_id','=',parent)])
|
||||
res = []
|
||||
for code in tc.browse(self.cr, self.uid, ids, {'period_id': period_id,
|
||||
'based_on': based_on}):
|
||||
res.append((' - '*level*2, code))
|
||||
res += self._get_codes(period_id, based_on, code.id, level+1)
|
||||
return res
|
||||
def _get_codes(self, based_on, parent=False, level=0,period_list=[]):
|
||||
tc = self.pool.get('account.tax.code')
|
||||
ids = tc.search(self.cr, self.uid, [('parent_id','=',parent)])
|
||||
|
||||
res = []
|
||||
for code in tc.browse(self.cr, self.uid, ids, {'based_on': based_on}):
|
||||
res.append(('a'*2*level,code))
|
||||
print"=====res=====",res
|
||||
res += self._get_codes(based_on, code.id, level+1)
|
||||
return res
|
||||
|
||||
def _add_codes(self,based_on, account_list=[],period_list=[]):
|
||||
res = []
|
||||
for account in account_list:
|
||||
tc = self.pool.get('account.tax.code')
|
||||
ids = tc.search(self.cr, self.uid, [('id','=',account[1].id)])
|
||||
sum_tax_add = 0
|
||||
for period_ind in period_list[0][2]:
|
||||
for code in tc.browse(self.cr, self.uid, ids, {'period_id':period_ind,'based_on': based_on}):
|
||||
sum_tax_add = sum_tax_add + code.sum_period
|
||||
|
||||
code.sum_period = sum_tax_add
|
||||
|
||||
res.append((account[0],code))
|
||||
return res
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
|
||||
def sort_result(self,accounts):
|
||||
# On boucle sur notre rapport
|
||||
result_accounts = []
|
||||
ind=0
|
||||
old_level=0
|
||||
while ind<len(accounts):
|
||||
#
|
||||
account_elem = accounts[ind]
|
||||
#
|
||||
|
||||
#
|
||||
# we will now check if the level is lower than the previous level, in this case we will make a subtotal
|
||||
if (account_elem['level'] < old_level):
|
||||
bcl_current_level = old_level
|
||||
bcl_rup_ind = ind - 1
|
||||
|
||||
while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ):
|
||||
tot_elem = copy.copy(accounts[bcl_rup_ind])
|
||||
res_tot = { 'code' : accounts[bcl_rup_ind]['code'],
|
||||
'name' : '',
|
||||
'debit' : 0,
|
||||
'credit' : 0,
|
||||
'tax_amount' : accounts[bcl_rup_ind]['tax_amount'],
|
||||
'type' : accounts[bcl_rup_ind]['type'],
|
||||
'level' : 0,
|
||||
'pos' : 0
|
||||
}
|
||||
|
||||
if res_tot['type'] == 1:
|
||||
# on change le type pour afficher le total
|
||||
res_tot['type'] = 2
|
||||
result_accounts.append(res_tot)
|
||||
bcl_current_level = accounts[bcl_rup_ind]['level']
|
||||
bcl_rup_ind -= 1
|
||||
|
||||
old_level = account_elem['level']
|
||||
result_accounts.append(account_elem)
|
||||
ind+=1
|
||||
|
||||
|
||||
return result_accounts
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
|
||||
'addons/account/report/tax_report.rml', parser=tax_report, header=False)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
'addons/account/report/tax_report.rml', parser=tax_report, header=False)
|
||||
|
||||
|
|
|
@ -2,7 +2,34 @@
|
|||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="42.0" y1="42.0" width="511" height="758"/>
|
||||
<frame id="first" x1="42.0" y1="62.0" width="511" height="728"/>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
<!--<stroke color="darkblue"/>-->
|
||||
|
||||
<!--TITLE COMPANY-->
|
||||
<!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
|
||||
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
|
||||
<drawRightString x="20cm" y="28.1cm">Tax Report</drawRightString>
|
||||
|
||||
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.0cm" y="1cm"> [[ time.strftime("%Y-%m-%d %H:%M", time.localtime()) ]]</drawString>
|
||||
<drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
|
||||
<!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
|
||||
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1cm 27.7cm 20cm 27.7cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
</pageGraphics>
|
||||
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
|
@ -20,10 +47,21 @@
|
|||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
||||
<blockTableStyle id="Table2">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,1" stop="3,1"/>
|
||||
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
@ -36,131 +74,145 @@
|
|||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="6.0" leading="8"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="7.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" 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="P1" fontName="Helvetica-Bold" alignment="CENTER" fontSize="14.5" leftIndent="-5.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9c" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12a" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P16" fontName="Helvetica-Bold" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="1.0" leading="1" spaceBefore="0" spaceAfter="0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
|
||||
<blockTableStyle id="TrLevelaaaaaaa">
|
||||
<blockLeftPadding length="80" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaaaaa">
|
||||
<blockLeftPadding length="60" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaaaa">
|
||||
<blockLeftPadding length="40" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaaa">
|
||||
<blockLeftPadding length="20" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaa">
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaa">
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,0" stop="-1,-1"/>
|
||||
<blockTopPadding length="13" start="0,0" stop="-1,0"/>
|
||||
<blockBottomPadding length="2" start="0,0" stop="-1,0"/>
|
||||
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<blockTopPadding length="26" start="0,0" stop="-1,0"/>
|
||||
<blockBottomPadding length="2" start="0,0" stop="-1,0"/>
|
||||
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<paraStyle
|
||||
name="Levelaaaaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
|
||||
<paraStyle
|
||||
name="Levelaaaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
|
||||
<paraStyle
|
||||
name="Levelaaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Levelaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Levelaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Levelaa"
|
||||
firstLineIndent="-0.03cm"
|
||||
fontName="Helvetica-Bold"
|
||||
fontSize="8.0" />
|
||||
<paraStyle name="Level"
|
||||
fontSize="8.0"
|
||||
fontName="Helvetica-Bold"
|
||||
/>
|
||||
|
||||
</stylesheet>
|
||||
<story>
|
||||
<blockTable colWidths="139.0,220.0,152.0" repeatRows="1" style="Table1">
|
||||
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="347.0,64.0,59.0,71.0" style="Table2" repeatRows="1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P12">Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Tax Report</para>
|
||||
<para style="P12a">Débit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">Period: [[ get_period(data['form']['period_id']) ]]</para>
|
||||
<para style="P12a">Crédit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12a">Solde</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">[[ get_company(data['form']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Currency: [[ get_currency(data['form']) ]]</para>
|
||||
</td>
|
||||
|
||||
<para style="Caption">[[ repeatIn(get_lines(data['form']['based_on'],data['form']['periods'],data['form']['company_id']), 'o') ]]</para>
|
||||
<td>
|
||||
<para style="P5"><font color="white">[[ o['level'] ]]</font>
|
||||
[[o['type']==1 and ( setTag('para','para',{'fontName':'Helvetica'}))]]<font></font>
|
||||
[[ setTag('tr','tr',{'style':'TrLevel'+str(o['level']), 'paraStyle':('Level'+str(o['level']))}) ]]<font></font>
|
||||
[[ o['code'] ]] [[ o['name'] ]]<font></font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[o['type']==2 and (o['debit']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6"> [[o['type']==2 and (o['credit']) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ o['tax_amount'] ]]</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P7"><font face="Times-Roman">Printing date: </font>[[ time.strftime('%Y-%m-%d') ]] <font face="Times-Roman">at</font> [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="148.0,168.0,64.0,59.0,71.0" repeatRows="1" style="Tableau3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Heading">Tax Code / Account</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">General Account</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Tax Amount</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P9">[[ repeatIn(get_codes(data['form']['period_id'], data['form']['based_on']), 'o') ]]</para>
|
||||
<blockTable colWidths="316.0,64.0,59.0,71.0" repeatRows="1" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">[[ o[0] ]] [[ o[1].code ]] - [[ o[1].name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ o[1].sum_period and ('%.2f' % o[1].sum_period) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="44.0,273.0,62.0,60.0,72.0" repeatRows="1" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">[[repeatIn(get_general(o[1], data['form']['period_id'], data['form']['company_id'], data['form']['based_on']), 'g') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ g['account'].code ]] - [[ g['account'].name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ g['debit'] and '%.2f' % g['debit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ g['credit'] and '%.2f' % g['credit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ g['tax_amount'] and '%.2f' % g['tax_amount'] or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
</blockTable>
|
||||
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -30,153 +27,364 @@
|
|||
|
||||
import pooler
|
||||
import time
|
||||
import re
|
||||
import rml_parse
|
||||
import datetime
|
||||
from report import report_sxw
|
||||
|
||||
class third_party_ledger(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(third_party_ledger, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_debit_partner': self._sum_debit_partner,
|
||||
'sum_credit_partner': self._sum_credit_partner,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
})
|
||||
class third_party_ledger(rml_parse.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
self.date_lst = []
|
||||
self.date_lst_string = ''
|
||||
super(third_party_ledger, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_debit_partner': self._sum_debit_partner,
|
||||
'sum_credit_partner': self._sum_credit_partner,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
'comma_me' : self.comma_me,
|
||||
})
|
||||
def date_range(self,start,end):
|
||||
start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d")))
|
||||
end = datetime.date.fromtimestamp(time.mktime(time.strptime(end,"%Y-%m-%d")))
|
||||
full_str_date = []
|
||||
#
|
||||
r = (end+datetime.timedelta(days=1)-start).days
|
||||
#
|
||||
date_array = [start+datetime.timedelta(days=i) for i in range(r)]
|
||||
for date in date_array:
|
||||
full_str_date.append(str(date))
|
||||
return full_str_date
|
||||
|
||||
#
|
||||
def transform_period_into_date_array(self,data):
|
||||
## Get All Period Date
|
||||
if not data['form']['periods'][0][2] :
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
else:
|
||||
periods_id = data['form']['periods'][0][2]
|
||||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
self.date_lst = date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_date_into_date_array(self,data):
|
||||
return_array = self.date_range(data['form']['date1'],data['form']['date2'])
|
||||
self.date_lst = return_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def preprocess(self, objects, data, ids):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': data['form']['fiscalyear'],'state':data['form']['state']})
|
||||
self.cr.execute(
|
||||
"SELECT DISTINCT line.partner_id " \
|
||||
"FROM account_move_line AS line, account_account AS account " \
|
||||
"WHERE line.partner_id IS NOT NULL " \
|
||||
"AND line.date >= %s " \
|
||||
"AND line.date <= %s " \
|
||||
"AND " + line_query + " " \
|
||||
"AND line.account_id = account.id " \
|
||||
"AND account.company_id = %d " \
|
||||
"AND account.active",
|
||||
(data['form']['date1'], data['form']['date2'],
|
||||
data['form']['company_id']))
|
||||
new_ids = [id for (id,) in self.cr.fetchall()]
|
||||
self.cr.execute(
|
||||
"SELECT a.id " \
|
||||
"FROM account_account a " \
|
||||
"LEFT JOIN account_account_type t " \
|
||||
"ON (a.type=t.code) " \
|
||||
"WHERE t.partner_account=TRUE " \
|
||||
"AND a.company_id = %d " \
|
||||
"AND a.active", (data['form']['company_id'],))
|
||||
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
|
||||
self.partner_ids = ','.join(map(str, new_ids))
|
||||
objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids)
|
||||
super(third_party_ledger, self).preprocess(objects, data, new_ids)
|
||||
def comma_me(self,amount):
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
amount = str(amount)
|
||||
if (amount == '0'):
|
||||
return ' '
|
||||
orig = amount
|
||||
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
|
||||
if orig == new:
|
||||
return new
|
||||
else:
|
||||
return self.comma_me(new)
|
||||
def special_map(self):
|
||||
string_map = ''
|
||||
for date_string in self.date_lst:
|
||||
string_map = date_string + ','
|
||||
return string_map
|
||||
|
||||
def preprocess(self, objects, data, ids):
|
||||
PARTNER_REQUEST = ''
|
||||
if (data['model'] == 'res.partner'):
|
||||
print"data['model']",data['model']
|
||||
## Si on imprime depuis les partenaires
|
||||
if ids:
|
||||
PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")"
|
||||
# Transformation des date
|
||||
#
|
||||
#
|
||||
if data['form'].has_key('fiscalyear'):
|
||||
self.transform_period_into_date_array(data)
|
||||
else:
|
||||
self.transform_date_into_date_array(data)
|
||||
##
|
||||
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
|
||||
#
|
||||
#new_ids = [id for (id,) in self.cr.fetchall()]
|
||||
if data['form']['result_selection'] == 'supplier':
|
||||
ACCOUNT_TYPE = "AND a.type='payable' "
|
||||
elif data['form']['result_selection'] == 'customer':
|
||||
ACCOUNT_TYPE = "AND a.type='receivable' "
|
||||
elif data['form']['result_selection'] == 'all':
|
||||
ACCOUNT_TYPE = "AND (a.type='receivable' OR a.type='payable') "
|
||||
|
||||
def lines(self, partner):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='l',
|
||||
context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
|
||||
self.cr.execute(
|
||||
"SELECT l.date, j.code, l.ref, l.name, l.debit, l.credit " \
|
||||
"FROM account_move_line l " \
|
||||
"LEFT JOIN account_journal j " \
|
||||
"ON (l.journal_id = j.id) " \
|
||||
"WHERE l.partner_id = %d " \
|
||||
"AND l.account_id IN (" + self.account_ids + ") " \
|
||||
"AND l.date >= %s " \
|
||||
"AND l.date <= %s "
|
||||
"AND " + line_query + " " \
|
||||
"ORDER BY l.id",
|
||||
(partner.id, self.datas['form']['date1'], self.datas['form']['date2']))
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
for r in res:
|
||||
sum += r['debit'] - r['credit']
|
||||
r['progress'] = sum
|
||||
return res
|
||||
self.cr.execute(
|
||||
"SELECT a.id " \
|
||||
"FROM account_account a " \
|
||||
"LEFT JOIN account_account_type t " \
|
||||
"ON (a.type=t.code) " \
|
||||
"WHERE t.partner_account=TRUE " \
|
||||
"AND a.company_id = %d " \
|
||||
" " + ACCOUNT_TYPE + " " \
|
||||
"AND a.active", (data['form']['company_id'],))
|
||||
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
partner_to_use = []
|
||||
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT DISTINCT line.partner_id " \
|
||||
"FROM account_move_line AS line, account_account AS account " \
|
||||
"WHERE line.partner_id IS NOT NULL " \
|
||||
"AND line.account_id = account.id " \
|
||||
"AND line.date < %s " \
|
||||
"AND line.reconcile_id IS NULL " \
|
||||
# "AND line.account_id IN (" + self.account_ids + ") " \
|
||||
" " + PARTNER_REQUEST + " " \
|
||||
"AND account.company_id = %d " \
|
||||
"AND account.active " ,
|
||||
(self.date_lst[len(self.date_lst)-1],data['form']['company_id']))
|
||||
else:
|
||||
self.cr.execute(
|
||||
"SELECT DISTINCT line.partner_id " \
|
||||
"FROM account_move_line AS line, account_account AS account " \
|
||||
"WHERE line.partner_id IS NOT NULL " \
|
||||
"AND line.account_id = account.id " \
|
||||
"AND line.date IN (" + self.date_lst_string + ") " \
|
||||
# "AND line.account_id IN (" + self.account_ids + ") " \
|
||||
" " + PARTNER_REQUEST + " " \
|
||||
"AND account.company_id = %d " \
|
||||
"AND account.active " ,
|
||||
(data['form']['company_id']))
|
||||
res = self.cr.dictfetchall()
|
||||
for res_line in res:
|
||||
partner_to_use.append(res_line['partner_id'])
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
for res_line in res:
|
||||
partner_to_use.append(res_line['partner_id'])
|
||||
new_ids = partner_to_use
|
||||
self.partner_ids = ','.join(map(str, new_ids))
|
||||
objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids)
|
||||
super(third_party_ledger, self).preprocess(objects, data, new_ids)
|
||||
|
||||
def _sum_debit_partner(self, partner):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid,
|
||||
obj='account_move_line',
|
||||
context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id = %d " \
|
||||
"AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND date >= %s " \
|
||||
"AND date <= %s " \
|
||||
"AND " + line_query,
|
||||
(partner.id, self.datas['form']['date1'], self.datas['form']['date2']))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit_partner(self, partner):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid,
|
||||
obj='account_move_line',
|
||||
context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id=%d " \
|
||||
"AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND date >= %s " \
|
||||
"AND date <= %s " \
|
||||
"AND " + line_query,
|
||||
(partner.id, self.datas["form"]["date1"], self.datas["form"]["date2"]))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_debit(self):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid,
|
||||
obj='account_move_line',
|
||||
context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
"AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND date >= %s " \
|
||||
"AND date <= %s " \
|
||||
"AND " + line_query,
|
||||
(self.datas['form']['date1'], self.datas['form']['date2']))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid,
|
||||
obj='account_move_line',
|
||||
context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
"AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND date >= %s " \
|
||||
"AND date <= %s " \
|
||||
"AND " + line_query,
|
||||
(self.datas['form']['date1'], self.datas['form']['date2']))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
def lines(self, partner,data):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
full_account = []
|
||||
if data['form']['reconcil'] :
|
||||
RECONCILE_TAG = " "
|
||||
else:
|
||||
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
|
||||
"FROM account_move_line l " \
|
||||
"LEFT JOIN account_journal j " \
|
||||
"ON (l.journal_id = j.id) " \
|
||||
"WHERE l.partner_id = %d " \
|
||||
# "AND l.account_id IN (" + self.account_ids + ") " \
|
||||
"AND l.date < %s " \
|
||||
"AND l.reconcile_id IS NULL "
|
||||
"ORDER BY l.id",
|
||||
(partner.id, self.date_lst[0]))
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
for r in res:
|
||||
sum = r['debit'] - r['credit']
|
||||
r['progress'] = sum
|
||||
full_account.append(r)
|
||||
|
||||
self.cr.execute(
|
||||
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
|
||||
"FROM account_move_line l " \
|
||||
"LEFT JOIN account_journal j " \
|
||||
"ON (l.journal_id = j.id) " \
|
||||
"WHERE l.partner_id = %d " \
|
||||
# "AND l.account_id IN (" + self.account_ids + ") " \
|
||||
"AND l.date IN (" + self.date_lst_string + ") " \
|
||||
" " + RECONCILE_TAG + " "\
|
||||
"ORDER BY l.id",
|
||||
(partner.id,))
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
for r in res:
|
||||
sum = r['debit'] - r['credit']
|
||||
r['progress'] = sum
|
||||
full_account.append(r)
|
||||
|
||||
return full_account
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
def _sum_debit_partner(self, partner,data):
|
||||
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
if data['form']['reconcil'] :
|
||||
RECONCILE_TAG = " "
|
||||
else:
|
||||
RECONCILE_TAG = "AND reconcile_id IS NULL"
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id = %d " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(partner.id, self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id = %d " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ") " ,
|
||||
(partner.id,))
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
return result_tmp
|
||||
|
||||
def _sum_credit_partner(self, partner,data):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
if data['form']['reconcil'] :
|
||||
RECONCILE_TAG = " "
|
||||
else:
|
||||
RECONCILE_TAG = "AND reconcile_id IS NULL"
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id=%d " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(partner.id,self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id=%d " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ") " ,
|
||||
(partner.id,))
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
return result_tmp
|
||||
|
||||
def _sum_debit(self,data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
if data['form']['reconcil'] :
|
||||
RECONCILE_TAG = " "
|
||||
else:
|
||||
RECONCILE_TAG = "AND reconcile_id IS NULL"
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ") "
|
||||
)
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
return result_tmp
|
||||
|
||||
|
||||
def _sum_credit(self,data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
if data['form']['reconcil'] :
|
||||
RECONCILE_TAG = " "
|
||||
else:
|
||||
RECONCILE_TAG = "AND reconcile_id IS NULL"
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ") "
|
||||
)
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
return result_tmp
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
|
||||
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
|
||||
'addons/account/report/third_party_ledger.rml',parser=third_party_ledger,
|
||||
header=False)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
'addons/account/report/third_party_ledger.rml',parser=third_party_ledger,
|
||||
header=False)
|
||||
|
||||
|
|
|
@ -2,8 +2,41 @@
|
|||
<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"/>
|
||||
<header>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
<!--<stroke color="darkblue"/>-->
|
||||
|
||||
<!--TITLE COMPANY-->
|
||||
<!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
|
||||
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
|
||||
<drawRightString x="20cm" y="28.1cm">Third Party Ledger [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]]</drawRightString>
|
||||
|
||||
<!-- Header -->
|
||||
|
||||
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.0cm" y="1cm"> [[ time.strftime("%Y-%m-%d %H:%M", time.localtime()) ]]</drawString>
|
||||
<drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
|
||||
<!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
|
||||
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1cm 27.7cm 20cm 27.7cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
|
||||
</pageGraphics>
|
||||
</header>
|
||||
</pageTemplate>
|
||||
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
|
@ -13,227 +46,194 @@
|
|||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
||||
<blockTableStyle id="tbl_heading">
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="LEFT"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
|
||||
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockValign value="LEFT"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockValign value="LEFT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,-1"/>
|
||||
|
||||
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<blockValign value="LEFT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Times-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<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="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="2.0" leading="1" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="14.5" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="7.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="7.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Balance" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica-Bold" alignment="CENTER" fontSize="14.5" leftIndent="-5.0"/>
|
||||
<paraStyle name="P9a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9c" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="total" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="date" fontName="Helvetica" fontSize="8.0" leading="9" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P16" fontName="Helvetica" fontSize="8.0" leading="12" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<blockTable colWidths="145.0,187.0,149.0" repeatRows="1" style="Table1">
|
||||
<tr>
|
||||
|
||||
<para style="P2"><font color="white"></font></para>
|
||||
<para>
|
||||
<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">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Third party ledger</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2"><font face="Times-Roman">From</font> [[ formatLang(data['form']['date1'], date=True) ]]</para>
|
||||
<para style="P2"><font face="Times-Roman">to</font> [[ formatLang(data['form']['date2'], date=True) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">[[ get_company(data['form']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">Complete</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7"><font face="Times-Roman">Currency:</font> [[ get_currency(data['form']) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<para style="date">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">JNRL</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Ref.</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Entry label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="337.0,69.0,72.0,63.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Balance">Balance brought forward</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_debit(data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_credit(data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_debit(data) - sum_credit(data)) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P1">
|
||||
<font color="white">[[ data['form']['page_split'] == False or removeParentNode('para') ]] </font>
|
||||
<font color="white">[[ repeatIn(objects, 'p') ]]</font>
|
||||
</para>
|
||||
<blockTable colWidths="200.0,137.0,69.0,72.0,63.0" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="total">[[ p.ref ]] - [[ p.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="total"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_debit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_credit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_debit_partner(p,data) - sum_credit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="45.0,37.0,120.0,135.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>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['debit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['credit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['progress']) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P10"><font face="Times-Roman">Printing date:</font> [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] <font face="Times-Roman">at</font> [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P11">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="45.0,36.0,50.0,145.0,69.0,72.0,64.0" repeatRows="1" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">J. code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Voucher Nb</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Entry label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Progressive balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Text body">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P13">[[ repeatIn(objects, 'p') ]]</para>
|
||||
<para style="P14">[[ p.ref ]] [[ p.name ]]</para>
|
||||
<blockTable colWidths="45.0,37.0,50.0,145.0,69.0,72.0,63.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P15"><font face="Times-Roman">[[ repeatIn(lines(p), 'line') ]]</font>[[ formatLang(line['date'], date=True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ formatLang(line['debit']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ formatLang(line['credit']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ formatLang(line['progress']) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="277.0,69.0,72.0,63.0" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P8">Total for [[ p.ref ]] </para>
|
||||
<para style="P8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_debit_partner(p)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_credit_partner(p)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="Text body">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="277.0,69.0,72.0,63.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P8">Balance brought forward</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_debit()) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang(sum_credit()) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ formatLang((sum_debit() - sum_credit())) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -30,37 +28,117 @@
|
|||
|
||||
import wizard
|
||||
import pooler
|
||||
import time
|
||||
|
||||
report_type = '''<?xml version="1.0"?>
|
||||
<form string="Select Report Type">
|
||||
</form>'''
|
||||
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="fiscalyear" colspan="4"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal year)"/>
|
||||
<field name="periods" colspan="4"/>
|
||||
<field name="state" colspan="4"/>
|
||||
<field name="date_from" colspan="4"/>
|
||||
<field name="date_to" colspan="4"/>
|
||||
<field name="display_account" colspan="4"/>
|
||||
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'display_account':{'string':"Display accounts",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}
|
||||
}
|
||||
|
||||
|
||||
period_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="fiscalyear" colspan="4"/>
|
||||
<field name="periods" colspan="4"/>
|
||||
<field name="display_account" colspan="4"/>
|
||||
|
||||
</form>'''
|
||||
|
||||
|
||||
|
||||
period_fields = {
|
||||
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'help': 'Keep empty for all open fiscal year'},
|
||||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
|
||||
'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
|
||||
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}
|
||||
}
|
||||
|
||||
account_form = '''<?xml version="1.0"?>
|
||||
<form string="Select parent account">
|
||||
<field name="Account_list" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
account_fields = {
|
||||
'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True},
|
||||
}
|
||||
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
periods_obj=pooler.get_pool(cr.dbname).get('account.period')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
data['form']['target_move'] = False
|
||||
data['form']['state']='all'
|
||||
if context.has_key('target_move'):
|
||||
data['form']['target_move'] = context['target_move']
|
||||
data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
data['form']['display_account']='bal_all'
|
||||
return data['form']
|
||||
|
||||
def _get_defaults_fordate(self, cr, uid, data, context):
|
||||
data['form']['display_account']='bal_all'
|
||||
return data['form']
|
||||
|
||||
|
||||
def _check_path(self, cr, uid, data, context):
|
||||
if data['model'] == 'account.account':
|
||||
return 'checktype'
|
||||
else:
|
||||
return 'account_selection'
|
||||
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
sql = """
|
||||
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date_from'])
|
||||
cr.execute(sql)
|
||||
res = cr.dictfetchall()
|
||||
if res:
|
||||
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
|
||||
raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
|
||||
else:
|
||||
return 'report'
|
||||
|
||||
else:
|
||||
raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
|
||||
|
||||
states = {
|
||||
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check_path}
|
||||
},
|
||||
'account_selection': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':account_form,'fields':account_fields, 'state':[('end','Cancel'),('checktype','Print')]}
|
||||
},
|
||||
'checktype': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':report_type,'fields':{}, 'state':[('with_period','Use with Period'),('with_date','Use with Date')]}
|
||||
},
|
||||
'with_period': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||
},
|
||||
'with_date': {
|
||||
'actions': [_get_defaults_fordate],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]}
|
||||
},
|
||||
'checkdate': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check_date}
|
||||
},
|
||||
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.account.balance', 'state':'end'}
|
||||
|
@ -69,6 +147,3 @@ class wizard_report(wizard.interface):
|
|||
wizard_report('account.account.balance.report')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2005-2006 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
|
||||
|
@ -34,78 +32,79 @@ import datetime
|
|||
import pooler
|
||||
|
||||
from mx.DateTime import *
|
||||
from tools.translate import _
|
||||
|
||||
_aged_trial_form = """<?xml version="1.0"?>
|
||||
<form string="Aged Trial Balance">
|
||||
<field name="company_id"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal year)"/>
|
||||
<newline/>
|
||||
<field name="period_length"/>
|
||||
<newline/>
|
||||
<field name="sorting_on"/>
|
||||
<newline/>
|
||||
<field name="computation"/>
|
||||
<newline/>
|
||||
<field name="state"/>
|
||||
<field name="company_id"/>
|
||||
<newline/>
|
||||
<field name="date1"/>
|
||||
<field name="period_length"/>
|
||||
<newline/>
|
||||
<field name="result_selection"/>
|
||||
<newline/>
|
||||
<field name="direction_selection"/>
|
||||
</form>"""
|
||||
|
||||
_aged_trial_fields = {
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'help': 'Keep empty for all open fiscal year'},
|
||||
'period_length': {'string': 'Period length (days)', 'type': 'integer', 'required': True, 'default': lambda *a:30},
|
||||
'sorting_on':{'string': 'Sorting On', 'type': 'selection', 'selection': [('partner','By Partner Name (asc)'), ('amount','By Amount (desc)')],'required': True, 'default': lambda *a:'partner'},
|
||||
'computation':{'string': 'Computational Method', 'type': 'selection', 'selection': [("\'receivable\'",'On Receivables Only'), ("\'payable\'",'On Payables Only'), ("\'receivable\',\'payable\'",'On Receivables & Payables')], 'required': True, 'default': lambda *a:"\'receivable\'"},
|
||||
'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
|
||||
}
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'period_length': {'string': 'Period length (days)', 'type': 'integer', 'required': True, 'default': lambda *a:30},
|
||||
'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'result_selection':{'string':"Display partner",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
|
||||
'direction_selection':{'string':"Display aged balance of",'type':'selection','selection':[('past','Due amount'),('future','Not due amount')]},
|
||||
}
|
||||
|
||||
def _calc_dates(self, cr, uid, data, context):
|
||||
res = {}
|
||||
period_length = data['form']['period_length']
|
||||
if period_length<=0:
|
||||
raise wizard.except_wizard(_('UserError'), _('You must enter a period length that cannot be 0 or below !'))
|
||||
start = now()
|
||||
for i in range(5)[::-1]:
|
||||
stop = start-RelativeDateTime(days=period_length)
|
||||
res[str(i)] = {
|
||||
'name' : str((5-i)*period_length)+' days',
|
||||
'stop': start.strftime('%Y-%m-%d'),
|
||||
'start' : stop.strftime('%Y-%m-%d'),
|
||||
}
|
||||
start = stop - RelativeDateTime(days=1)
|
||||
return res
|
||||
res = {}
|
||||
period_length = data['form']['period_length']
|
||||
if period_length<=0:
|
||||
raise wizard.except_wizard('UserError', 'You must enter a period length that cannot be 0 or below !')
|
||||
start = datetime.date.fromtimestamp(time.mktime(time.strptime(data['form']['date1'],"%Y-%m-%d")))
|
||||
start = DateTime(int(start.year),int(start.month),int(start.day))
|
||||
if data['form']['direction_selection'] == 'past':
|
||||
for i in range(5)[::-1]:
|
||||
stop = start - RelativeDateTime(days=period_length)
|
||||
res[str(i)] = {
|
||||
'name' : str((5-(i+1))*period_length) + '-' + str((5-i)*period_length),
|
||||
|
||||
'stop': start.strftime('%Y-%m-%d'),
|
||||
'start' : stop.strftime('%Y-%m-%d'),
|
||||
}
|
||||
start = stop - RelativeDateTime(days=1)
|
||||
else:
|
||||
for i in range(5):
|
||||
stop = start + RelativeDateTime(days=period_length)
|
||||
res[str(5-(i+1))] = {
|
||||
'name' : str((i)*period_length)+'-'+str((i+1)*period_length),
|
||||
'start': start.strftime('%Y-%m-%d'),
|
||||
'stop' : stop.strftime('%Y-%m-%d'),
|
||||
}
|
||||
start = stop + RelativeDateTime(days=1)
|
||||
return res
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
data['form']['company_id'] = company_id
|
||||
data['form']['state']='all'
|
||||
return data['form']
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
data['form']['company_id'] = company_id
|
||||
|
||||
return data['form']
|
||||
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':_aged_trial_form, 'fields':_aged_trial_fields, 'state':[('end','Cancel'),('print','Print Aged Partner Balance')]},
|
||||
},
|
||||
'print': {
|
||||
'actions': [_calc_dates],
|
||||
'result': {'type':'print', 'report':'account.aged.trial.balance', 'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':_aged_trial_form, 'fields':_aged_trial_fields, 'state':[('end','Cancel'),('print','Print Aged Trial Balance')]},
|
||||
},
|
||||
'print': {
|
||||
'actions': [_calc_dates],
|
||||
'result': {'type':'print', 'report':'account.aged_trial_balance', 'state':'end'},
|
||||
},
|
||||
}
|
||||
wizard_report('account.aged.trial.balance')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# 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
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
|
@ -30,33 +26,144 @@
|
|||
|
||||
import wizard
|
||||
import pooler
|
||||
import locale
|
||||
import time
|
||||
|
||||
report_type = '''<?xml version="1.0"?>
|
||||
<form string="Select Report Type">
|
||||
</form>'''
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="fiscalyear" colspan="4"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal year)"/>
|
||||
<field name="periods" colspan="4"/>
|
||||
<field name="state" colspan="4"/>
|
||||
<form string="Select period ">
|
||||
<field name="date_from" colspan="4"/>
|
||||
<field name="date_to" colspan="4"/>
|
||||
<field name="sortbydate" colspan="4"/>
|
||||
<field name="display_account" colspan="4"/>
|
||||
<field name="landscape" colspan="4"/>
|
||||
<field name="soldeinit"/>
|
||||
<field name="amount_currency" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'sortbydate':{'string':"Sort by",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Mouvement')]},
|
||||
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
|
||||
'landscape':{'string':"Print in Landscape Mode",'type':'boolean'},
|
||||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'amount_currency':{'string':"with amount in currency",'type':'boolean'}
|
||||
|
||||
}
|
||||
|
||||
account_form = '''<?xml version="1.0"?>
|
||||
<form string="Select parent account">
|
||||
<field name="Account_list" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
account_fields = {
|
||||
'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
period_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period ">
|
||||
<field name="fiscalyear" colspan="4"/>
|
||||
<field name="periods" colspan="4"/>
|
||||
<field name="sortbydate" colspan="4"/>
|
||||
<field name="display_account" colspan="4"/>
|
||||
<field name="landscape" colspan="4"/>
|
||||
<field name="soldeinit"/>
|
||||
<field name="amount_currency" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
period_fields = {
|
||||
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'help': 'Keep empty for all open fiscal year'},
|
||||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
|
||||
'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
|
||||
'sortbydate':{'string':"Sort by:",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Mouvement')]},
|
||||
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
|
||||
'landscape':{'string':"Print in Landscape Mode",'type':'boolean'},
|
||||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'amount_currency':{'string':"with amount in currency",'type':'boolean'}
|
||||
}
|
||||
def _check_path(self, cr, uid, data, context):
|
||||
if data['model'] == 'account.account':
|
||||
return 'checktype'
|
||||
else:
|
||||
return 'account_selection'
|
||||
|
||||
def _check(self, cr, uid, data, context):
|
||||
if data['form']['landscape']==True:
|
||||
return 'report_landscape'
|
||||
else:
|
||||
return 'report'
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
sql = """
|
||||
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date_from'])
|
||||
cr.execute(sql)
|
||||
res = cr.dictfetchall()
|
||||
if res:
|
||||
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
|
||||
raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
|
||||
else:
|
||||
return 'checkreport'
|
||||
|
||||
else:
|
||||
raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
|
||||
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
data['form']['state']='all'
|
||||
data['form']['sortbydate'] = 'sort_date'
|
||||
data['form']['display_account']='bal_all'
|
||||
data['form']['landscape']=True
|
||||
data['form']['amount_currency'] = True
|
||||
return data['form']
|
||||
def _get_defaults_fordate(self, cr, uid, data, context):
|
||||
data['form']['sortbydate'] = 'sort_date'
|
||||
data['form']['display_account']='bal_all'
|
||||
data['form']['landscape']=True
|
||||
data['form']['amount_currency'] = True
|
||||
return data['form']
|
||||
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check_path}
|
||||
},
|
||||
'account_selection': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':account_form,'fields':account_fields, 'state':[('end','Cancel'),('checktype','Print')]}
|
||||
},
|
||||
'checktype': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':report_type,'fields':{}, 'state':[('with_period','Use with Period'),('with_date','Use with Date')]}
|
||||
},
|
||||
'with_period': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('checkreport','Print')]}
|
||||
},
|
||||
'with_date': {
|
||||
'actions': [_get_defaults_fordate],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]}
|
||||
},
|
||||
'checkdate': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check_date}
|
||||
},
|
||||
'checkreport': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check}
|
||||
},
|
||||
'report_landscape': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.general.ledger_landscape', 'state':'end'}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
|
@ -64,7 +171,3 @@ class wizard_report(wizard.interface):
|
|||
}
|
||||
}
|
||||
wizard_report('account.general.ledger.report')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -32,54 +29,133 @@ import time
|
|||
import wizard
|
||||
import pooler
|
||||
|
||||
|
||||
report_type = '''<?xml version="1.0"?>
|
||||
<form string="Select Report Type">
|
||||
</form>'''
|
||||
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="company_id" colspan="4"/>
|
||||
<field name="fiscalyear" colspan="4"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal year)"/>
|
||||
<newline/>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<newline/>
|
||||
<field name="state" colspan="4"/>
|
||||
<field name="company_id" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<newline/>
|
||||
<field name="result_selection"/>
|
||||
<field name="soldeinit"/>
|
||||
<field name="reconcil"/>
|
||||
<newline/>
|
||||
<field name="page_split"/>
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'help': 'Keep empty for all open fiscal year'},
|
||||
'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'date1': {'string':'Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'result_selection':{'string':"Display partners",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
|
||||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'reconcil':{'string':"Inclure les ecritures reconsiliees",'type':'boolean'},
|
||||
'page_split':{'string':"Un partenaire par page",'type':'boolean'},
|
||||
}
|
||||
|
||||
period_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="company_id" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear" colspan="4"/>
|
||||
<field name="periods" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="result_selection"/>
|
||||
<field name="soldeinit"/>
|
||||
<field name="reconcil"/>
|
||||
<newline/>
|
||||
<field name="page_split"/>
|
||||
</form>'''
|
||||
|
||||
period_fields = {
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'help': 'Keep empty for all open fiscal year'},
|
||||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
|
||||
'result_selection':{'string':"Display partners",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
|
||||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'reconcil':{'string':"Inclure les ecritures reconsiliees",'type':'boolean'},
|
||||
'page_split':{'string':"Un partenaire par page",'type':'boolean'},
|
||||
}
|
||||
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
data['form']['company_id'] = company_id
|
||||
data['form']['state']='all'
|
||||
return data['form']
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
data['form']['display_account']='bal_all'
|
||||
|
||||
data['form']['result_selection'] = 'all'
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
data['form']['company_id'] = company_id
|
||||
data['form']['page_split'] = False
|
||||
data['form']['reconcil'] = False
|
||||
data['form']['soldeinit'] = True
|
||||
return data['form']
|
||||
|
||||
def _get_defaults_fordate(self, cr, uid, data, context):
|
||||
data['form']['result_selection'] = 'all'
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
data['form']['company_id'] = company_id
|
||||
data['form']['page_split'] = False
|
||||
data['form']['reconcil'] = False
|
||||
data['form']['soldeinit'] = True
|
||||
return data['form']
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print') ]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
sql = """
|
||||
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date1'])
|
||||
cr.execute(sql)
|
||||
res = cr.dictfetchall()
|
||||
if res:
|
||||
if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
|
||||
raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
|
||||
else:
|
||||
return 'report'
|
||||
|
||||
else:
|
||||
raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
|
||||
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':report_type,'fields':{}, 'state':[('with_period','Use with Period'),('with_date','Use with Date')]}
|
||||
},
|
||||
'with_period': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||
},
|
||||
'with_date': {
|
||||
'actions': [_get_defaults_fordate],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]}
|
||||
},
|
||||
'checkdate': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check_date}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('account.third_party_ledger.report')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
</initialize>
|
||||
<paraStyle name="P1" rightIndent="0.0" leftIndent="12.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" rightIndent="0.0" leftIndent="15.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P3" rightIndent="0.0" leftIndent="15.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P3" rightIndent="0.0" leftIndent="12.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
|
@ -141,32 +141,32 @@
|
|||
<td>
|
||||
<para style="terp_default_9">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
|
||||
<para style="terp_default_Bold_9">Shipping address :</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]][[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ addr.title or '' ]][[ addr.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ addr.title or '' ]] [[ addr.name ]]</para>
|
||||
<para style="terp_default_9">[[ addr.street ]]</para>
|
||||
<para style="terp_default_9">[[ addr.street2 or '' ]]</para>
|
||||
<para style="terp_default_9"><font face="Times-Roman">[[ addr.zip or '' ]]</font>[[ addr.city or '' ]]</para>
|
||||
<para style="terp_default_9">[[ addr.state_id and addr.state_id.name or '' ]]</para>
|
||||
<para style="terp_default_9"><font face="Times-Roman">[[ addr.zip or '' ]]</font> [[ addr.city or '' ]]</para>
|
||||
<para style="terp_default_9">[[ addr.state_id and addr.state_id.name or '' ]]</para>
|
||||
<para style="terp_default_9">[[ addr.country_id and addr.country_id.name or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]][[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.title or '' ]][[ o.partner_address_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.street ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.street2 or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.zip or '' ]][[ o.partner_address_id.city or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]]</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">Tél. : [[ o.partner_address_id.phone or '' ]]</para>
|
||||
<para style="terp_default_9">Fax : [[ o.partner_address_id.fax or '' ]]</para>
|
||||
<para style="terp_default_9">TVA :[[ o.partner_id.vat or '' ]]</para>
|
||||
<para style="terp_default_9">TVA :[[ o.partner_id.vat or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_header">Request for Quotation [[ (o.state=='draft' or removeParentNode('font')) and '' ]] Order [[ (o.state<>'draft' or removeParentNode('font')) and '' ]] N° [[ o.name ]]</para>
|
||||
<para style="terp_header">Request for Quotation [[ (o.state=='draft' or removeParentNode('font')) and '' ]] Order [[ (o.state<>'draft' or removeParentNode('font')) and '' ]] N° :[[ o.name ]]</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
@ -195,20 +195,20 @@
|
|||
<para style="terp_default_Centre_9">[[ o.name or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ o.partner_ref or '' ]]</para>
|
||||
<para style="terp_default_Centre_9">[[ o.partner_ref or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ o.validator and o.validator.name or '' ]]</para>
|
||||
<para style="terp_default_Centre_9">[[ o.validator and o.validator.name or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="232.0,44.0,60.0,69.0,58.0,70.0" repeatRows="1" style="Table_Header_Pur_ord_Line">
|
||||
<blockTable colWidths="253.0,52.0,57.0,44.0,58.0,70.0" repeatRows="1" style="Table_Header_Pur_ord_Line">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description</para>
|
||||
|
@ -232,7 +232,7 @@
|
|||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(o.order_line,'line') ]]</para>
|
||||
<blockTable colWidths="231.0,46.0,59.0,51.0,20.0,57.0,70.0" style="Table_Order_Pur_line_Content">
|
||||
<blockTable colWidths="254.0,52.0,57.0,24.0,20.0,57.0,71.0" style="Table_Order_Pur_line_Content">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ line.name ]]</para>
|
||||
|
@ -244,7 +244,7 @@
|
|||
<para style="terp_default_Centre_9">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ line.product_qty ]]</para>
|
||||
<para style="terp_default_Right_9">[[ line.product_qty ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ line.product_uom.name ]]</para>
|
||||
|
@ -258,8 +258,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_2">[[ repeatIn((line.notes and line.notes.splitlines()) or [], 'l') ]]</para>
|
||||
<para style="P3">[[ l or removeParentNode('table') ]]</para>
|
||||
<para style="P3">[[ line.notes or removeParentNode('tr') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">
|
||||
|
@ -308,7 +307,7 @@
|
|||
<para style="terp_default_Right_9">[[ o.amount_untaxed ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ o.pricelist_id.currency_id.name ]]</para>
|
||||
<para style="terp_default_Right_9">[[ o.pricelist_id.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -324,7 +323,7 @@
|
|||
<para style="terp_default_Right_9">[[ o.amount_tax ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ o.pricelist_id.currency_id.name ]]</para>
|
||||
<para style="terp_default_Right_9">[[ o.pricelist_id.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -29,14 +29,11 @@
|
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" rightIndent="0.0" leftIndent="12.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P1" rightIndent="0.0" leftIndent="11.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
|
@ -68,6 +65,8 @@
|
|||
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_8_italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Space bet user and signature" fontName="Helvetica" fontSize="4.0" leading="5" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
|
@ -76,6 +75,13 @@
|
|||
<blockTable colWidths="250.0,59.0,221.0" style="Table_Address_Detail">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Expected Delivery address:</para>
|
||||
<para style="terp_default_9">[[( order.warehouse_id and order.warehouse_id.name) or order.partner_address_id.partner_id.name]]</para>
|
||||
<para style="terp_default_9">[[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.title) or ' ']] [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.name) or order.partner_address_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.street) or order.partner_address_id.street ]]</para>
|
||||
<para style="terp_default_9">[[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.street2) or order.partner_address_id.street2 ]]</para>
|
||||
<para style="terp_default_9">[[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.zip) or order.partner_address_id.zip ]] [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.city) or order.partner_address_id.city ]]</para>
|
||||
<para style="terp_default_9">[[(order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.state_id and order.warehouse_id.partner_address_id.state_id.name) or order.partner_address_id.state_id.name ]] [[(order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.country_id and order.warehouse_id.partner_address_id.country_id.name) or order.partner_address_id.country_id.name ]]</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
@ -100,30 +106,20 @@
|
|||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_header">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_header">Request for quotation : [[order.name]]</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_header">Request for Quotation : [[order.name]]</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">Please find hereby a request for quotation.</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="391.0,66.0,73.0" repeatRows="1" style="Table_Product_Header_Title">
|
||||
<blockTable colWidths="387.0,83.0,61.0" repeatRows="1" style="Table_Product_Header_Title">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Date</para>
|
||||
<para style="terp_tblheader_Details_Centre">Expected Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Qty</para>
|
||||
|
@ -132,13 +128,13 @@
|
|||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_9">[[ repeatIn(order.order_line,'order_line') ]]</para>
|
||||
<blockTable colWidths="402.0,67.0,38.0,23.0" style="Table_Product_Line">
|
||||
<blockTable colWidths="388.0,83.0,39.0,20.0" style="Table_Product_Line">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ order_line.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ time.strftime('%d/%m/%Y', time.strptime( order_line.date_planned, '%Y-%m-%d')) ]]</para>
|
||||
<para style="terp_default_Centre_9">[[ time.strftime('%d/%m/%Y', time.strptime( order_line.date_planned, '%Y-%m-%d')) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ order_line.product_qty or '' ]]</para>
|
||||
|
@ -149,23 +145,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_2">[[ repeatIn((order_line.notes and order_line.notes.splitlines()) or [], 'l') ]]</para>
|
||||
<para style="P1">[[ l or removeParentNode('table') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P1">[[ format(order_line.notes or removeParentNode('tr')) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
@ -173,14 +153,18 @@
|
|||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">[[ order.notes or '' ]]</para>
|
||||
<para style="terp_default_9">[[ format(order.notes or '') ]]</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">Thanks,</para>
|
||||
<para style="terp_default_9">Regards,</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">[[ user.name or '' ]]</para>
|
||||
<para style="Space bet user and signature">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">[[ user.signature or '' ]]</para>
|
||||
</story>
|
||||
</document>
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<paraStyle name="P4" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P5" rightIndent="0.0" leftIndent="11.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P6" rightIndent="0.0" leftIndent="-2.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P7" rightIndent="0.0" leftIndent="13.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P7" rightIndent="0.0" leftIndent="11.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
|
@ -130,6 +130,7 @@
|
|||
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Preformatted Text" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
|
@ -168,15 +169,18 @@
|
|||
</para>
|
||||
<para style="terp_default_9">Tel. : [[ o.partner_order_id.phone or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_9">Fax : [[ o.partner_order_id.fax or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_9">VAT :[[ o.partner_id.vat or removeParentNode('para') ]] </para>
|
||||
<para style="terp_default_9">TVA : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_header">[[ o.state<>'draft' and removeParentNode('para') ]] Quotation N° : [[ o.name ]]</para>
|
||||
<para style="terp_header">[[ o.state=='draft' and removeParentNode('para') ]] Order N° : [[ o.name ]]</para>
|
||||
<para style="terp_header">[[ o.state<>'draft' and removeParentNode('para') ]] Quotation N° [[ o.name ]]</para>
|
||||
<para style="terp_header">[[ o.state=='draft' and removeParentNode('para') ]] Order N° [[ o.name ]]</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
@ -265,8 +269,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_1">[[ repeatIn((line.notes and line.notes.splitlines()) or [], 'l') ]] </para>
|
||||
<para style="P7">[[ l or removeParentNode('table') ]]</para>
|
||||
<para style="P7">[[ format(line.notes or removeParentNode('tr')) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">
|
||||
|
@ -312,7 +315,7 @@
|
|||
<para style="P6">Net Total :</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">0.00</para>
|
||||
<para style="terp_default_Right_9">[[ o.amount_untaxed ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ o.pricelist_id.currency_id.name ]]</para>
|
||||
|
@ -328,7 +331,7 @@
|
|||
<para style="P5">Taxes :</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">0.00</para>
|
||||
<para style="terp_default_Right_9">[[ o.amount_tax ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ o.pricelist_id.currency_id.name ]]</para>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="30.0" y1="57.0" width="508" height="728"/>
|
||||
<frame id="first" x1="30.0" y1="27.0" width="508" height="815"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
|
@ -14,7 +14,7 @@
|
|||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau2">
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
|
||||
|
@ -27,11 +27,14 @@
|
|||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
|
||||
|
@ -44,31 +47,52 @@
|
|||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau4">
|
||||
<blockTableStyle id="Table3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#666666" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#666666" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#666666" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#666666" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#666666" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#666666" start="5,-1" stop="5,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,1" stop="0,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" rightIndent="0.0" leftIndent="-5.0" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="7.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" rightIndent="0.0" leftIndent="-28.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P3" rightIndent="0.0" leftIndent="15.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
|
@ -99,6 +123,7 @@
|
|||
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
|
@ -118,7 +143,6 @@
|
|||
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.country_id and o.sale_id.partner_invoice_id.country_id.name or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Shipped to</para>
|
||||
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.name or '']]</para>
|
||||
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.street or '']]</para>
|
||||
<para style="terp_default_9">[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.zip or '']]</para>
|
||||
|
@ -127,17 +151,11 @@
|
|||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_9">
|
||||
<para style="P1">Delivery Order : [[ o.name ]]</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P1">Delivery order [[ o.sale_id and o.sale_id.name ]]</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="155.0,127.0,127.0,127.0" style="Tableau2">
|
||||
<blockTable colWidths="126.0,103.0,103.0,103.0,103.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Order Ref.</para>
|
||||
|
@ -151,9 +169,12 @@
|
|||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Carrier</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Weight</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="155.0,127.0,127.0,127.0" style="Tableau3">
|
||||
<blockTable colWidths="126.0,103.0,103.0,103.0,103.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ o.sale_id and o.sale_id.name ]]</para>
|
||||
|
@ -167,12 +188,15 @@
|
|||
<td>
|
||||
<para style="terp_default_Centre_8">[[ o.carrier_id and o.carrier_id.name or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ o.weight ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_9">
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="78.0,345.0,91.0,24.0" repeatRows="1" style="Tableau4">
|
||||
<blockTable colWidths="67.0,212.0,71.0,65.0,59.0,63.0" repeatRows="1" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Reference</para>
|
||||
|
@ -180,17 +204,26 @@
|
|||
<td>
|
||||
<para style="terp_tblheader_Details">Designation</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Lot</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">S.U.</para>
|
||||
<para style="terp_tblheader_Details_Right">Unit Price</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_1">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P2">[[ repeatIn(o.move_lines, 'line') ]]</para>
|
||||
<blockTable colWidths="78.0,345.0,90.0,23.0" style="Table1">
|
||||
<para style="P2">[[ repeatIn(o.move_lines,'line') ]]</para>
|
||||
<blockTable colWidths="66.0,213.0,70.0,46.0,21.0,58.0,63.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[line.product_id.code ]]</para>
|
||||
|
@ -199,10 +232,19 @@
|
|||
<para style="terp_default_9">[[ line.product_id and line.product_id.name or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ line.product_qty ]]</para>
|
||||
<para style="terp_default_9">[[ (line.prodlot_id and line.prodlot_id.name) or ' ' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ line.product_uom and line.product_uom.name ]]</para>
|
||||
<para style="terp_default_Right_9">[[ line.product_qty ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ line.product_uom and line.product_uom.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ line.sale_line_id.price_unit ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ line.sale_line_id.price_subtotal ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
@ -210,5 +252,36 @@
|
|||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<blockTable colWidths="416.0,55.0,66.0" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">Net Total :</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ o.sale_id.amount_untaxed ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Total :</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold">[[ o.sale_id.amount_total ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockTableStyle id="Table_Address_detail">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_Title_String">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
|
@ -27,12 +31,9 @@
|
|||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Content_Order_Reference_Table">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
@ -47,12 +48,9 @@
|
|||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Move_Line_Header">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
@ -76,17 +74,14 @@
|
|||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" fontName="Courier" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="14.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.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-Italic" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
|
@ -103,93 +98,96 @@
|
|||
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Preformatted Text" fontName="Courier" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_5cm_Above_Space" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="14.0" spaceAfter="0.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<para style="Standard">[[ repeatIn(objects,'picking') ]]</para>
|
||||
<para style="terp_default_8">[[ repeatIn(objects,'picking') ]]</para>
|
||||
<para style="terp_default_8">[[ setLang((picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.lang)) ]]</para>
|
||||
<para style="terp_header_Centre"/>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="269.0,269.0" style="Tableau3">
|
||||
<blockTable colWidths="269.0,269.0" style="Table_Address_detail">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Shipping Address:</para>
|
||||
<para style="terp_default_9">[[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] </para>
|
||||
<para style="terp_default_9">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.street) or '' ]] </para>
|
||||
<para style="terp_default_8">[[ (picking.sale_id and picking.sale_id_id.partner_shipping_id and picking.sale_id.partner_shipping_id.zip) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.city) or '' ]] [[ (picking.address_id and picking.address_id.state_id and picking.address_id.state_id.name) or '' ]] </para>
|
||||
<para style="terp_default_8">[[ (picking.address_id and picking.address_id.country_id and picking.address_id.country_id.name) or '' ]]</para>
|
||||
<para style="terp_default_9">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.zip) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.city) or '' ]] [[ (picking.address_id and picking.address_id.state_id and picking.address_id.state_id.name) or '' ]] </para>
|
||||
<para style="terp_default_9">[[ (picking.address_id and picking.address_id.country_id and picking.address_id.country_id.name) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_Bold_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_header">Packing List</para>
|
||||
<para style="terp_default_Bold_8">
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="110.0,106.0,107.0,107.0,107.0" style="Header_Order_Reference_Tbl">
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="538.0" style="Table_Title_String">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Customer Ref.</para>
|
||||
<para style="terp_header">Packing List: [[ picking.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_5cm_Above_Space">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="123.0,134.0,133.0,134.0" style="Header_Order_Reference_Tbl">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Order(Origin)</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Recipient</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Concerns</para>
|
||||
<para style="terp_tblheader_General_Centre">Expected Shipping Date </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Packing Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Shipping Date</para>
|
||||
<para style="terp_tblheader_General_Centre">weight</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="110.0,106.0,107.0,107.0,107.0" style="Content_Order_Reference_Table">
|
||||
<blockTable colWidths="123.0,134.0,133.0,134.0" style="Content_Order_Reference_Table">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.id) or '' ]]</para>
|
||||
<para style="terp_default_Centre_8">[[ picking.origin ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] </para>
|
||||
<para style="terp_default_Centre_8">[[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ picking.name ]]</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_Centre_8">[[ picking.date ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[time.strftime('%d/%m/%Y', time.strptime(picking.min_date, '%Y-%m-%d')) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[time.strftime('%d/%m/%Y %H:%M:%S ', time.strptime(picking.date, '%Y-%m-%d %H:%M:%S')) ]]</para>
|
||||
<para style="terp_default_Centre_8">[[ picking.weight or '']] </para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<para style="terp_default_5cm_Above_Space">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="43.0,296.0,53.0,59.0,77.0" repeatRows="1" style="Move_Line_Header">
|
||||
<blockTable colWidths="58.0,268.0,50.0,82.0,56.0" repeatRows="1" style="Move_Line_Header">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Product</para>
|
||||
|
@ -198,19 +196,19 @@
|
|||
<para style="terp_tblheader_Details">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Tracking</para>
|
||||
<para style="terp_tblheader_Details_Centre">Lot</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Qty</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Location</para>
|
||||
<para style="terp_tblheader_Details_Right">Location</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="P1">[[ repeatIn(picking.move_lines,'move_lines') ]]</para>
|
||||
<blockTable colWidths="43.0,296.0,54.0,38.0,22.0,75.0" style="Move_Line_Contect">
|
||||
<para style="terp_default_8">[[ repeatIn(picking.move_lines,'move_lines') ]]</para>
|
||||
<blockTable colWidths="59.0,268.0,56.0,51.0,25.0,54.0" style="Move_Line_Contect">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ move_lines.product_id.default_code ]]</para>
|
||||
|
@ -219,7 +217,7 @@
|
|||
<para style="terp_default_9">[[ move_lines.product_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ (move_lines.tracking_id and move_lines.tracking_id.name) or '']]</para>
|
||||
<para style="terp_default_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ move_lines.product_qty ]] </para>
|
||||
|
@ -228,7 +226,7 @@
|
|||
<para style="terp_default_Right_9">[[ move_lines.product_uom.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]]</para>
|
||||
<para style="terp_default_Right_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
|
Loading…
Reference in New Issue