diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index b2e4cdb7fc3..bcc9c75be57 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -27,14 +27,6 @@ from common_report_header import common_report_header
class account_balance(report_sxw.rml_parse, common_report_header):
_name = 'report.account.account.balance'
- def set_context(self, objects, data, ids, report_type=None):
- new_ids = ids
- if (data['model'] == 'ir.ui.menu'):
- new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
- objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
- self.query_get_clause = data['form'].get('query_line', False) or ''
- return super(account_balance, self).set_context(objects, data, new_ids, report_type=report_type)
-
def __init__(self, cr, uid, name, context=None):
super(account_balance, self).__init__(cr, uid, name, context=context)
self.sum_debit = 0.00
@@ -57,6 +49,14 @@ class account_balance(report_sxw.rml_parse, common_report_header):
})
self.context = context
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
+ objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
+ self.query_get_clause = data['form'].get('query_line', False) or ''
+ return super(account_balance, self).set_context(objects, data, new_ids, report_type=report_type)
+
def _add_header(self, node, header=1):
if header == 0:
self.rml_header = ""
diff --git a/addons/account/report/account_general_journal.py b/addons/account/report/account_general_journal.py
index b814e86aa61..36eb8e9c82d 100644
--- a/addons/account/report/account_general_journal.py
+++ b/addons/account/report/account_general_journal.py
@@ -23,9 +23,7 @@ import time
from common_report_header import common_report_header
from report import report_sxw
-#
-# Use period and Journal for selection or resources
-#
+
class journal_print(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
@@ -88,16 +86,15 @@ class journal_print(report_sxw.rml_parse, common_report_header):
'FROM account_move_line l '
'LEFT JOIN account_journal j ON (l.journal_id=j.id) '
'LEFT JOIN res_currency c on (l.currency_id=c.id)'
- 'WHERE period_id=%s AND journal_id IN %s '+self.query_get_clause +''
- 'GROUP BY j.id, j.code, j.name, l.amount_currency,c.code,l.currency_id ',
+ 'WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ''
+ 'GROUP BY j.id, j.code, j.name, l.amount_currency,c.code, l.currency_id ',
(period_id, tuple(self.journal_ids)))
-
return self.cr.dictfetchall()
def _set_get_account_currency_code(self, account_id):
self.cr.execute("SELECT c.code AS code "\
- "FROM res_currency c, account_account AS ac "\
- "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id))
+ "FROM res_currency c, account_account AS ac "\
+ "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id))
result = self.cr.fetchone()
if result:
self.account_currency = result[0]
@@ -105,20 +102,19 @@ class journal_print(report_sxw.rml_parse, common_report_header):
self.account_currency = False
def _get_account(self, data):
- if data['model']=='account.journal.period':
+ if data['model'] == 'account.journal.period':
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
return super(journal_print ,self)._get_account(data)
def _get_fiscalyear(self, data):
- if data['model']=='account.journal.period':
+ if data['model'] == 'account.journal.period':
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name
- return super(journal_print ,self)._get_fiscalyear(data)
+ return super(journal_print, self)._get_fiscalyear(data)
def _display_currency(self, data):
if data['model'] == 'account.journal.period':
return True
return data['form']['amount_currency']
- return res
def _sum_debit_period(self, period_id, journal_id=None):
journals = journal_id or self.journal_ids
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
index e8c95d0ed11..a92c1ba7f51 100644
--- a/addons/account/report/account_general_ledger.py
+++ b/addons/account/report/account_general_ledger.py
@@ -75,7 +75,6 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
self.context = context
def _sum_currency_amount_account(self, account, form):
- #FIXME: not working
self.cr.execute("SELECT sum(l.amount_currency) AS tot_currency "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s" %(account.id, self.query))
@@ -84,7 +83,6 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
self.cr.execute("SELECT sum(l.amount_currency) AS tot_currency "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
- # Add initial balance to the result
sum_currency += self.cr.fetchone()[0] or 0.0
return str(sum_currency)
@@ -94,7 +92,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc):
sql = """
SELECT count(id)
- FROM account_move_line l
+ FROM account_move_line AS l
WHERE %s AND l.account_id = %%s
""" % (self.query)
self.cr.execute(sql, (child_account.id,))
diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py
index f22b4837c7e..220b18edc2e 100644
--- a/addons/account/report/account_journal.py
+++ b/addons/account/report/account_journal.py
@@ -23,9 +23,7 @@ import time
from common_report_header import common_report_header
from report import report_sxw
-#
-# Use period and Journal for selection or resources
-#
+
class journal_print(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
@@ -77,9 +75,9 @@ class journal_print(report_sxw.rml_parse, common_report_header):
return obj_mline.browse(self.cr, self.uid, ids)
def _set_get_account_currency_code(self, account_id):
- self.cr.execute("SELECT c.code as code "\
- "FROM res_currency c,account_account as ac "\
- "WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
+ self.cr.execute("SELECT c.code AS code "\
+ "FROM res_currency c,account_account AS ac "\
+ "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id))
result = self.cr.fetchone()
if result:
self.account_currency = result[0]
diff --git a/addons/account/report/account_partner_balance.py b/addons/account/report/account_partner_balance.py
index 533cf8285ba..d635fff8c0e 100644
--- a/addons/account/report/account_partner_balance.py
+++ b/addons/account/report/account_partner_balance.py
@@ -68,9 +68,9 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
per_ids = self.pool.get('account.period').browse(self.cr, self.uid, form['periods'])
for r in per_ids:
if r == per_ids[len(per_ids)-1]:
- result+=r.name+". "
+ result += r.name + ". "
else:
- result+=r.name+", "
+ result += r.name + ", "
else:
fy_obj = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear'])
res = fy_obj.period_ids
@@ -99,13 +99,18 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
def set_context(self, objects, data, ids, report_type=None):
## Compute Code
#
- if (data['form']['result_selection'] == 'customer' ):
+ self.initial_balance = data['form'].get('initial_balance', True)
+ self.query = data['form'].get('query_line', '')
+ self.init_query = data['form'].get('initial_bal_query', '')
+ self.result_selection = data['form'].get('result_selection')
+
+ if (self.result_selection == 'customer' ):
self.ACCOUNT_TYPE = ('receivable',)
- elif (data['form']['result_selection'] == 'supplier'):
+ elif (self.result_selection == 'supplier'):
self.ACCOUNT_TYPE = ('payable',)
else:
self.ACCOUNT_TYPE = ('payable', 'receivable')
- #
+
self.cr.execute("SELECT a.id " \
"FROM account_account a " \
"LEFT JOIN account_account_type t " \
@@ -113,10 +118,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
"WHERE a.type IN %s " \
"AND a.active", (self.ACCOUNT_TYPE,))
self.account_ids = [a for (a,) in self.cr.fetchall()]
- self.initial_balance = data['form']['initial_balance'] # for include initial balance
- self.query = data['form'].get('query_line', '')
- self.init_query = data['form'].get('initial_bal_query', '')
- return super(partner_balance, self).set_context(objects, data, ids, report_type)
+ return super(partner_balance, self).set_context(objects, data, ids, report_type=report_type)
def lines(self, data):
full_account = []
@@ -140,7 +142,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
"FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \
"JOIN account_account ac ON (l.account_id = ac.id)" \
"WHERE ac.type IN %s " \
- " AND " + self.query + "" \
+ "AND " + self.query + "" \
"GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \
"ORDER BY l.account_id,p.name",
(self.ACCOUNT_TYPE,))
@@ -456,11 +458,11 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
return credit > debit and credit - debit
def _get_partners(self, data):
- if data['form']['result_selection'] == 'customer':
+ if self.result_selection == 'customer':
return 'Receivable Accounts'
- elif data['form']['result_selection'] == 'supplier':
+ elif self.result_selection == 'supplier':
return 'Payable Accounts'
- elif data['form']['result_selection'] == 'customer_supplier':
+ elif self.result_selection == 'customer_supplier':
return 'Receivable and Payable Accounts'
return ''
diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py
index dc6e7dc14e2..46ec19ece7c 100644
--- a/addons/account/report/account_partner_ledger.py
+++ b/addons/account/report/account_partner_ledger.py
@@ -21,7 +21,6 @@
import time
import re
-import datetime
import rml_parse
from report import report_sxw
@@ -30,8 +29,6 @@ from common_report_header import common_report_header
class third_party_ledger(rml_parse.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
- self.date_lst = []
- self.date_lst_string = ''
super(third_party_ledger, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
@@ -58,27 +55,6 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
'display_currency':self._display_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 special_map(self):
- string_map = ''
- for date_string in self.date_lst:
- string_map = date_string + ','
- return string_map
-
def set_context(self, objects, data, ids, report_type=None):
self.query = data['form'].get('query_line', '')
self.init_query = data['form'].get('initial_bal_query', '')
@@ -91,7 +67,6 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
## Si on imprime depuis les partenaires
if ids:
PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),)
-
if self.result_selection == 'supplier':
self.ACCOUNT_TYPE = ['payable']
elif self.result_selection == 'customer':
@@ -108,7 +83,6 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
"AND a.active", (tuple(self.ACCOUNT_TYPE), ))
self.account_ids = [a for (a,) in self.cr.fetchall()]
partner_to_use = []
-
self.cr.execute(
"SELECT DISTINCT l.partner_id " \
"FROM account_move_line AS l, account_account AS account " \
@@ -122,11 +96,25 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
res = self.cr.dictfetchall()
for res_line in res:
- partner_to_use.append(res_line['partner_id'])
+ partner_to_use.append(res_line['partner_id'])
new_ids = partner_to_use
self.partner_ids = new_ids
objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids)
- super(third_party_ledger, self).set_context(objects, data, new_ids, report_type)
+ return super(third_party_ledger, self).set_context(objects, data, new_ids, report_type)
+
+ 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 lines(self, partner):
full_account = []
@@ -162,8 +150,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
"AND reconcile_id IS NULL " \
"AND " + self.init_query + " ",
(partner.id, tuple(self.account_ids)))
- res = self.cr.fetchall()
- return res
+ return self.cr.fetchall()
def _sum_debit_partner(self, partner):
result_tmp = 0.0
diff --git a/addons/account/wizard/account_report_aged_partner_balance.py b/addons/account/wizard/account_report_aged_partner_balance.py
index 353b7066d98..5a534c3889f 100644
--- a/addons/account/wizard/account_report_aged_partner_balance.py
+++ b/addons/account/wizard/account_report_aged_partner_balance.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
import time
import datetime
from mx.DateTime import *
diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py
index 5e7cecfc6fd..8398731cc5f 100644
--- a/addons/account/wizard/account_report_balance_sheet.py
+++ b/addons/account/wizard/account_report_balance_sheet.py
@@ -63,13 +63,13 @@ class account_bs_report(osv.osv_memory):
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet.horizontal',
'datas': data,
- }
+ }
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balancesheet',
'datas': data,
- }
+ }
account_bs_report()
diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py
index 17403a55c9a..0faae862420 100644
--- a/addons/account/wizard/account_report_common.py
+++ b/addons/account/wizard/account_report_common.py
@@ -26,7 +26,6 @@ from lxml import etree
from osv import fields, osv
from tools.translate import _
-import tools
class account_common_report(osv.osv_memory):
_name = "account.common.report"
@@ -82,7 +81,7 @@ class account_common_report(osv.osv_memory):
'journal_ids': _get_all_journal,
'filter': 'filter_no',
'chart_account_id': _get_account,
- }
+ }
def _build_periods(self, cr, uid, period_from, period_to):
period_obj = self.pool.get('account.period')
diff --git a/addons/account/wizard/account_report_common_journal.py b/addons/account/wizard/account_report_common_journal.py
index abe6e48a51e..edc7776cdc1 100644
--- a/addons/account/wizard/account_report_common_journal.py
+++ b/addons/account/wizard/account_report_common_journal.py
@@ -26,7 +26,7 @@ class account_common_journal_report(osv.osv_memory):
_description = 'Account Common Journal Report'
_inherit = "account.common.report"
_columns = {
- 'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
+ 'amount_currency': fields.boolean("With Currency", help="Print Report with the currency column if the currency is different then the company currency"),
}
def _build_context(self, cr, uid, ids, data, context=None):
diff --git a/addons/account/wizard/account_report_common_view.xml b/addons/account/wizard/account_report_common_view.xml
index 5c31ff6c2a9..528b6132834 100644
--- a/addons/account/wizard/account_report_common_view.xml
+++ b/addons/account/wizard/account_report_common_view.xml
@@ -9,31 +9,31 @@