changes in :
account/report/aged_trial_balance.py* account/report/aged_trial_balance.rml* account/report/tax_report.py* account/report/tax_report.rml* account/report/third_party_ledger.py account/report/third_party_ledger.rml account/wizard/wizard_aged_trial_balance.py* bzr revid: patelamit2003@gmail.com-20080922134215-licu0ipred3qme1t
This commit is contained in:
parent
34cfaac7a5
commit
5a537b4b21
|
@ -1,9 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -30,166 +27,172 @@
|
|||
|
||||
import time
|
||||
import pooler
|
||||
import rml_parse
|
||||
from report import report_sxw
|
||||
|
||||
class aged_trial_report(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(aged_trial_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_lines': self._get_lines,
|
||||
'get_total': self._get_total,
|
||||
'get_before': self._get_before,
|
||||
'get_for_period': self._get_for_period,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
})
|
||||
class aged_trial_report(rml_parse.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(aged_trial_report, self).__init__(cr, uid, name, context)
|
||||
self.line_query = ''
|
||||
self.total_account = []
|
||||
|
||||
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_lines': self._get_lines,
|
||||
'get_total': self._get_total,
|
||||
'get_direction': self._get_direction,
|
||||
'get_for_period': self._get_for_period,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
|
||||
})
|
||||
|
||||
|
||||
def _get_lines(self, form):
|
||||
|
||||
if (form['result_selection'] == 'customer' ):
|
||||
self.ACCOUNT_TYPE = "('receivable')"
|
||||
elif (form['result_selection'] == 'supplier'):
|
||||
self.ACCOUNT_TYPE = "('payable')"
|
||||
else:
|
||||
self.ACCOUNT_TYPE = "('payable','receivable')"
|
||||
|
||||
|
||||
def _add_header(self, node):
|
||||
return True
|
||||
res = []
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
self.line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': form['fiscalyear']})
|
||||
self.cr.execute("SELECT DISTINCT res_partner.id AS id, " \
|
||||
"res_partner.name AS name " \
|
||||
"FROM res_partner,account_move_line AS line, account_account,account_move_reconcile AS recon " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (line.partner_id=res_partner.id) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"ORDER BY res_partner.name", (form['date1'],form['company_id']))
|
||||
partners = self.cr.dictfetchall()
|
||||
## mise a 0 du total
|
||||
for i in range(7):
|
||||
self.total_account.append(0)
|
||||
#
|
||||
|
||||
for partner in partners:
|
||||
values = {}
|
||||
## If choise selection is in the future
|
||||
if form['direction_selection'] == 'future':
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (COALESCE(date_maturity,date) < %s) AND (partner_id=%d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form['date1'], partner['id'],form['date1'], form['company_id']))
|
||||
before = self.cr.fetchone()
|
||||
|
||||
self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
|
||||
|
||||
def _get_lines(self, form):
|
||||
self.form=form
|
||||
res = []
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': form['fiscalyear'],'state':form['state']})
|
||||
self.cr.execute("SELECT DISTINCT res_partner.id AS id, " \
|
||||
"res_partner.name AS name, res_partner.ref AS code " \
|
||||
"FROM res_partner, account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (line.reconcile_id IS NULL) " \
|
||||
"AND (line.partner_id=res_partner.id) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active " \
|
||||
"ORDER BY res_partner.name", (form['company_id'],))
|
||||
partners = self.cr.dictfetchall()
|
||||
for partner in partners:
|
||||
values = {}
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN (" + form['computation'] +")) " \
|
||||
"AND (date < %s) AND (partner_id=%d) " \
|
||||
"AND (reconcile_id IS NULL) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form['0']['start'], partner['id'], form['company_id']))
|
||||
before = self.cr.fetchone()
|
||||
values['before'] = before and before[0] or ""
|
||||
for i in range(5):
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN (" + form['computation'] + ")) " \
|
||||
"AND (date >= %s) AND (date <= %s) " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND (reconcile_id IS NULL) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form[str(i)]['start'], form[str(i)]['stop'],
|
||||
partner['id'], form['company_id']))
|
||||
during = self.cr.fetchone()
|
||||
values[str(i)] = during and during[0] or ""
|
||||
values['direction'] = before and before[0] or 0.0
|
||||
else:
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (COALESCE(date_maturity,date) > %s) AND (partner_id=%d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form['date1'], partner['id'],form['date1'], form['company_id']))
|
||||
after = self.cr.fetchone()
|
||||
self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
|
||||
values['direction'] = after and after[0] or ""
|
||||
#print str(values['direction'])
|
||||
for i in range(5):
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id=account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (COALESCE(date_maturity,date) BETWEEN %s AND %s) " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(form[str(i)]['start'], form[str(i)]['stop'],partner['id'],form['date1'] ,form['company_id']))
|
||||
during = self.cr.fetchone()
|
||||
# Ajout du compteur
|
||||
self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
|
||||
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + form['computation'] + ")) " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND (reconcile_id IS NULL) " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(partner['id'], form['company_id']))
|
||||
total = self.cr.fetchone()
|
||||
values['total'] = total and total[0] or 0.0
|
||||
values['name'] = partner['name']
|
||||
values['ref'] = partner['code']
|
||||
t = 0.0
|
||||
for i in range(5)+['before']:
|
||||
t+= float(values.get(str(i), 0.0) or 0.0)
|
||||
if values['total']:
|
||||
res.append(values)
|
||||
total = 0.0
|
||||
totals = {}
|
||||
for r in res:
|
||||
total += float(r['total'] or 0.0)
|
||||
for i in range(5)+['before']:
|
||||
totals.setdefault(str(i), 0.0)
|
||||
totals[str(i)] += float(r[str(i)] or 0.0)
|
||||
if form['sorting_on']=='amount':
|
||||
res.sort(lambda x,y:cmp(y['total'],x['total']))
|
||||
return res
|
||||
#print str(during)
|
||||
values[str(i)] = during and during[0] or ""
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN " + self.ACCOUNT_TYPE + ") " \
|
||||
"AND (partner_id = %d) " \
|
||||
"AND ((reconcile_id IS NULL) " \
|
||||
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(partner['id'],form['date1'],form['company_id']))
|
||||
total = self.cr.fetchone()
|
||||
values['total'] = total and total[0] or 0.0
|
||||
## Add for total
|
||||
self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
|
||||
print self.total_account,">>>>>>>>>>>>>Total>>>>>>>>>>>>>>>>"
|
||||
values['name'] = partner['name']
|
||||
#t = 0.0
|
||||
#for i in range(5)+['direction']:
|
||||
# t+= float(values.get(str(i), 0.0) or 0.0)
|
||||
#values['total'] = t
|
||||
|
||||
if values['total']:
|
||||
|
||||
res.append(values)
|
||||
|
||||
total = 0.0
|
||||
|
||||
totals = {}
|
||||
for r in res:
|
||||
total += float(r['total'] or 0.0)
|
||||
for i in range(5)+['direction']:
|
||||
totals.setdefault(str(i), 0.0)
|
||||
totals[str(i)] += float(r[str(i)] or 0.0)
|
||||
return res
|
||||
|
||||
def _get_total(self, fiscalyear, company_id):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': fiscalyear,'state':self.datas['form']['state']})
|
||||
self.cr.execute("SELECT SUM(debit - credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + self.form['computation'] + ")) "\
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND partner_id is NOT NULL " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(company_id,))
|
||||
total = self.cr.fetchone()
|
||||
return total and total[0] or 0.0
|
||||
|
||||
|
||||
|
||||
def _get_total(self,pos):
|
||||
print self.total_account,"========_get_total========"
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
|
||||
def _get_before(self, date, fiscalyear, company_id):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': fiscalyear,'state':self.datas['form']['state']})
|
||||
self.cr.execute("SELECT SUM(debit - credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + self.form['computation'] + ")) " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND (date < %s) " \
|
||||
"AND partner_id IS NOT NULL " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(date, company_id))
|
||||
before = self.cr.fetchone()
|
||||
return before and before[0] or 0.0
|
||||
|
||||
def _get_direction(self,pos):
|
||||
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
|
||||
def _get_for_period(self, period, fiscalyear, company_id):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
|
||||
context={'fiscalyear': fiscalyear,'state':self.datas['form']['state']})
|
||||
self.cr.execute("SELECT SUM(debit - credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
"WHERE (line.account_id = account_account.id) " \
|
||||
"AND (account_account.type IN (" + self.form['computation'] + ")) " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND (date >= %s) " \
|
||||
"AND (date <= %s) " \
|
||||
"AND partner_id IS NOT NULL " \
|
||||
"AND " + line_query + " " \
|
||||
"AND (account_account.company_id = %d) " \
|
||||
"AND account_account.active",
|
||||
(period['start'], period['stop'], company_id))
|
||||
period = self.cr.fetchone()
|
||||
return period and period[0] or 0.0
|
||||
def _get_for_period(self,pos):
|
||||
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
|
||||
report_sxw.report_sxw(
|
||||
'report.account.aged.trial.balance',
|
||||
'res.partner',
|
||||
'addons/account/report/aged_trial_balance.rml',
|
||||
parser=aged_trial_report, header=False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner',
|
||||
'addons/account/report/aged_trial_balance.rml',parser=aged_trial_report,header=False)
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,34 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<template pageSize="(1000.0,770.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="57.0" y1="57.0" width="728" height="481"/>
|
||||
<frame id="first" x1="20.0" y1="35.0" width="980" height="650"/>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
<!--<stroke color="darkblue"/>-->
|
||||
|
||||
<!--TITLE COMPANY-->
|
||||
<!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
|
||||
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.5cm" y="25.00cm">[[ company.name ]]</drawString>
|
||||
<drawString x="30.40cm" y="25.00cm">Age Partner Balance - [[ get_currency(data['form']) ]]</drawString>
|
||||
|
||||
<!--COL 2-->
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.5cm" y="0.90cm"> [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]]</drawString>
|
||||
<drawString x="33.50cm" y="0.90cm">Page <pageNumber/></drawString>
|
||||
|
||||
<!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1.5cm 24.70cm 34.50cm 24.70cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
</pageGraphics>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
|
@ -13,231 +39,158 @@
|
|||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,-1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="8,0" stop="8,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="8,0" stop="8,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="8,0" stop="8,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="8,-1" stop="8,-1"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockTableStyle id="Table2">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="LEFT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2_content" fontName="Helvetica" fontSize="7.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Total" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Total_right" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="15.0" leading="20" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="content" fontName="Helvetica" fontSize="7.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="8.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<blockTable colWidths="198.0,313.0,217.0" repeatRows="1" style="Table1">
|
||||
<blockTable colWidths="290.0,90.0,90.0,90.0,90.0,93.0,95.0,95.0" style="Table2" repeatRows="1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">Partners</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Aged Trial balance</para>
|
||||
<para style="P8">[[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not due' ]] [[ data['form']['date1'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">From the beginning</para>
|
||||
<para style="P2">to [[ formatLang(data['form']['4']['stop'], date=True) ]]</para>
|
||||
<para style="P8">[[ data['form']['4']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['3']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['2']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['1']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ data['form']['0']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Total</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<para style="P3"> <font color="white">[[ (get_lines(data['form']), 'partner') == False or removeParentNode('para') ]]</font></para>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total">Account Total</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_direction('6') ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('4') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('3') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('2') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('1') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_for_period('0') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total_right">[[ get_total('5') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">[[ get_company(data['form']) ]]</para>
|
||||
<para style="P3">[[ repeatIn(get_lines(data['form']), 'partner') ]]</para>
|
||||
<para style="P2_content">[[ partner['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="content">[[ (partner['direction']) or 0.0 ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Currency: [[ get_currency(data['form']) ]]</para>
|
||||
<para style="content">[[ (partner['4']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['3']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['2']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['1']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['0']) or 0.0 ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ (partner['total']) or 0.0 ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P10">Printing date: [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="109.0,109.0,71.0,71.0,71.0,71.0,71.0,71.0,85.0" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">Partners</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['4']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['3']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['2']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['1']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ data['form']['0']['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">Before [[ formatLang(data['form']['0']['start'], date=True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">Total</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="109.0,109.0,71.0,71.0,71.0,71.0,71.0,71.0,85.0" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">[[ repeatIn(get_lines(data['form']), 'partner') ]]</para>
|
||||
<para style="P9">[[ partner['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ partner['ref'] or ' ' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['4'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['3'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['2'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['1'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['0'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['before'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ formatLang((partner['total'] or 0.0)) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="218.0,71.0,71.0,71.0,71.0,71.0,71.0,85.0" style="Tableau3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">Account total</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['4'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['3'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['2'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang( get_for_period(data['form']['1'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_for_period(data['form']['0'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ formatLang(get_before(data['form']['0']['start'], data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ formatLang(get_total( data['form']['fiscalyear'], data['form']['company_id'])) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P10">
|
||||
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -30,92 +27,206 @@
|
|||
|
||||
import time
|
||||
import pooler
|
||||
|
||||
import copy
|
||||
from report import report_sxw
|
||||
import pdb
|
||||
import re
|
||||
|
||||
class tax_report(report_sxw.rml_parse):
|
||||
_name = 'report.account.vat.declaration'
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(tax_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_period': self._get_period,
|
||||
'get_codes': self._get_codes,
|
||||
'get_general': self._get_general,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
'get_lines' : self._get_lines,
|
||||
})
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(tax_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_period': self._get_period,
|
||||
'get_codes': self._get_codes,
|
||||
'get_general': self._get_general,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
})
|
||||
|
||||
def comma_me(self,amount):
|
||||
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
amount = str(amount)
|
||||
if (amount == '0'):
|
||||
return ' '
|
||||
orig = amount
|
||||
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
|
||||
if orig == new:
|
||||
return new
|
||||
else:
|
||||
return self.comma_me(new)
|
||||
def _get_lines(self, based_on,period_list,company_id=False, parent=False, level=0):
|
||||
res = self._get_codes(based_on,parent,level,period_list)
|
||||
res = self._add_codes(based_on,res,period_list)
|
||||
|
||||
i = 0
|
||||
top_result = []
|
||||
|
||||
while i < len(res):
|
||||
|
||||
res_dict = { 'code' : res[i][1].code,
|
||||
'name' : res[i][1].name,
|
||||
'debit' : 0,
|
||||
'credit' : 0,
|
||||
'tax_amount' : res[i][1].sum_period,
|
||||
'type' : 1,
|
||||
'level' : res[i][0],
|
||||
'pos' : 0
|
||||
}
|
||||
|
||||
top_result.append(res_dict)
|
||||
res_general = self._get_general(res[i][1].id,period_list,company_id,based_on)
|
||||
ind_general = 0
|
||||
while ind_general < len(res_general) :
|
||||
res_general[ind_general]['type'] = 2
|
||||
res_general[ind_general]['pos'] = 0
|
||||
res_general[ind_general]['level'] = res_dict['level'] + ' '
|
||||
top_result.append(res_general[ind_general])
|
||||
ind_general+=1
|
||||
i+=1
|
||||
#array_result = self.sort_result(top_result)
|
||||
return top_result
|
||||
#return array_result
|
||||
|
||||
def _add_header(self, node):
|
||||
return True
|
||||
def _get_period(self, period_id):
|
||||
return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name
|
||||
|
||||
def _get_period(self, period_id):
|
||||
return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name
|
||||
def _get_general(self, tax_code_id,period_list ,company_id, based_on):
|
||||
res=[]
|
||||
period_sql_list = ','.join(map(str, period_list[0][2]))
|
||||
|
||||
if based_on == 'payments':
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id, \
|
||||
account.name AS name, \
|
||||
account.code AS code \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account, \
|
||||
account_move AS move \
|
||||
LEFT JOIN account_invoice invoice ON \
|
||||
(invoice.move_id = move.id) \
|
||||
WHERE line.state<>%s \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND move.id = line.move_id \
|
||||
AND ((invoice.state = %s) \
|
||||
OR (invoice.id IS NULL)) \
|
||||
GROUP BY account.id,account.name,account.code', ('draft',tax_code_id,
|
||||
company_id, 'paid'))
|
||||
|
||||
def _get_general(self, tax_code_id, period_id, company_id, based_on):
|
||||
res=[]
|
||||
if based_on == 'payments':
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account, \
|
||||
account_move AS move \
|
||||
LEFT JOIN account_invoice invoice ON \
|
||||
(invoice.move_id = move.id) \
|
||||
WHERE line.state<>%s \
|
||||
AND line.period_id = %d \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND move.id = line.move_id \
|
||||
AND ((invoice.state = %s) \
|
||||
OR (invoice.id IS NULL)) \
|
||||
GROUP BY account.id', ('draft', period_id, tax_code_id,
|
||||
company_id, 'paid'))
|
||||
else :
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account \
|
||||
WHERE line.state <> %s \
|
||||
AND line.period_id = %d \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND account.active \
|
||||
GROUP BY account.id', ('draft', period_id, tax_code_id,
|
||||
company_id))
|
||||
res = self.cr.dictfetchall()
|
||||
i = 0
|
||||
while i<len(res):
|
||||
res[i]['account'] = self.pool.get('account.account').browse(self.cr, self.uid, res[i]['account_id'])
|
||||
i+=1
|
||||
return res
|
||||
else :
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
account.id AS account_id, \
|
||||
account.name AS name, \
|
||||
account.code AS code \
|
||||
FROM account_move_line AS line, \
|
||||
account_account AS account \
|
||||
WHERE line.state <> %s \
|
||||
AND line.tax_code_id = %d \
|
||||
AND line.account_id = account.id \
|
||||
AND account.company_id = %d \
|
||||
AND account.active \
|
||||
GROUP BY account.id,account.name,account.code', ('draft',tax_code_id,
|
||||
company_id))
|
||||
res = self.cr.dictfetchall()
|
||||
#AND line.period_id IN ('+ period_sql_list +') \
|
||||
|
||||
i = 0
|
||||
while i<len(res):
|
||||
res[i]['account'] = self.pool.get('account.account').browse(self.cr, self.uid, res[i]['account_id'])
|
||||
i+=1
|
||||
return res
|
||||
|
||||
def _get_codes(self, period_id, based_on, parent=False, level=0):
|
||||
tc = self.pool.get('account.tax.code')
|
||||
ids = tc.search(self.cr, self.uid, [('parent_id','=',parent)])
|
||||
res = []
|
||||
for code in tc.browse(self.cr, self.uid, ids, {'period_id': period_id,
|
||||
'based_on': based_on}):
|
||||
res.append((' - '*level*2, code))
|
||||
res += self._get_codes(period_id, based_on, code.id, level+1)
|
||||
return res
|
||||
def _get_codes(self, based_on, parent=False, level=0,period_list=[]):
|
||||
tc = self.pool.get('account.tax.code')
|
||||
ids = tc.search(self.cr, self.uid, [('parent_id','=',parent)])
|
||||
|
||||
res = []
|
||||
for code in tc.browse(self.cr, self.uid, ids, {'based_on': based_on}):
|
||||
res.append(('a'*2*level,code))
|
||||
print"=====res=====",res
|
||||
res += self._get_codes(based_on, code.id, level+1)
|
||||
return res
|
||||
|
||||
def _add_codes(self,based_on, account_list=[],period_list=[]):
|
||||
res = []
|
||||
for account in account_list:
|
||||
tc = self.pool.get('account.tax.code')
|
||||
ids = tc.search(self.cr, self.uid, [('id','=',account[1].id)])
|
||||
sum_tax_add = 0
|
||||
for period_ind in period_list[0][2]:
|
||||
for code in tc.browse(self.cr, self.uid, ids, {'period_id':period_ind,'based_on': based_on}):
|
||||
sum_tax_add = sum_tax_add + code.sum_period
|
||||
|
||||
code.sum_period = sum_tax_add
|
||||
|
||||
res.append((account[0],code))
|
||||
return res
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
def _get_currency(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
|
||||
|
||||
def sort_result(self,accounts):
|
||||
# On boucle sur notre rapport
|
||||
result_accounts = []
|
||||
ind=0
|
||||
old_level=0
|
||||
while ind<len(accounts):
|
||||
#
|
||||
account_elem = accounts[ind]
|
||||
#
|
||||
|
||||
#
|
||||
# we will now check if the level is lower than the previous level, in this case we will make a subtotal
|
||||
if (account_elem['level'] < old_level):
|
||||
bcl_current_level = old_level
|
||||
bcl_rup_ind = ind - 1
|
||||
|
||||
while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ):
|
||||
tot_elem = copy.copy(accounts[bcl_rup_ind])
|
||||
res_tot = { 'code' : accounts[bcl_rup_ind]['code'],
|
||||
'name' : '',
|
||||
'debit' : 0,
|
||||
'credit' : 0,
|
||||
'tax_amount' : accounts[bcl_rup_ind]['tax_amount'],
|
||||
'type' : accounts[bcl_rup_ind]['type'],
|
||||
'level' : 0,
|
||||
'pos' : 0
|
||||
}
|
||||
|
||||
if res_tot['type'] == 1:
|
||||
# on change le type pour afficher le total
|
||||
res_tot['type'] = 2
|
||||
result_accounts.append(res_tot)
|
||||
bcl_current_level = accounts[bcl_rup_ind]['level']
|
||||
bcl_rup_ind -= 1
|
||||
|
||||
old_level = account_elem['level']
|
||||
result_accounts.append(account_elem)
|
||||
ind+=1
|
||||
|
||||
|
||||
return result_accounts
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
|
||||
'addons/account/report/tax_report.rml', parser=tax_report, header=False)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
'addons/account/report/tax_report.rml', parser=tax_report, header=2)
|
||||
|
||||
|
|
|
@ -2,7 +2,34 @@
|
|||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="42.0" y1="42.0" width="511" height="758"/>
|
||||
<frame id="first" x1="42.0" y1="62.0" width="511" height="728"/>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
<!--<stroke color="darkblue"/>-->
|
||||
|
||||
<!--TITLE COMPANY-->
|
||||
<!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
|
||||
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
||||
<!--COL 1-->
|
||||
<drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
|
||||
<drawRightString x="20cm" y="28.1cm">Tax Report</drawRightString>
|
||||
|
||||
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.0cm" y="1cm"> [[ time.strftime("%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>
|
||||
|
@ -20,11 +47,16 @@
|
|||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
|
||||
<blockTableStyle id="Table2">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
|
@ -36,131 +68,168 @@
|
|||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="6.0" leading="8"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="7.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="P1" fontName="Helvetica-Bold" alignment="CENTER" fontSize="14.5" leftIndent="-5.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" fontSize="8.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9c" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12a" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P16" fontName="Helvetica-Bold" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="1.0" leading="1" spaceBefore="0" spaceAfter="0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
|
||||
<blockTableStyle id="TrLevelaaaaaaa">
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockLeftPadding length="80" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaaaaa">
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockLeftPadding length="60" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaaaa">
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockLeftPadding length="40" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaaa">
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockLeftPadding length="20" start="1,0" stop="1,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaaa">
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevelaa">
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,0" stop="-1,-1"/>
|
||||
<blockTopPadding length="13" start="0,0" stop="-1,0"/>
|
||||
<blockBottomPadding length="2" start="0,0" stop="-1,0"/>
|
||||
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="TrLevel">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<blockTopPadding length="26" start="0,0" stop="-1,0"/>
|
||||
<blockBottomPadding length="2" start="0,0" stop="-1,0"/>
|
||||
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<paraStyle
|
||||
name="Levelaaaaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
|
||||
<paraStyle
|
||||
name="Levelaaaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
|
||||
<paraStyle
|
||||
name="Levelaaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Levelaaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Levelaaa"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Levelaa"
|
||||
firstLineIndent="-0.03cm"
|
||||
fontName="Helvetica-Bold"
|
||||
fontSize="8.0" />
|
||||
<paraStyle name="Level"
|
||||
fontSize="8.0"
|
||||
fontName="Helvetica-Bold"
|
||||
/>
|
||||
|
||||
</stylesheet>
|
||||
<story>
|
||||
<blockTable colWidths="139.0,220.0,152.0" repeatRows="1" style="Table1">
|
||||
<para style="P1"> Tax Report</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="347.0,64.0,59.0,71.0" style="Table2" repeatRows="2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P12">Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Tax Report</para>
|
||||
<para style="P12a">Débit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">Period: [[ get_period(data['form']['period_id']) ]]</para>
|
||||
<para style="P12a">Crédit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12a">Solde</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">[[ get_company(data['form']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Currency: [[ get_currency(data['form']) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P7"><font face="Times-Roman">Printing date: </font>[[ time.strftime('%Y-%m-%d') ]] <font face="Times-Roman">at</font> [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="148.0,168.0,64.0,59.0,71.0" repeatRows="1" style="Tableau3">
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Heading">Tax Code / Account</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">General Account</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Tax Amount</para>
|
||||
</td>
|
||||
|
||||
<para style="Caption">[[ repeatIn(get_lines(data['form']['based_on'],data['form']['periods'],data['form']['company_id']), 'o') ]]</para>
|
||||
<td>
|
||||
<para style="P5"><font color="white">[[ o['level'] ]]</font>
|
||||
[[o['type']==1 and ( setTag('para','para',{'fontName':'Helvetica'}))]]<font></font>
|
||||
[[ setTag('tr','tr',{'style':'TrLevel'+str(o['level']), 'paraStyle':('Level'+str(o['level']))}) ]]<font></font>
|
||||
[[ o['code'] ]] [[ o['name'] ]]<font></font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[o['type']==2 and (o['debit']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6"> [[o['type']==2 and (o['credit']) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ o['tax_amount'] ]]</para>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P9">[[ repeatIn(get_codes(data['form']['period_id'], data['form']['based_on']), 'o') ]]</para>
|
||||
<blockTable colWidths="316.0,64.0,59.0,71.0" repeatRows="1" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">[[ o[0] ]] [[ o[1].code ]] - [[ o[1].name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ o[1].sum_period and ('%.2f' % o[1].sum_period) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="44.0,273.0,62.0,60.0,72.0" repeatRows="1" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">[[repeatIn(get_general(o[1], data['form']['period_id'], data['form']['company_id'], data['form']['based_on']), 'g') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ g['account'].code ]] - [[ g['account'].name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ g['debit'] and '%.2f' % g['debit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ g['credit'] and '%.2f' % g['credit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ g['tax_amount'] and '%.2f' % g['tax_amount'] or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
</blockTable>
|
||||
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
import pooler
|
||||
import time
|
||||
import re
|
||||
|
||||
import rml_parse
|
||||
import datetime
|
||||
from report import report_sxw
|
||||
|
||||
class third_party_ledger(report_sxw.rml_parse):
|
||||
class third_party_ledger(rml_parse.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
self.date_lst = []
|
||||
self.date_lst_string = ''
|
||||
|
@ -135,6 +135,7 @@ class third_party_ledger(report_sxw.rml_parse):
|
|||
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
partner_to_use = []
|
||||
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT DISTINCT line.partner_id " \
|
||||
|
@ -384,5 +385,5 @@ class third_party_ledger(report_sxw.rml_parse):
|
|||
|
||||
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
|
||||
'addons/account/third_party_ledger.rml',parser=third_party_ledger,
|
||||
header=2)
|
||||
header=False)
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
|
||||
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
|
||||
<header>
|
||||
<pageGraphics>
|
||||
<!--logo-->
|
||||
<!--<fill color="darkblue"/>-->
|
||||
|
@ -30,8 +32,11 @@
|
|||
<lineMode width="0.7"/>
|
||||
<lines>1cm 27.7cm 20cm 27.7cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
</pageGraphics>
|
||||
|
||||
</pageGraphics>
|
||||
</header>
|
||||
</pageTemplate>
|
||||
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
|
@ -50,33 +55,37 @@
|
|||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="tbl_heading">
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockValign value="LEFT"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
|
||||
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockValign value="LEFT"/>
|
||||
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockValign value="LEFT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,-1"/>
|
||||
|
||||
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockValign value="LEFT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
|
@ -84,8 +93,8 @@
|
|||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="2.0" leading="1" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="14.5" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="7.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="7.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
|
@ -100,7 +109,8 @@
|
|||
<paraStyle name="total" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="12" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="date" fontName="Helvetica" fontSize="8.0" leading="9" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
|
@ -113,116 +123,117 @@
|
|||
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P9"> Third Party Ledger</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para>
|
||||
<font color="white">[[ data['form']['page_split'] == True or removeParentNode('para') ]] </font>
|
||||
<font color="white">[[ repeatIn(objects, 'p') ]] [[ setLang(p.partner_id.lang) ]]</font>
|
||||
</para>
|
||||
<blockTable colWidths="45.0,37.0,120.0,135.0,69.0,72.0,63.0" style="tbl_heading">
|
||||
<story>
|
||||
|
||||
<para style="P2"><font color="white"></font></para>
|
||||
<para>
|
||||
<font color="white">[[ data['form']['page_split'] == True or removeParentNode('para') ]] </font>
|
||||
<font color="white">[[ repeatIn(objects, 'p') ]] [[ setLang(p.partner_id.lang) ]]</font>
|
||||
</para>
|
||||
<blockTable colWidths="50.0,37.0,120.0,135.0,69.0,72.0,63.0" repeatRows="1" style="tbl_heading">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">JNRL</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Ref.</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Entry label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="337.0,69.0,72.0,63.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Balance">Balance brought forward</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_debit(data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_credit(data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_debit(data) - sum_credit(data)) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<para >
|
||||
|
||||
<font color="white">[[ repeatIn(objects, 'p') ]] </font>
|
||||
</para>
|
||||
|
||||
<blockTable colWidths="200.0,137.0,69.0,72.0,63.0" repeatRows="1" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="total">[[ p.ref ]] - [[ p.name ]]</para>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<para style="total"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_debit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_credit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_debit_partner(p,data) - sum_credit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<blockTable colWidths="45.0,37.0,120.0,135.0,69.0,72.0,63.0" style="Table2" repeatRows="1">
|
||||
|
||||
<tr>
|
||||
|
||||
<para style="date">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">JNRL</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Ref.</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">Entry label</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">Balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="337.0,69.0,72.0,63.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Balance">Balance brought forward</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15"><font face="Helvetica">[[ repeatIn(lines(p,data), 'line') ]]</font>[[ line['date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['debit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['credit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['progress']) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
|
||||
|
||||
<para style="P8"><u>[[ (sum_debit(data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_credit(data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8"><u>[[ (sum_debit(data) - sum_credit(data)) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P1">
|
||||
<font color="white">[[ data['form']['page_split'] == False or removeParentNode('para') ]] </font>
|
||||
<font color="white">[[ repeatIn(objects, 'p') ]]</font>
|
||||
</para>
|
||||
<blockTable colWidths="200.0,137.0,69.0,72.0,63.0" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="total">[[ p.ref ]] - [[ p.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="total"></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_debit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_credit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9b"><u>[[ (sum_debit_partner(p,data) - sum_credit_partner(p,data)) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="45.0,37.0,120.0,135.0,69.0,72.0,63.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P15"><font face="Helvetica">[[ repeatIn(lines(p,data), 'line') ]]</font>[[ line['date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['debit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['credit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">[[ (line['progress']) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</story>
|
||||
</document>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
# Fabien Pinckaers <fp@tiny.Be>
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
|
@ -34,78 +32,79 @@ import datetime
|
|||
import pooler
|
||||
|
||||
from mx.DateTime import *
|
||||
from tools.translate import _
|
||||
|
||||
_aged_trial_form = """<?xml version="1.0"?>
|
||||
<form string="Aged Trial Balance">
|
||||
<field name="company_id"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal year)"/>
|
||||
<newline/>
|
||||
<field name="period_length"/>
|
||||
<newline/>
|
||||
<field name="sorting_on"/>
|
||||
<newline/>
|
||||
<field name="computation"/>
|
||||
<newline/>
|
||||
<field name="state"/>
|
||||
<field name="company_id"/>
|
||||
<newline/>
|
||||
<field name="date1"/>
|
||||
<field name="period_length"/>
|
||||
<newline/>
|
||||
<field name="result_selection"/>
|
||||
<newline/>
|
||||
<field name="direction_selection"/>
|
||||
</form>"""
|
||||
|
||||
_aged_trial_fields = {
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'help': 'Keep empty for all open fiscal year'},
|
||||
'period_length': {'string': 'Period length (days)', 'type': 'integer', 'required': True, 'default': lambda *a:30},
|
||||
'sorting_on':{'string': 'Sorting On', 'type': 'selection', 'selection': [('partner','By Partner Name (asc)'), ('amount','By Amount (desc)')],'required': True, 'default': lambda *a:'partner'},
|
||||
'computation':{'string': 'Computational Method', 'type': 'selection', 'selection': [("\'receivable\'",'On Receivables Only'), ("\'payable\'",'On Payables Only'), ("\'receivable\',\'payable\'",'On Receivables & Payables')], 'required': True, 'default': lambda *a:"\'receivable\'"},
|
||||
'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
|
||||
}
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'period_length': {'string': 'Period length (days)', 'type': 'integer', 'required': True, 'default': lambda *a:30},
|
||||
'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'result_selection':{'string':"Display partner",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
|
||||
'direction_selection':{'string':"Display aged balance of",'type':'selection','selection':[('past','Due amount'),('future','Not due amount')]},
|
||||
}
|
||||
|
||||
def _calc_dates(self, cr, uid, data, context):
|
||||
res = {}
|
||||
period_length = data['form']['period_length']
|
||||
if period_length<=0:
|
||||
raise wizard.except_wizard(_('UserError'), _('You must enter a period length that cannot be 0 or below !'))
|
||||
start = now()
|
||||
for i in range(5)[::-1]:
|
||||
stop = start-RelativeDateTime(days=period_length)
|
||||
res[str(i)] = {
|
||||
'name' : str((5-i)*period_length)+' days',
|
||||
'stop': start.strftime('%Y-%m-%d'),
|
||||
'start' : stop.strftime('%Y-%m-%d'),
|
||||
}
|
||||
start = stop - RelativeDateTime(days=1)
|
||||
return res
|
||||
res = {}
|
||||
period_length = data['form']['period_length']
|
||||
if period_length<=0:
|
||||
raise wizard.except_wizard('UserError', 'You must enter a period length that cannot be 0 or below !')
|
||||
start = datetime.date.fromtimestamp(time.mktime(time.strptime(data['form']['date1'],"%Y-%m-%d")))
|
||||
start = DateTime(int(start.year),int(start.month),int(start.day))
|
||||
if data['form']['direction_selection'] == 'past':
|
||||
for i in range(5)[::-1]:
|
||||
stop = start - RelativeDateTime(days=period_length)
|
||||
res[str(i)] = {
|
||||
'name' : str((5-(i+1))*period_length) + '-' + str((5-i)*period_length),
|
||||
|
||||
'stop': start.strftime('%Y-%m-%d'),
|
||||
'start' : stop.strftime('%Y-%m-%d'),
|
||||
}
|
||||
start = stop - RelativeDateTime(days=1)
|
||||
else:
|
||||
for i in range(5):
|
||||
stop = start + RelativeDateTime(days=period_length)
|
||||
res[str(5-(i+1))] = {
|
||||
'name' : str((i)*period_length)+'-'+str((i+1)*period_length),
|
||||
'start': start.strftime('%Y-%m-%d'),
|
||||
'stop' : stop.strftime('%Y-%m-%d'),
|
||||
}
|
||||
start = stop + RelativeDateTime(days=1)
|
||||
return res
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
data['form']['company_id'] = company_id
|
||||
data['form']['state']='all'
|
||||
return data['form']
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
data['form']['company_id'] = company_id
|
||||
|
||||
return data['form']
|
||||
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':_aged_trial_form, 'fields':_aged_trial_fields, 'state':[('end','Cancel'),('print','Print Aged Partner Balance')]},
|
||||
},
|
||||
'print': {
|
||||
'actions': [_calc_dates],
|
||||
'result': {'type':'print', 'report':'account.aged.trial.balance', 'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':_aged_trial_form, 'fields':_aged_trial_fields, 'state':[('end','Cancel'),('print','Print Aged Trial Balance')]},
|
||||
},
|
||||
'print': {
|
||||
'actions': [_calc_dates],
|
||||
'result': {'type':'print', 'report':'account.aged_trial_balance', 'state':'end'},
|
||||
},
|
||||
}
|
||||
wizard_report('account.aged.trial.balance')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
Loading…
Reference in New Issue