General Ledger Wizard Completed....
bzr revid: patelamit2003@gmail.com-20081022064032-yg1jzjhouocvzxbl
This commit is contained in:
parent
1cfd596d72
commit
de62c0dec3
|
@ -40,7 +40,11 @@ class general_ledger(rml_parse.rml_parse):
|
|||
|
||||
def preprocess(self, objects, data, ids):
|
||||
##
|
||||
|
||||
|
||||
self.borne_date = self.get_min_date(data['form'])
|
||||
|
||||
|
||||
##
|
||||
new_ids = []
|
||||
if (data['model'] == 'account.account'):
|
||||
|
@ -54,6 +58,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(general_ledger, self).__init__(cr, uid, name, context)
|
||||
self.date_borne = {}
|
||||
self.query = ""
|
||||
self.child_ids = ""
|
||||
self.tot_currency = 0.0
|
||||
|
@ -109,6 +114,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
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 = []
|
||||
|
@ -116,16 +122,17 @@ class general_ledger(rml_parse.rml_parse):
|
|||
## We will make the test for period or date
|
||||
## We will now make the test
|
||||
#
|
||||
if form.has_key('fiscalyear'):
|
||||
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)
|
||||
|
@ -153,69 +160,111 @@ class general_ledger(rml_parse.rml_parse):
|
|||
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
|
||||
|
||||
|
||||
## 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
|
||||
sql = """ select min(fy.date_start) as start_date,max(fy.date_stop) as stop_date 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'):
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
if form['state'] == 'byperiod':
|
||||
## 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']) + """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date 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 + """)
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date 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 = {
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
elif form['state'] == 'bydate':
|
||||
borne_min = form['date_from']
|
||||
borne_max = form['date_to']
|
||||
elif form['state'] == 'all':
|
||||
periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date 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) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """)
|
||||
"""
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
period_min = res[0]['start_date']
|
||||
period_max = res[0]['stop_date']
|
||||
date_min = form['date_from']
|
||||
date_max = form['date_to']
|
||||
if period_min<date_min:
|
||||
borne_min = period_min
|
||||
else :
|
||||
borne_min = date_min
|
||||
if date_max<period_max:
|
||||
borne_max = period_max
|
||||
else :
|
||||
borne_max = date_max
|
||||
elif form['state'] == 'none':
|
||||
sql = """
|
||||
SELECT min(date) as start_date,max(date) as stop_date FROM account_move_line """
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
self.date_borne = {
|
||||
'min_date': borne_min,
|
||||
'max_date': borne_max,
|
||||
}
|
||||
return date_borne
|
||||
return self.date_borne
|
||||
|
||||
|
||||
|
||||
def lines(self, account, form):
|
||||
|
||||
inv_types = {
|
||||
'out_invoice': 'CI: ',
|
||||
'in_invoice': 'SI: ',
|
||||
|
@ -223,18 +272,27 @@ class general_ledger(rml_parse.rml_parse):
|
|||
'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)
|
||||
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 as 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
|
||||
WHERE l.date<='%s'
|
||||
AND l.date>='%s'
|
||||
ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag)
|
||||
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
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:
|
||||
|
|
|
@ -35,16 +35,15 @@
|
|||
|
||||
<blockTableStyle id="tbl_header">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
|
||||
<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>
|
||||
|
||||
|
||||
|
@ -91,244 +90,86 @@
|
|||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
|
||||
<blockTable colWidths="54.0,135.0,70.0,40.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>
|
||||
<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>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<tr>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<td>
|
||||
<blockTable colWidths="48.0,135.0,70.0,40.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>
|
||||
<blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '']] [[ o.name or '']]</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>[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ line['partner'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['ref'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['move'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['name'] or '' ]]</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>
|
||||
|
||||
<blockTable colWidths="59.0,105.0,66.0,40.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>
|
||||
<blockTable colWidths="59.0,105.0,66.0,40.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>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<td>
|
||||
<blockTable colWidths="54.0,105.0,66.0,40.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,40.00" 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>
|
||||
<td>
|
||||
|
||||
<para style="P9b"><u> [[ sum_currency_amount_account(a, 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>
|
||||
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="264.00,100.0,50.0,50.0,49.0,40.00" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '' ]] [[ o.name or '' ]]</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>
|
||||
<td><para style="P9b"><u> [[ sum_currency_amount_account(a, data['form']) or '0.0' ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</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>[[ repeatIn(lines(o, data['form']), 'line') ]]
|
||||
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ line['partner'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ line['ref'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['move'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ line['name'] or '' ]]</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'] or '']]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</blockTable>
|
||||
|
||||
</story>
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
|||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(general_ledger_landscape, self).__init__(cr, uid, name, context)
|
||||
self.date_borne = {}
|
||||
self.query = ""
|
||||
self.child_ids = ""
|
||||
self.tot_currency = 0.0
|
||||
|
@ -106,38 +107,73 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
|||
return result
|
||||
|
||||
def get_min_date(self,form):
|
||||
|
||||
## Get max born from account_fiscal year
|
||||
#
|
||||
sql = """ select min(fy.date_start) from account_fiscalyear
|
||||
sql = """ select min(fy.date_start) as start_date,max(fy.date_stop) as stop_date 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'):
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
if form['state'] == 'byperiod':
|
||||
## 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']) + """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
"""
|
||||
else:
|
||||
else:
|
||||
periods_id = ','.join(map(str, periods))
|
||||
sql = """
|
||||
Select min(p.date_start) from account_period as p where p.id in ( """ + periods_id + """)
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date 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 = {
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
elif form['state'] == 'bydate':
|
||||
borne_min = form['date_from']
|
||||
borne_max = form['date_to']
|
||||
elif form['state'] == 'all':
|
||||
periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date 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) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """)
|
||||
"""
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
period_min = res[0]['start_date']
|
||||
period_max = res[0]['stop_date']
|
||||
date_min = form['date_from']
|
||||
date_max = form['date_to']
|
||||
if period_min<date_min:
|
||||
borne_min = period_min
|
||||
else :
|
||||
borne_min = date_min
|
||||
if date_max<period_max:
|
||||
borne_max = period_max
|
||||
else :
|
||||
borne_max = date_max
|
||||
elif form['state'] == 'none':
|
||||
sql = """
|
||||
SELECT min(date) as start_date,max(date) as stop_date FROM account_move_line """
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
self.date_borne = {
|
||||
'min_date': borne_min,
|
||||
'max_date': borne_max,
|
||||
}
|
||||
return date_borne
|
||||
return self.date_borne
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -226,12 +262,19 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
|||
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)
|
||||
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 as 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
|
||||
WHERE l.date<='%s'
|
||||
AND l.date>='%s'
|
||||
ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag)
|
||||
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
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:
|
||||
|
|
|
@ -37,9 +37,8 @@
|
|||
|
||||
<blockTableStyle id="tbl_header">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="tbl_content">
|
||||
|
@ -92,335 +91,93 @@
|
|||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
|
||||
|
||||
<blockTable colWidths="55.0,35.0,150.0, 90.0,60.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') ]]
|
||||
|
||||
<blockTable colWidths="55.0,35.0,150.0, 90.0,60.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>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="404.0,375.0,69.0,72.0,64.0,59.00" 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>
|
||||
<td><para style="P9b"><u> [[ sum_currency_amount_account(o, data['form']) or '0.0' ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</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>
|
||||
|
||||
<blockTable colWidths="55.0,35.0,166.0,90.0,60.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>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<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>
|
||||
<blockTable colWidths="405.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>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
|
||||
<td>
|
||||
|
||||
<blockTable colWidths="50.0,35.0,150.0, 90.0,60.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,59.00" 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>
|
||||
<td>
|
||||
|
||||
<para style="P9b"><u> [[ sum_currency_amount_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>
|
||||
[[ 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>
|
||||
|
||||
<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,166.0,90.0,60.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>
|
||||
</blockTable>
|
||||
</story>
|
||||
</document>
|
|
@ -29,31 +29,31 @@ 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="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'}
|
||||
|
||||
}
|
||||
#report_type = '''<?xml version="1.0"?>
|
||||
#<form string="Select Report Type">
|
||||
#</form>'''
|
||||
#
|
||||
#dates_form = '''<?xml version="1.0"?>
|
||||
#<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">
|
||||
|
@ -69,24 +69,58 @@ account_fields = {
|
|||
|
||||
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"/>
|
||||
|
||||
<field name="company_id" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<newline/>
|
||||
<field name="display_account"/>
|
||||
<field name="sortbydate"/>
|
||||
|
||||
<field name="landscape"/>
|
||||
<field name="amount_currency"/>
|
||||
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<newline/>
|
||||
|
||||
<group attrs="{'invisible':[('state','=','byperiod'),('state','=','none')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','=','bydate'),('state','=','none')]}" colspan="4">
|
||||
<separator string="Filter on Periods" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>'''
|
||||
|
||||
period_fields = {
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'state':{
|
||||
'string':"Date/Period Filter",
|
||||
'type':'selection',
|
||||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
|
||||
'default': lambda *a:'bydate'
|
||||
},
|
||||
'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'},
|
||||
'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'},
|
||||
'landscape':{'string':"Landscape Mode",'type':'boolean'},
|
||||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'amount_currency':{'string':"with amount in currency",'type':'boolean'}
|
||||
'amount_currency':{'string':"With Currency",'type':'boolean'},
|
||||
'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')},
|
||||
|
||||
}
|
||||
def _check_path(self, cr, uid, data, context):
|
||||
if data['model'] == 'account.account':
|
||||
|
@ -117,20 +151,22 @@ def _check_date(self, cr, uid, data, context):
|
|||
|
||||
class wizard_report(wizard.interface):
|
||||
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
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
periods_obj=pooler.get_pool(cr.dbname).get('account.period')
|
||||
data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
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': {
|
||||
|
@ -142,21 +178,9 @@ class wizard_report(wizard.interface):
|
|||
'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'),('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}
|
||||
|
|
Loading…
Reference in New Issue