). All Rights Reserved
# $Id$
#
@@ -27,154 +27,155 @@ from report import report_sxw
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 = []
+ def __init__(self, cr, uid, name, context):
+ print "init"
+ 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,
+ 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):
+ 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')"
+ if (form['result_selection'] == 'customer' ):
+ self.ACCOUNT_TYPE = "('receivable')"
+ elif (form['result_selection'] == 'supplier'):
+ self.ACCOUNT_TYPE = "('payable')"
+ else:
+ self.ACCOUNT_TYPE = "('payable','receivable')"
- 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 = %s) " \
- "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)
- #
+ 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 = %s) " \
+ "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:
+ print partner
+ 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=%s) " \
+ "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 = %s) " \
+ "AND account_account.active",
+ (form['date1'], partner['id'],form['date1'], form['company_id']))
+ before = self.cr.fetchone()
- 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=%s) " \
- "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 = %s) " \
- "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)
- self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
+ 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=%s) " \
+ "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 = %s) " \
+ "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 ""
+ 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 = %s) " \
+ "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 = %s) " \
+ "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)
+ 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 = %s) " \
+ "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 = %s) " \
+ "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)
+ 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
- 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=%s) " \
- "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 = %s) " \
- "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 ""
- 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 = %s) " \
- "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 = %s) " \
- "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)
- 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 = %s) " \
- "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 = %s) " \
- "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)
- 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)
- 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
- 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,pos):
+ period = self.total_account[int(pos)]
+ return period
- def _get_total(self,pos):
- period = self.total_account[int(pos)]
- return period
+ def _get_direction(self,pos):
+ period = self.total_account[int(pos)]
+ return period
- def _get_direction(self,pos):
- period = self.total_account[int(pos)]
- return period
+ def _get_for_period(self,pos):
+ period = self.total_account[int(pos)]
+ return period
- 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)
+ 'addons/account/report/aged_trial_balance.rml',parser=aged_trial_report,header=False)
diff --git a/addons/account/report/aged_trial_balance.rml b/addons/account/report/aged_trial_balance.rml
index c2fb76f8388..1cbc118b571 100644
--- a/addons/account/report/aged_trial_balance.rml
+++ b/addons/account/report/aged_trial_balance.rml
@@ -69,7 +69,7 @@
-
+
diff --git a/addons/account/report/invoice.rml b/addons/account/report/invoice.rml
index 157fdb8c569..b9cd13d8569 100644
--- a/addons/account/report/invoice.rml
+++ b/addons/account/report/invoice.rml
@@ -327,22 +327,22 @@
[[ l.name ]]
|
- [[ ', '.join([lt.name for lt in l.invoice_line_tax_id]) or '' ]]
- |
+ [[ ', '.join([ lt.description for lt in l.invoice_line_tax_id ]) or '' ]]
+
- [[ formatLang(l.quantity) or '0.00' ]]
+ [[ l.quantity or 0.00 ]]
|
[[ (l.uos_id and l.uos_id.name) or '' ]]
|
- [[ formatLang(l.price_unit) or '0.00' ]]
+ [[ l.price_unit or 0.00 ]]
|
- [[ l.discount and formatLang (l.discount) or '0.00' ]]
+ [[ l.discount and l.discount or 0.00 ]]
|
- [[ formatLang(l.price_subtotal) or '0.00' ]]
+ [[ l.price_subtotal or 0.00 ]]
|
[[ o.currency_id.code ]]
@@ -350,7 +350,7 @@
|
|
- [[ format(l.note or removeParentNode('tr')) ]]
+ [[ l.note or removeParentNode('tr') ]]
@@ -418,7 +418,7 @@
Net Total:
|
- [[ formatLang(o.amount_untaxed) or '0.00' ]]
+ [[ o.amount_untaxed or 0.00 ]]
|
[[ o.currency_id.code ]]
@@ -434,7 +434,7 @@
Taxes:
|
- [[ formatLang(o.amount_tax) or '0.00']]
+ [[ o.amount_tax or 0.00 ]]
|
[[ o.currency_id.code ]]
@@ -450,7 +450,7 @@
Total:
|
- [[ formatLang(o.amount_total) or '0.00' ]]
+ [[ o.amount_total or 0.00]]
|
[[ o.currency_id.code ]]
@@ -464,8 +464,8 @@
|
-
-
+
+
|
Tax
|
@@ -476,33 +476,39 @@
Amount
-
-
-
-
-
-
-
-
- [[ repeatIn(o.tax_line,'t') ]]
-
-
+
+
+
|
- [[ t.name ]]
+
|
- [[ formatLang(t.base) or '0.00' ]]
+
|
- [[ formatLang(t.amount) or '0.00' ]]
+
|
-
+
+
+ [[ repeatIn(o.tax_line,'t') ]]
+ |
+ [[ lt.description + '/' + t.name ]]
+ |
+
+ [[ t.base or 0.00 ]]
+ |
+
+ [[ t.amount or 0.00 ]] [[ t.tax_code_id.notprintable and removeParentNode('tr') or '' ]]
+ |
+
+
+
|
-
+
|
| | |