general_ledger_landscape formatted...
bzr revid: patelamit2003@gmail.com-20080925083316-bqvigppkomq7g08v
This commit is contained in:
parent
73df42e6ce
commit
2f83b150ae
|
@ -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,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] + ': '+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:
|
||||
|
||||
|
|
|
@ -2,10 +2,36 @@
|
|||
<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"/>
|
||||
<frame id="first" x1="57.0" y1="57.0" width="481" height="700"/>
|
||||
<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.2cm" y="28.1cm">Extrait de compte</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>
|
||||
<!--<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>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
|
@ -20,17 +46,28 @@
|
|||
<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_header">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table7">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
||||
<blockTableStyle id="tbl_content">
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table8">
|
||||
|
||||
<blockTableStyle id="Tableau3">
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" />
|
||||
<lineStyle kind="OUTLINE" colorName="#e6e6e6" />
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
|
@ -38,201 +75,274 @@
|
|||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Theader">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="OUTLINE" colorName="#e6e6e6"/>
|
||||
<blockBackground colorName="white" start="0,0" stop="-1,0"/>
|
||||
</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.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" 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.0" 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"/>
|
||||
<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>
|
||||
<blockTable colWidths="45.0,155.0,124.0,40.0,30.0,59.0,52.0,54.0" style="tbl_header">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3">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>
|
||||
</blockTable>
|
||||
<blockTable colWidths="45.0,80.0,40.0,30.0,100.0,59.0,52.0,54.0,81.0" style="tbl_header" >[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3">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 amount</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
[[ repeatIn(objects, 'a') ]]
|
||||
<section>
|
||||
[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
|
||||
|
||||
<blockTable colWidths="45.0,155.0,124.0,40.0,30.0,59.0,52.0,54.0" style="tbl_content">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="394.0,52.5,52.5,52.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
|
||||
<td alignment="right">
|
||||
<para style="P9b">[[ comma_me(sum_debit_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
<td alignment="right">
|
||||
<para style="P9b">[[comma_me(sum_credit_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b">[[comma_me(sum_solde_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
[[ data['form']['soldeinit'] == True or removeParentNode('tr') ]]
|
||||
<td>
|
||||
<para style="P16"></para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P3">Solde 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.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ o.init_credit or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ (o.init_debit - o.init_credit) or '0.00' ]]</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td>
|
||||
<para style="P16"><font face="Times-Roman"></font>[[ 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 comma_me(line['debit']) or '0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['credit'] and comma_me(line['credit']) or '0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['progress'] and comma_me(line['progress']) or '0' ]]</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
|
||||
|
||||
<blockTable colWidths="45.0,80.0,40.0,30.0,100.0,59.0,52.0,54.0,81.0" style="tbl_content" >[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="295.0,52.5,52.5,53.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
|
||||
<td alignment="right">
|
||||
<para style="P9b">[[ comma_me(sum_debit_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
<td alignment="right">
|
||||
<para style="P9b">[[comma_me(sum_credit_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b">[[comma_me(sum_solde_account(o, data['form'])) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>[[ data['form']['soldeinit'] == True or removeParentNode('tr') ]]
|
||||
<td>
|
||||
<para style="P16"></para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P3">Solde 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.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ o.init_credit or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ (o.init_debit - o.init_credit) or '0.00' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4"> </para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td>
|
||||
<para style="P16"><font face="Times-Roman"></font>[[ 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 comma_me(line['debit']) or '0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['credit'] and comma_me(line['credit']) or '0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['progress'] and comma_me(line['progress']) or '0' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ comma_me(line['amount_currency']) or '0' ]] [[ line['currency_code'] ]]</para>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
</section>
|
||||
</section>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
Loading…
Reference in New Issue