Company [[ data['model']=='account.account' or removeParentNode('para') ]]
+ [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]]
Fiscal Year
-
- End Date
-
-
- Start Date
-
Display Account
- Periods
+ Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
+
+ Printing Date
-
-
- [[ get_fiscalyear(data['form']) ]]
+ [[ get_account(data) or '' ]]
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
+ Start Date
+
+
+ End Date
+
+
+
+
+ [[ get_start_date(data) ]]
+
+
+ [[ get_end_date(data) ]]
+
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
+ Start Period
+
+
+ End Period
+
+
+
+
+ [[ get_start_period(data) or removeParentNode('para') ]]
+
+
+ [[ get_end_period(data) or removeParentNode('para') ]]
+
+
+
- [[ data['form']['date_to'] ]]
-
-
- [[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_mouvement' and 'With movements') or 'With balance is not equal to 0']]
-
-
- [[data['form']['periods'] and get_periods(data['form']) or '']]
+ [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True)]]
-
-
-
-
-
-
+
+
+
+
+
+
+
Code
Account
@@ -224,5 +299,8 @@
[[ (a['level']>2 and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['balance']) ]][[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['balance']) ]]
+
+
+
-
+
\ No newline at end of file
diff --git a/addons/account/report/report_bs.py b/addons/account/report/account_balance_sheet.py
similarity index 69%
rename from addons/account/report/report_bs.py
rename to addons/account/report/account_balance_sheet.py
index 04fafd7ed30..08df077c779 100644
--- a/addons/account/report/report_bs.py
+++ b/addons/account/report/account_balance_sheet.py
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL ().
#
@@ -15,65 +15,76 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
-import pooler
import time
-import mx.DateTime
+
+import pooler
import rml_parse
from report import report_sxw
-from account.report import report_pl
+from account.report import account_profit_loss
+from common_report_header import common_report_header
-class report_balancesheet_horizontal(rml_parse.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context)
- self.obj_pl=report_pl.report_pl_account_horizontal(cr, uid, name, context)
- self.result_sum_dr=0.0
- self.result_sum_cr=0.0
+class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
+ def __init__(self, cr, uid, name, context=None):
+ super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context=context)
+ self.obj_pl = account_profit_loss.report_pl_account_horizontal(cr, uid, name, context=context)
+ self.result_sum_dr = 0.0
+ self.result_sum_cr = 0.0
self.result = {}
- self.res_pl={}
- self.result_temp=[]
+ self.res_bl = {}
+ self.result_temp = []
self.localcontext.update({
'time': time,
'get_abs' : self.get_abs,
'get_lines' : self.get_lines,
'get_lines_another' : self.get_lines_another,
- 'get_company': self.get_company,
+ 'get_company': self._get_company,
'get_currency': self._get_currency,
'sum_dr' : self.sum_dr,
'sum_cr' : self.sum_cr,
'get_data':self.get_data,
'get_pl_balance':self.get_pl_balance,
-
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_sortby': self._get_sortby,
+ 'get_filter': self._get_filter,
+ 'get_journal': self._get_journal,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'get_company':self._get_company,
+
})
self.context = context
def get_abs(self,amount):
return abs(amount)
-
+
def sum_dr(self):
- if self.res_pl['type'] == 'Net Profit':
- self.result_sum_dr += self.res_pl['balance']
+ if self.res_bl['type'] == 'Net Profit':
+ self.result_sum_dr += self.res_bl['balance']
return self.result_sum_dr or 0.0
-
+
def sum_cr(self):
- if self.res_pl['type'] == 'Net Loss':
- self.result_sum_cr += self.res_pl['balance']
+ if self.res_bl['type'] == 'Net Loss':
+ self.result_sum_cr += self.res_bl['balance']
return self.result_sum_cr or 0.0
def get_pl_balance(self):
- return self.res_pl or 0.0
-
- def get_data(self,form):
+ return self.res_bl or 0.0
+
+ def get_data(self,data):
cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
-
+
#Getting Profit or Loss Balance from profit and Loss report
- result_pl=self.obj_pl.get_data(form)
- self.res_pl=self.obj_pl.final_result()
-
+ result_pl=self.obj_pl.get_data(data)
+ self.res_bl = self.obj_pl.final_result()
+
type_pool = db_pool.get('account.account.type')
account_pool = db_pool.get('account.account')
year_pool = db_pool.get('account.fiscalyear')
@@ -84,34 +95,31 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
]
ctx = self.context.copy()
- ctx['state'] = form['context'].get('state','all')
- ctx['fiscalyear'] = form['fiscalyear']
- if form['state']=='byperiod' :
- ctx['periods'] = form['periods']
- elif form['state']== 'bydate':
- ctx['date_from'] = form['date_from']
- ctx['date_to'] = form['date_to']
- elif form['state'] == 'all' :
- ctx['periods'] = form['periods']
- ctx['date_from'] = form['date_from']
- ctx['date_to'] = form['date_to']
+# ctx['state'] = form['context'].get('state','filter_no')
+ ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
- cal_list={}
+ if data['form']['filter'] == 'filter_period' :
+ ctx['periods'] = data['form'].get('periods', False)
+ elif data['form']['filter'] == 'filter_date':
+ ctx['date_from'] = data['form'].get('date_from', False)
+ ctx['date_to'] = data['form'].get('date_to', False)
+
+ cal_list = {}
pl_dict = {}
account_dict = {}
- account_id = [form['Account_list']]
+ account_id = data['form'].get('chart_account_id', False)
account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx)
accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
- if self.res_pl['type'] == 'Net Profit C.F.B.L.':
- self.res_pl['type'] = 'Net Profit'
+ if self.res_bl['type'] == 'Net Profit C.F.B.L.':
+ self.res_bl['type'] = 'Net Profit'
else:
- self.res_pl['type'] = 'Net Loss'
+ self.res_bl['type'] = 'Net Loss'
pl_dict = {
'code' : False,
- 'name' : self.res_pl['type'],
+ 'name' : self.res_bl['type'],
'level': False,
- 'balance':self.res_pl['balance'],
+ 'balance':self.res_bl['balance'],
}
for typ in types:
accounts_temp = []
@@ -128,23 +136,23 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
self.result_sum_dr += abs(account.debit - account.credit)
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += abs(account.debit - account.credit)
- if form['display_account'] == 'bal_mouvement':
+ if data['form']['display_account'] == 'bal_movement':
if account.credit > 0 or account.debit > 0 or account.balance > 0 :
accounts_temp.append(account_dict)
- elif form['display_account'] == 'bal_solde':
- if account.balance != 0:
+ elif data['form']['display_account'] == 'bal_solde':
+ if account.balance != 0:
accounts_temp.append(account_dict)
else:
accounts_temp.append(account_dict)
- if account.id == form['reserve_account_id']:
+ if account.id == data['form']['reserve_account_id']:
pl_dict['level'] = account['level'] + 1
accounts_temp.append(pl_dict)
-
+
self.result[typ] = accounts_temp
cal_list[typ]=self.result[typ]
if cal_list:
- temp={}
+ temp = {}
for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))):
if i < len(cal_list['liability']) and i < len(cal_list['asset']):
temp={
@@ -171,7 +179,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
'balance1':cal_list['asset'][i]['balance'],
}
self.result_temp.append(temp)
- if i < len(cal_list['liability']):
+ if i < len(cal_list['liability']):
temp={
'code' : cal_list['liability'][i]['code'],
'name' : cal_list['liability'][i]['name'],
@@ -184,24 +192,19 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
}
self.result_temp.append(temp)
return None
-
+
def get_lines(self):
return self.result_temp
def get_lines_another(self, group):
return self.result.get(group, [])
-
- 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.code
-
- def get_company(self,form):
- comp_obj=pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr,self.uid,form['company_id'])
- return comp_obj.name
report_sxw.report_sxw('report.account.balancesheet.horizontal', 'account.account',
- 'addons/account/report/report_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
- header=False)
+ 'addons/account/report/account_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
+ header='internal')
report_sxw.report_sxw('report.account.balancesheet', 'account.account',
- 'addons/account/report/report_balance_sheet.rml',parser=report_balancesheet_horizontal,
- header=False)
+ 'addons/account/report/account_balance_sheet.rml',parser=report_balancesheet_horizontal,
+ header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/report/report_balance_sheet.rml b/addons/account/report/account_balance_sheet.rml
similarity index 70%
rename from addons/account/report/report_balance_sheet.rml
rename to addons/account/report/account_balance_sheet.rml
index 20f52cdd2f2..5ab769d6625 100644
--- a/addons/account/report/report_balance_sheet.rml
+++ b/addons/account/report/account_balance_sheet.rml
@@ -1,6 +1,6 @@
-
+
@@ -77,13 +77,10 @@
-
-
-
-
-
+
+
@@ -91,12 +88,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -143,10 +164,13 @@
- From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]
-
+
Chart of Account
+
Fiscal Year
+
Filter By [[ get_filter(data)!='No Filter' and '' or removeParentNode('font') ]]
+
Display Account
+
Printing Date
-
-
- [[ get_data(data['form']) ]]
-
-
-
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data)]]
+
[[get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
+
+
+
+
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']]
- From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]
-
+
Chart of Account
+
Fiscal Year
+
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
Display Account
+
Printing Date
-
-
- [[ get_data(data['form']) ]]
-
-
-
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data)]]
+
[[get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
+
+
+
+
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']]
[[ sum_cr() and formatLang(get_abs(sum_cr())) or 0.0 ]]
-
-
+
+
diff --git a/addons/account/report/account_central_journal.py b/addons/account/report/account_central_journal.py
new file mode 100644
index 00000000000..440460ce1f3
--- /dev/null
+++ b/addons/account/report/account_central_journal.py
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import time
+
+from report import report_sxw
+from common_report_header import common_report_header
+#
+# 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):
+ if context is None:
+ context = {}
+ super(journal_print, self).__init__(cr, uid, name, context=context)
+ self.period_ids = []
+ self.journal_ids = []
+ self.localcontext.update({
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'get_filter': self._get_filter,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_sortby': self._get_sortby,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'display_currency':self._display_currency,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ self.query_get_clause = ''
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
+ self.query_get_clause = 'AND '
+ self.query_get_clause += data['form']['query_line'] or ''
+ objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
+ if new_ids:
+ self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
+ res = self.cr.fetchall()
+ self.period_ids, self.journal_ids = zip(*res)
+ return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
+
+ def lines(self, period_id, journal_id):
+ self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code,l.currency_id ,l.amount_currency ,SUM(debit) AS debit, SUM(credit) AS credit from account_move_line l LEFT JOIN account_account a ON (l.account_id=a.id) LEFT JOIN res_currency c on (l.currency_id=c.id)WHERE l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code , a.currency_id,l.currency_id', (period_id, journal_id))
+ 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))
+ result = self.cr.fetchone()
+ if result:
+ self.account_currency = result[0]
+ else:
+ self.account_currency = False
+
+ def _get_account(self, data):
+ 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':
+ 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)
+
+ def _display_currency(self, data):
+ if data['model'] == 'account.journal.period':
+ return True
+ return data['form']['amount_currency']
+
+report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/account_central_journal.rml', parser=journal_print, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml
new file mode 100644
index 00000000000..816afa59cb8
--- /dev/null
+++ b/addons/account/report/account_central_journal.rml
@@ -0,0 +1,353 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ repeatIn(objects, 'o') ]]
+
+
+
+
+
Central Journal
+
+
+
+
+
+
+
+
+
Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]]
+ Chart of Account [[ data['model']=='ir.ui.menu' or removeParentNode('para') ]]
+
Fiscal Year
+
Journal
+
Filter By [[get_filter(data)!='No Filter' and get_filter(data) ]]
+
Printing Date
+
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[o.journal_id.name ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data) ]]
+
[[ get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
+
+ [[ display_currency(data) or removeParentNode('blockTable') ]]
+
+
[[ line['code'] ]]
+
[[ line['name'] ]]
+
[[ formatLang(line['debit']) ]]
+
[[ formatLang(line['credit'])]]
+
[[ formatLang(line['credit']-line['debit']) ]]
+
[[ line['currency_id'] and formatLang(line['amount_currency'] or '') ]] [[ line['currency_id'] and line['currency_code'] or '']]
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml
index 2f597a4c48b..dc21c20fd2d 100644
--- a/addons/account/report/account_entries_report_view.xml
+++ b/addons/account/report/account_entries_report_view.xml
@@ -14,6 +14,7 @@
+
@@ -22,13 +23,12 @@
-
+
-
+
+
+
-
-
-
@@ -38,8 +38,8 @@
graph
-
-
+
+
@@ -82,21 +82,28 @@
+
+
-
+
+
+
+
+
+
-
-
-
+
+
+
@@ -107,13 +114,14 @@
+
- Accounting Analysis
+ Entries Analysisaccount.entries.reportformtree,graph
diff --git a/addons/account/report/account_general_journal.py b/addons/account/report/account_general_journal.py
new file mode 100644
index 00000000000..8cd3dad05ba
--- /dev/null
+++ b/addons/account/report/account_general_journal.py
@@ -0,0 +1,147 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import time
+
+from common_report_header import common_report_header
+from report import report_sxw
+
+class journal_print(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(journal_print, self).__init__(cr, uid, name, context=context)
+ self.period_ids = []
+ self.journal_ids = []
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'periods': self.periods,
+ 'sum_debit_period': self._sum_debit_period,
+ 'sum_credit_period': self._sum_credit_period,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_sortby': self._get_sortby,
+ 'get_filter': self._get_filter,
+ 'get_journal': self._get_journal,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'display_currency':self._display_currency
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ self.query_get_clause = ''
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
+ self.query_get_clause = 'AND '
+ self.query_get_clause += data['form']['query_line'] or ''
+ objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
+ if new_ids:
+ self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
+ res = self.cr.fetchall()
+ self.period_ids, self.journal_ids = zip(*res)
+ return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
+
+ # returns a list of period objs
+ def periods(self, journal_period_objs):
+ dic = {}
+ def filter_unique(o):
+ key = o.period_id.id
+ res = key in dic
+ if not res:
+ dic[key] = True
+ return not res
+ filtered_objs = filter(filter_unique, journal_period_objs)
+ return map(lambda x: x.period_id, filtered_objs)
+
+ def lines(self, period_id):
+ if not self.journal_ids:
+ return []
+ self.cr.execute('SELECT j.code, j.name, l.amount_currency,c.code AS currency_code,l.currency_id , '
+ 'SUM(l.debit) AS debit, SUM(l.credit) AS credit '
+ '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 ',
+ (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))
+ result = self.cr.fetchone()
+ if result:
+ self.account_currency = result[0]
+ else:
+ self.account_currency = False
+
+ def _get_account(self, data):
+ 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':
+ 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)
+
+ def _display_currency(self, data):
+ if data['model'] == 'account.journal.period':
+ return True
+ return data['form']['amount_currency']
+
+ def _sum_debit_period(self, period_id, journal_id=False):
+ if journal_id:
+ journals = [journal_id]
+ else:
+ journals = self.journal_ids
+ if not journals:
+ return 0.0
+ self.cr.execute('SELECT SUM(debit) FROM account_move_line l '
+ 'WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ' ' \
+ 'AND state<>\'draft\'',
+ (period_id, tuple(journals)))
+ return self.cr.fetchone()[0] or 0.0
+
+ def _sum_credit_period(self, period_id, journal_id=None):
+ if journal_id:
+ journals = [journal_id]
+ else:
+ journals = self.journal_ids
+ if not journals:
+ return 0.0
+ self.cr.execute('SELECT SUM(credit) FROM account_move_line l '
+ 'WHERE period_id=%s AND journal_id IN %s '+ self.query_get_clause + ' ' \
+ 'AND state<>\'draft\'',
+ (period_id, tuple(journals)))
+ return self.cr.fetchone()[0] or 0.0
+
+report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml', parser=journal_print, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml
new file mode 100644
index 00000000000..77f750196d4
--- /dev/null
+++ b/addons/account/report/account_general_journal.rml
@@ -0,0 +1,391 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ repeatIn( periods(objects), 'o') ]]
+
+
+
+
+
+
+
+
+
+
+
+ General Journal
+
+
+
+
+
+
+
+
+
+
+
Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]]
+ Chart of Account [[ data['model']=='ir.ui.menu' or removeParentNode('para') ]]
+
Fiscal Year
+
Journals
+
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
Printing Date
+
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data)]]
+
[[get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
[[ line['currency_id'] and formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]]
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
new file mode 100644
index 00000000000..a92c1ba7f51
--- /dev/null
+++ b/addons/account/report/account_general_ledger.py
@@ -0,0 +1,245 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2005-2006 CamptoCamp
+# Copyright (c) 2006-2010 OpenERP S.A
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+import time
+
+from report import report_sxw
+from common_report_header import common_report_header
+import rml_parse
+
+class general_ledger(rml_parse.rml_parse, common_report_header):
+ _name = 'report.account.general.ledger'
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ self.sortby = data['form'].get('sortby', 'sort_date')
+ self.query = data['form'].get('query_line', '')
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = [data['form']['chart_account_id']]
+ objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
+ return super(general_ledger, self).set_context(objects, data, new_ids, report_type=report_type)
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(general_ledger, self).__init__(cr, uid, name, context=context)
+ self.query = ""
+ self.tot_currency = 0.0
+ self.period_sql = ""
+ self.sold_accounts = {}
+ self.sortby = 'sort_date'
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit_account': self._sum_debit_account,
+ 'sum_credit_account': self._sum_credit_account,
+ 'sum_balance_account': self._sum_balance_account,
+ 'sum_currency_amount_account': self._sum_currency_amount_account,
+ 'get_children_accounts': self.get_children_accounts,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_journal': self._get_journal,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_filter': self._get_filter,
+ 'get_sortby': self._get_sortby,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ })
+ self.context = context
+
+ def _sum_currency_amount_account(self, account, form):
+ 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))
+ sum_currency = self.cr.fetchone()[0] or 0.0
+ if form.get('initial_balance', False):
+ 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']))
+ sum_currency += self.cr.fetchone()[0] or 0.0
+ return str(sum_currency)
+
+ def get_children_accounts(self, account, form):
+ res = []
+ ids_acc = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id)
+ for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc):
+ sql = """
+ SELECT count(id)
+ FROM account_move_line AS l
+ WHERE %s AND l.account_id = %%s
+ """ % (self.query)
+ self.cr.execute(sql, (child_account.id,))
+ num_entry = self.cr.fetchone()[0] or 0
+ sold_account = self._sum_balance_account(child_account,form)
+ self.sold_accounts[child_account.id] = sold_account
+ if form['display_account'] == 'bal_movement':
+ if child_account.type != 'view' and num_entry <> 0 :
+ res.append(child_account)
+ elif form['display_account'] == 'bal_solde':
+ if child_account.type != 'view' and num_entry <> 0 :
+ if ( sold_account <> 0.0):
+ res.append(child_account)
+ else:
+ res.append(child_account)
+ if not len(res):
+ return [account]
+ return res
+
+ def lines(self, account, form):
+ """ Return all the account_move_line of account with their account code counterparts """
+ # First compute all counterpart strings for every move_id where this account appear.
+ # Currently, the counterpart info is used only in landscape mode
+ sql = """
+ SELECT m1.move_id,
+ array_to_string(ARRAY(SELECT DISTINCT a.code FROM account_move_line m2 LEFT JOIN account_account a ON (m2.account_id=a.id) WHERE m2.move_id = m1.move_id AND m2.account_id<>%%s), ', ') AS counterpart
+ FROM (SELECT move_id FROM account_move_line l WHERE %s AND l.account_id = %%s GROUP BY move_id) m1
+ """ % self.query
+ self.cr.execute(sql, (account.id, account.id))
+ counterpart_res = self.cr.dictfetchall()
+ counterpart_accounts = {}
+ for i in counterpart_res:
+ counterpart_accounts[i['move_id']]=i['counterpart']
+ del counterpart_res
+
+ # Then select all account_move_line of this account
+ if self.sortby == 'sort_journal_partner':
+ sql_sort='j.code, p.name'
+ else:
+ sql_sort='l.date'
+ sql = """
+ SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id,
+ m.name AS move_name, m.id AS mmove_id,
+ c.code AS currency_code,
+ i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number,
+ p.name AS partner_name
+ FROM account_move_line l
+ LEFT JOIN account_move m on (l.move_id=m.id)
+ LEFT JOIN res_currency c on (l.currency_id=c.id)
+ LEFT JOIN res_partner p on (l.partner_id=p.id)
+ LEFT JOIN account_invoice i on (m.id =i.move_id)
+ JOIN account_journal j on (l.journal_id=j.id)
+ WHERE %s AND l.account_id = %%s ORDER by %s
+ """ % (self.query, sql_sort)
+ self.cr.execute(sql, (account.id,))
+ res_lines = self.cr.dictfetchall()
+ res_init = []
+ if res_lines and form['initial_balance']:
+ #FIXME: replace the label of lname with a string translatable
+ sql = """
+ SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
+ '' AS move_name, '' AS mmove_id,
+ '' AS currency_code,
+ '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,
+ '' AS partner_name
+ FROM account_move_line l
+ LEFT JOIN account_move m on (l.move_id=m.id)
+ LEFT JOIN res_currency c on (l.currency_id=c.id)
+ LEFT JOIN res_partner p on (l.partner_id=p.id)
+ LEFT JOIN account_invoice i on (m.id =i.move_id)
+ JOIN account_journal j on (l.journal_id=j.id)
+ WHERE %s AND l.account_id = %%s
+ """ %(form['initial_bal_query'])
+
+ self.cr.execute(sql, (account.id,))
+ res_init = self.cr.dictfetchall()
+ res = res_init + res_lines
+ account_sum = 0.0
+ inv_types = { 'out_invoice': 'CI', 'in_invoice': 'SI', 'out_refund': 'OR', 'in_refund': 'SR', }
+ for l in res:
+ l['move'] = l['move_name']
+ if l['invoice_id']:
+ l['lref'] = '%s: %s'%(inv_types[l['invoice_type']], l['invoice_number'])
+ l['partner'] = l['partner_name'] or ''
+ account_sum += l['debit'] - l['credit']
+ l['progress'] = account_sum
+ l['line_corresp'] = l['mmove_id'] == '' and ' ' or counterpart_accounts[l['mmove_id']]
+ # Modification of amount Currency
+ if l['credit'] > 0:
+ if l['amount_currency'] != None:
+ l['amount_currency'] = abs(l['amount_currency']) * -1
+ if l['amount_currency'] != None:
+ self.tot_currency = self.tot_currency + l['amount_currency']
+ return res
+
+ def _sum_debit_account(self, account, form):
+ self.cr.execute("SELECT sum(debit) "\
+ "FROM account_move_line l "\
+ "WHERE l.account_id = %s AND %s "%(account.id, self.query))
+ sum_debit = self.cr.fetchone()[0] or 0.0
+ if form.get('initial_balance', False):
+ self.cr.execute("SELECT sum(debit) "\
+ "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_debit += self.cr.fetchone()[0] or 0.0
+ return sum_debit
+
+ def _sum_credit_account(self, account, form):
+ self.cr.execute("SELECT sum(credit) "\
+ "FROM account_move_line l "\
+ "WHERE l.account_id = %s AND %s "%(account.id, self.query))
+ sum_credit = self.cr.fetchone()[0] or 0.0
+ if form.get('initial_balance', False):
+ self.cr.execute("SELECT sum(credit) "\
+ "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_credit += self.cr.fetchone()[0] or 0.0
+ return sum_credit
+
+ def _sum_balance_account(self, account, form):
+ self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_balance "\
+ "FROM account_move_line l "\
+ "WHERE l.account_id = %s AND %s"%(account.id, self.query))
+ sum_balance = self.cr.fetchone()[0] or 0.0
+ if form.get('initial_balance', False):
+ self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_balance "\
+ "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_balance += self.cr.fetchone()[0] or 0.0
+ return sum_balance
+
+ def _get_account(self, data):
+ if data['model'] == 'account.account':
+ return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
+ return super(general_ledger ,self)._get_account(data)
+
+ def _get_sortby(self, data):
+ if self.sortby == 'sort_date':
+ return 'Date'
+ elif self.sortby == 'sort_journal_partner':
+ return 'Journal & Partner'
+ return 'Date'
+
+report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/account_general_ledger.rml', parser=general_ledger, header='internal')
+report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/account_general_ledger_landscape.rml', parser=general_ledger, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml
new file mode 100644
index 00000000000..ee6f35c0389
--- /dev/null
+++ b/addons/account/report/account_general_ledger.rml
@@ -0,0 +1,344 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ General Ledger
+
+
+
+
+
+
+ [[ repeatIn(objects, 'a') ]]
+
+
+
Chart Account
+
Fiscal Year
+
Journals
+
Display Account
+
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
Entries Sorted By
+
Printing Date
+
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
+
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data) ]]
+
[[get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
Company [[ data['model']=='account.account' or removeParentNode('para') ]]
+ Chart of Account [[ data['model']=='ir.ui.menu' or removeParentNode('para') ]]
+
Fiscal Year
+
Journals
+
Display Account
+
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
Entries Sorted By
+
Printing Date
+
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
+
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']]
+
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data) ]]
+
[[get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
[[ repeatIn(lines(o, data['form']), 'line') ]][[ line['ldate'] and formatLang(line['ldate'],date=True) or removeParentNode('tr') ]]
+ [[ line or removeParentNode('tr')
+
[[ line['lcode'] ]]
+
[[ line['partner'] ]]
+
[[ line['lref'] ]]
+
[[ line['move'] ]]
+
[[ line['lname'] ]]
+
[[ strip_name(line['line_corresp'],15) ]]
+
[[ formatLang(line['debit']) ]]
+
[[ formatLang(line['credit']) ]]
+
[[ formatLang(line['progress']) ]]
+
+
+
+
+
+
diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml
index 49d2080d56c..2bd3018ff7c 100644
--- a/addons/account/report/account_invoice_report_view.xml
+++ b/addons/account/report/account_invoice_report_view.xml
@@ -113,7 +113,7 @@
-
+
diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py
index eaa3366ce47..1ed15f60b6f 100644
--- a/addons/account/report/account_journal.py
+++ b/addons/account/report/account_journal.py
@@ -21,54 +21,95 @@
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):
- def __init__(self, cr, uid, name, context={}):
+class journal_print(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
super(journal_print, self).__init__(cr, uid, name, context=context)
- self.localcontext.update( {
+ self.period_ids = []
+ self.journal_ids = []
+ self.sort_selection = 'date'
+ self.localcontext.update({
'time': time,
'lines': self.lines,
'sum_debit': self._sum_debit,
- 'sum_credit': self._sum_credit
- })
+ 'sum_credit': self._sum_credit,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_account': self._get_account,
+ 'get_filter': self._get_filter,
+ 'get_start_date': self._get_start_date,
+ 'get_end_date': self._get_end_date,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'display_currency':self._display_currency,
+ 'get_sortby': self._get_sortby,
+ })
- def lines(self, period_id, journal_id, sort_selection='date', *args):
- obj_jperiod = self.pool.get('account.journal.period')
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ self.query_get_clause = ''
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = data['form'].get('active_ids', [])
+ self.query_get_clause = 'AND '
+ self.query_get_clause += data['form'].get('query_line', '')
+ self.sort_selection = data['form'].get('sort_selection', 'date')
+ objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
+ if new_ids:
+ self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
+ res = self.cr.fetchall()
+ self.period_ids, self.journal_ids = zip(*res)
+ return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
+
+ def lines(self, period_id, journal_id=False):
+ if not journal_id:
+ journal_id = self.journal_ids
+ else:
+ journal_id = [journal_id]
obj_mline = self.pool.get('account.move.line')
- if type(period_id) == type([]):
- ids_final = []
- for journal in journal_id:
- for period in period_id:
- ids_journal_period = obj_jperiod.search(self.cr, self.uid, [('journal_id','=',journal), ('period_id','=',period)])
- if ids_journal_period:
- self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal,period,'draft'))
- self.cr.execute('select id from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\' order by ('+ sort_selection +'),id', (period, journal))
- ids = map(lambda x: x[0], self.cr.fetchall())
- ids_final.append(ids)
- line_ids = []
- for line_id in ids_final:
- a = obj_mline.browse(self.cr, self.uid, line_id)
- line_ids.append(a)
- return line_ids
- self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal_id,period_id,'draft'))
- self.cr.execute('select id from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\' order by date,id', (period_id, journal_id))
+ self.cr.execute('update account_journal_period set state=%s where journal_id IN %s and period_id=%s and state=%s', ('printed', self.journal_ids, period_id, 'draft'))
+ self.cr.commit()
+ self.cr.execute('SELECT id FROM account_move_line l WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ' ORDER BY '+ self.sort_selection + '' ,(period_id, tuple(journal_id) ))
ids = map(lambda x: x[0], self.cr.fetchall())
return obj_mline.browse(self.cr, self.uid, ids)
- def _sum_debit(self, period_id, journal_id):
- self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id))
- return self.cr.fetchone()[0] or 0.0
+ def _set_get_account_currency_code(self, account_id):
+ self.cr.execute("SELECT c.code AS code "\
+ "FROM res_currency c,account_account AS ac "\
+ "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id))
+ result = self.cr.fetchone()
+ if result:
+ self.account_currency = result[0]
+ else:
+ self.account_currency = False
- def _sum_credit(self, period_id, journal_id):
- self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id))
- return self.cr.fetchone()[0] or 0.0
+ def _get_fiscalyear(self, data):
+ 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)
-report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header=False)
-report_sxw.report_sxw('report.account.journal.period.print.wiz', 'account.journal.period', 'addons/account/report/wizard_account_journal.rml', parser=journal_print, header=False)
+ def _get_account(self, data):
+ 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)
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ def _display_currency(self, data):
+ if data['model'] == 'account.journal.period':
+ return True
+ return data['form']['amount_currency']
+ def _get_sortby(self, data):
+ if self.sort_selection == 'date':
+ return 'Date'
+ elif self.sort_selection == 'ref':
+ return 'Reference Number'
+ return 'Date'
+
+report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml
index 2c8036ca82f..a308331a8fd 100644
--- a/addons/account/report/account_journal.rml
+++ b/addons/account/report/account_journal.rml
@@ -1,42 +1,18 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
- [[ company.name ]]
- Print Journal - [[ company.currency_id.name ]]
-
-
-
-
-
-
- [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]
- Page
-
-
-
-
- 1cm 27.7cm 20cm 27.7cm
-
-
+
+
+
+
@@ -53,15 +29,104 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -75,9 +140,9 @@
-
-
-
+
+
+
@@ -103,22 +168,88 @@
-
+
-
+
+
+
+ [[ repeatIn(objects, 'o') ]]
-
+
+
+
+
+
+
+ Print Journal
+
+
+
+
+
+
+
+
+
+
+
+
+
Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]]
+ Chart of Account [[ data['model']=='ir.ui.menu' or removeParentNode('para') ]]
+
Fiscal Year
+
Journal
+
Filters By
+
Entries Sorted By
+
Printing Date
+
+
+
[[ get_account(data) or '' ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[o.journal_id.name ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data) ]]
+
[[ get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
[[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.code or '']]
+
-
\ No newline at end of file
+
diff --git a/addons/account/report/account_partner_balance.py b/addons/account/report/account_partner_balance.py
new file mode 100644
index 00000000000..55c9d7b89cc
--- /dev/null
+++ b/addons/account/report/account_partner_balance.py
@@ -0,0 +1,471 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import time
+import re
+import copy
+
+from report import report_sxw
+from common_report_header import common_report_header
+
+class partner_balance(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(partner_balance, self).__init__(cr, uid, name, context=context)
+ self.account_ids = []
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'sum_litige': self._sum_litige,
+ 'sum_sdebit': self._sum_sdebit,
+ 'sum_scredit': self._sum_scredit,
+ 'solde_debit': self._solde_balance_debit,
+ 'solde_credit': self._solde_balance_credit,
+ 'get_currency': self._get_currency,
+ 'comma_me' : self.comma_me,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_periods':self.get_periods,
+ 'get_journal': self._get_journal,
+ 'get_filter': self._get_filter,
+ 'get_account': self._get_account,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_partners':self._get_partners,
+ })
+ ## Compute account list one time
+ #
+ # Date Management
+ #
+
+ def get_periods(self, form):
+ result = ''
+ if form.has_key('periods') and form['periods']:
+ period_ids = form['periods']
+ 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 + ". "
+ else:
+ result += r.name + ", "
+ else:
+ fy_obj = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear'])
+ res = fy_obj.period_ids
+ len_res = len(res)
+ for r in res:
+ if r == res[len_res-1]:
+ result += r.name + ". "
+ else:
+ result += r.name + ", "
+ return str(result and result[:-1]) or 'ALL'
+
+ 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 set_context(self, objects, data, ids, report_type=None):
+ ## Compute Code
+ #
+ 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 (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 " \
+ "ON (a.type = t.code) " \
+ "WHERE a.type IN %s " \
+ "AND a.active", (self.ACCOUNT_TYPE,))
+ self.account_ids = [a for (a,) in self.cr.fetchall()]
+ return super(partner_balance, self).set_context(objects, data, ids, report_type=report_type)
+
+ def lines(self):
+ full_account = []
+ result_tmp = 0.0
+ self.cr.execute(
+ "SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code ,p.name, sum(debit) AS debit, sum(credit) AS credit, " \
+ "CASE WHEN sum(debit) > sum(credit) " \
+ "THEN sum(debit) - sum(credit) " \
+ "ELSE 0 " \
+ "END AS sdebit, " \
+ "CASE WHEN sum(debit) < sum(credit) " \
+ "THEN sum(credit) - sum(debit) " \
+ "ELSE 0 " \
+ "END AS scredit, " \
+ "(SELECT sum(debit-credit) " \
+ "FROM account_move_line l " \
+ "WHERE partner_id = p.id " \
+ "AND " + self.query + " " \
+ "AND blocked = TRUE " \
+ ") AS enlitige " \
+ "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 + "" \
+ "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,))
+ res = self.cr.dictfetchall()
+
+ #For include intial balance..
+ if self.initial_balance:
+ self.cr.execute(
+ "SELECT '1' AS type, '' AS ref, l.account_id AS account_id, '' AS account_name, '' AS code, '' AS name, sum(debit) AS debit, sum(credit) AS credit, " \
+ "CASE WHEN sum(debit) > sum(credit) " \
+ "THEN sum(debit) - sum(credit) " \
+ "ELSE 0 " \
+ "END AS sdebit, " \
+ "CASE WHEN sum(debit) < sum(credit) " \
+ "THEN sum(credit) - sum(debit) " \
+ "ELSE 0 " \
+ "END AS scredit, " \
+ "(SELECT sum(debit-credit) " \
+ "FROM account_move_line l " \
+ "WHERE partner_id = p.id " \
+ " AND " + self.init_query + " " \
+ "AND blocked = TRUE " \
+ ") AS enlitige " \
+ "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.init_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, ))
+ res1 = self.cr.dictfetchall()
+ final_init = {}
+ res_init = {}
+ debit = credit = 0
+ for r in res1:
+ if final_init.get(r['account_id'], False):
+ res_init = final_init[r['account_id']]
+ debit += final_init[r['account_id']]['debit']
+ credit += final_init[r['account_id']]['credit']
+ res_init['credit'] = credit
+ res_init['debit'] = debit
+ res_init['type'] = 3
+ res_init['ref'] = ''
+ res_init['code'] = ''
+ res_init['name'] = 'Initial Balance'
+ res_init['balance'] = debit - credit
+ res_init['enlitige'] = 0.0 # fix me
+ res_init['account_id'] = final_init[r['account_id']]['account_id']
+ else:
+ res_init = {}
+ debit = r['debit']
+ credit = r['credit']
+ res_init['credit'] = credit
+ res_init['debit'] = debit
+ res_init['type'] = 3
+ res_init['ref'] = ''
+ res_init['code'] = ''
+ res_init['name'] = 'Initial Balance'
+ res_init['balance'] = debit - credit
+ res_init['enlitige'] = 0.0 # fix me
+ res_init['account_id'] = r['account_id']
+ final_init[r['account_id']] = res_init
+ for r in res:
+ full_account.append(r)
+
+ ## We will now compute Total
+ subtotal_row = self._add_subtotal(full_account)
+ if not self.initial_balance:
+ return subtotal_row
+
+ #If include initial balance is selected..
+ subtotal = copy.deepcopy(subtotal_row)
+ init_acnt = []
+ for row in subtotal_row:
+ if final_init and row.get('account_id', False) and not row['account_id'] in init_acnt and final_init.get(row['account_id'], False):
+ subtotal.insert(subtotal.index(row), final_init[row['account_id']])
+ init_acnt.append(row['account_id'])
+ return subtotal
+
+ def _add_subtotal(self, cleanarray):
+ i = 0
+ completearray = []
+ tot_debit = 0.0
+ tot_credit = 0.0
+ tot_scredit = 0.0
+ tot_sdebit = 0.0
+ tot_enlitige = 0.0
+ for r in cleanarray:
+ # For the first element we always add the line
+ # type = 1 is the line is the first of the account
+ # type = 2 is an other line of the account
+ if i==0:
+ # We add the first as the header
+ #
+ ##
+ new_header = {}
+ new_header['ref'] = ''
+ new_header['name'] = r['account_name']
+ new_header['code'] = r['code']
+ new_header['debit'] = r['credit'] #tot_credit
+ new_header['credit'] = r['debit'] #tot_debit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+ new_header['type'] = 3
+ ##
+ completearray.append(new_header)
+ #
+ r['type'] = 1
+ r['balance'] = float(r['sdebit']) - float(r['scredit'])
+
+ completearray.append(r)
+ #
+ tot_debit = r['debit']
+ tot_credit = r['credit']
+ tot_scredit = r['scredit']
+ tot_sdebit = r['sdebit']
+ tot_enlitige = (r['enlitige'] or 0.0)
+ #
+ else:
+ if cleanarray[i]['account_id'] <> cleanarray[i-1]['account_id']:
+
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+ new_header['type'] = 3
+ # we reset the counter
+ tot_debit = r['debit']
+ tot_credit = r['credit']
+ tot_scredit = r['scredit']
+ tot_sdebit = r['sdebit']
+ tot_enlitige = (r['enlitige'] or 0.0)
+ #
+ ##
+ new_header = {}
+ new_header['ref'] = ''
+ new_header['name'] = r['account_name']
+ new_header['code'] = r['code']
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+ new_header['type'] = 3
+ ##get_fiscalyear
+ ##
+
+ completearray.append(new_header)
+ ##
+ #
+ r['type'] = 1
+ #
+ r['balance'] = float(r['sdebit']) - float(r['scredit'])
+
+ completearray.append(r)
+
+ if cleanarray[i]['account_id'] == cleanarray[i-1]['account_id']:
+ # we reset the counter
+
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+ new_header['type'] = 3
+
+ tot_debit = tot_debit + r['debit']
+ tot_credit = tot_credit + r['credit']
+ tot_scredit = tot_scredit + r['scredit']
+ tot_sdebit = tot_sdebit + r['sdebit']
+ tot_enlitige = tot_enlitige + (r['enlitige'] or 0.0)
+
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+
+ #
+ r['type'] = 2
+ #
+ r['balance'] = float(r['sdebit']) - float(r['scredit'])
+ #
+
+ completearray.append(r)
+
+ i = i + 1
+ return completearray
+
+ def _sum_debit(self):
+ if not self.ids:
+ return 0.0
+ temp_res = 0.0
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s" \
+ "AND " + self.query + "" ,
+ (tuple(self.account_ids), ))
+ temp_res = float(self.cr.fetchone()[0] or 0.0)
+ if self.initial_balance:
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s " \
+ "AND " + self.init_query + "" ,
+ (tuple(self.account_ids), ))
+ temp_res += float(self.cr.fetchone()[0] or 0.0)
+ return temp_res
+
+ def _sum_credit(self):
+ if not self.ids:
+ return 0.0
+ temp_res = 0.0
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s" \
+ "AND " + self.query + "" ,
+ (tuple(self.account_ids),))
+ temp_res = float(self.cr.fetchone()[0] or 0.0)
+ if self.initial_balance:
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s " \
+ "AND " + self.init_query + "" ,
+ (tuple(self.account_ids),))
+ temp_res += float(self.cr.fetchone()[0] or 0.0)
+ return temp_res
+
+ def _sum_litige(self):
+ if not self.ids:
+ return 0.0
+ temp_res = 0.0
+ self.cr.execute(
+ "SELECT sum(debit-credit) " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s" \
+ "AND " + self.query + " " \
+ "AND l.blocked=TRUE ",
+ (tuple(self.account_ids), ))
+ temp_res = float(self.cr.fetchone()[0] or 0.0)
+ if self.initial_balance:
+ self.cr.execute(
+ "SELECT sum(debit-credit) " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s " \
+ "AND l.blocked=TRUE "\
+ "AND " + self.init_query + "" ,
+ (tuple(self.account_ids), ))
+ temp_res += float(self.cr.fetchone()[0] or 0.0)
+ return temp_res
+
+ def _sum_sdebit(self):
+ if not self.ids:
+ return 0.0
+ result_tmp = 0.0
+ a = 0.0
+ self.cr.execute(
+ "SELECT CASE WHEN sum(debit) > sum(credit) " \
+ "THEN sum(debit) - sum(credit) " \
+ "ELSE 0 " \
+ "END " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s" \
+ "AND " + self.query + " " \
+ "GROUP BY l.partner_id",
+ (tuple(self.account_ids),))
+ a = self.cr.fetchone()[0]
+
+ if self.cr.fetchone() != None:
+ result_tmp = result_tmp + (a or 0.0)
+ else:
+ result_tmp = 0.0
+ return result_tmp
+
+ def _sum_scredit(self):
+ if not self.ids:
+ return 0.0
+ result_tmp = 0.0
+ a = 0.0
+ self.cr.execute(
+ "SELECT CASE WHEN sum(debit) < sum(credit) " \
+ "THEN sum(credit) - sum(debit) " \
+ "ELSE 0 " \
+ "END " \
+ "FROM account_move_line AS l " \
+ "WHERE l.account_id IN %s" \
+ "AND " + self.query + " " \
+ "GROUP BY l.partner_id",
+ (tuple(self.account_ids), ))
+ a = self.cr.fetchone()[0] or 0.0
+ if self.cr.fetchone() != None:
+ result_tmp = result_tmp + (a or 0.0)
+ else:
+ result_tmp = 0.0
+ return result_tmp
+
+ def _solde_balance_debit(self):
+ debit, credit = self._sum_debit(), self._sum_credit()
+ return debit > credit and debit - credit
+
+ def _solde_balance_credit(self):
+ debit, credit = self._sum_debit(), self._sum_credit()
+ return credit > debit and credit - debit
+
+ def _get_partners(self):
+ if self.result_selection == 'customer':
+ return 'Receivable Accounts'
+ elif self.result_selection == 'supplier':
+ return 'Payable Accounts'
+ elif self.result_selection == 'customer_supplier':
+ return 'Receivable and Payable Accounts'
+ return ''
+
+report_sxw.report_sxw('report.account.partner.balance', 'res.partner', 'account/report/account_partner_balance.rml',parser=partner_balance, header="internal")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/report/account_partner_balance.rml b/addons/account/report/account_partner_balance.rml
new file mode 100644
index 00000000000..fba666fe319
--- /dev/null
+++ b/addons/account/report/account_partner_balance.rml
@@ -0,0 +1,272 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Partner Balance
+
+
+
+
+
+
+
+
+
Chart of Account
+
Fiscal Year
+
Journals
+
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
Partner's
+
Printing Date
+
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
+
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data) ]]
+
[[ get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
Partner's
+
Printing Date
+
+
+
[[ get_account(data) or '' ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data) ]]
+
[[ get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
+ Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
+
+ Partner's
+
+
+ Printing Date
+
+
+
+
+ [[ get_account(data) or '' ]]
+
+
+ [[ get_fiscalyear(data) or '' ]]
+
+
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
+ Start Date
+
+
+ End Date
+
+
+
+
+ [[ get_start_date(data) ]]
+
+
+ [[ get_end_date(data) ]]
+
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
+ Start Period
+
+
+ End Period
+
+
+
+
+ [[ get_start_period(data) or removeParentNode('para') ]]
+
+
+ [[ get_end_period(data) or removeParentNode('para') ]]
+
- Profit And Loss Account
+ [[ get_company(data) ]]
-
+
- From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]
-
-
-
-
- [[ get_data(data['form']) ]]
+ Profit And Loss Account
+
+
+
+ [[ get_data(data) or removeParentNode('para')]]
+
+
+
Chart of Account
+
Fiscal Year
+
Filter By [[ get_filter(data)!='No Filter' and '' or removeParentNode('font') ]]
+
Display Account
+
Printing Date
+
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data)]]
+
[[get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
+
+
+
+
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']]
- From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]
-
+
Chart of Account
+
Fiscal Year
+
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+
Display Account
+
Printing Date
-
-
- [[ get_data(data['form']) ]]
-
-
-
+
+
[[ get_account(data) or removeParentNode('para') ]]
+
[[ get_fiscalyear(data) or '' ]]
+
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
+
+
Start Date
+
End Date
+
+
+
[[ get_start_date(data)]]
+
[[get_end_date(data) ]]
+
+
+ [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]]
+
+
Start Period
+
End Period
+
+
+
[[ get_start_period(data) or removeParentNode('para') ]]
+
[[ get_end_period(data) or removeParentNode('para') ]]
+
+
+
+
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']]
[[ sum_cr() and formatLang(get_abs(sum_cr())) or 0.0 ]]
diff --git a/addons/account/report/central_journal.py b/addons/account/report/central_journal.py
deleted file mode 100644
index d76f6ccf07b..00000000000
--- a/addons/account/report/central_journal.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import time
-from report import report_sxw
-
-#
-# Use period and Journal for selection or resources
-#
-class journal_print(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(journal_print, self).__init__(cr, uid, name, context=context)
- self.localcontext.update({
- 'time': time,
- 'lines': self.lines,
- 'sum_debit': self._sum_debit,
- 'sum_credit': self._sum_credit
- })
-
- def lines(self, period_id, journal_id, *args):
- if type(period_id)==type([]):
- ids_final = []
- for journal in journal_id:
- for period in period_id:
- ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid, [('journal_id','=',journal),('period_id','=',period)])
- if ids_journal_period:
- self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%s and l.journal_id=%s and l.state<>\'draft\' group by a.id, a.code, a.name, l.journal_id, l.period_id', (period, journal))
- res = self.cr.dictfetchall()
- a = {'journal':self.pool.get('account.journal').browse(self.cr, self.uid, journal),'period':self.pool.get('account.period').browse(self.cr, self.uid, period)}
- res[0].update(a)
- ids_final.append(res)
- return ids_final
- self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%s and l.journal_id=%s and l.state<>\'draft\' group by a.id, a.code, a.name', (period_id, journal_id))
- res = self.cr.dictfetchall()
- return res
-
- def _sum_debit(self, period_id, journal_id):
- self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id))
- return self.cr.fetchone()[0] or 0.0
-
- def _sum_credit(self, period_id, journal_id):
- self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id))
- return self.cr.fetchone()[0] or 0.0
-report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/central_journal.rml', parser=journal_print, header=False)
-report_sxw.report_sxw('report.account.central.journal.wiz', 'account.journal.period', 'addons/account/report/wizard_central_journal.rml', parser=journal_print, header=False)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/report/central_journal.rml b/addons/account/report/central_journal.rml
deleted file mode 100644
index 1fe5b8be0f8..00000000000
--- a/addons/account/report/central_journal.rml
+++ /dev/null
@@ -1,185 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ repeatIn(objects, 'o') ]]
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/account/report/common_report_header.py b/addons/account/report/common_report_header.py
new file mode 100644
index 00000000000..3bce3c10ed0
--- /dev/null
+++ b/addons/account/report/common_report_header.py
@@ -0,0 +1,135 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import pooler
+
+class common_report_header(object):
+
+ def _sum_debit(self, period_id=False, journal_id=False):
+ if journal_id and isinstance(journal_id, int):
+ journal_id = [journal_id]
+ if period_id and isinstance(period_id, int):
+ period_id = [period_id]
+ if not journal_id:
+ journal_id = self.journal_ids
+ if not period_id:
+ period_id = self.period_ids
+ if not (period_id and journal_id):
+ return 0.0
+ self.cr.execute('SELECT SUM(debit) FROM account_move_line l '
+ 'WHERE period_id IN %s AND journal_id IN %s ' + self.query_get_clause + ' ',
+ (tuple(period_id), tuple(journal_id)))
+ return self.cr.fetchone()[0] or 0.0
+
+ def _sum_credit(self, period_id=False, journal_id=False):
+ if journal_id and isinstance(journal_id, int):
+ journal_id = [journal_id]
+ if period_id and isinstance(period_id, int):
+ period_id = [period_id]
+ if not journal_id:
+ journal_id = self.journal_ids
+ if not period_id:
+ period_id = self.period_ids
+ if not (period_id and journal_id):
+ return 0.0
+ self.cr.execute('SELECT SUM(credit) FROM account_move_line l '
+ 'WHERE period_id IN %s AND journal_id IN %s '+ self.query_get_clause+'',
+ (tuple(period_id), tuple(journal_id)))
+ return self.cr.fetchone()[0] or 0.0
+
+ def _get_start_date(self, data):
+ if data.get('form', False) and data['form'].get('date_from', False):
+ return data['form']['date_from']
+ return ''
+
+ def _get_end_date(self, data):
+ if data.get('form', False) and data['form'].get('date_to', False):
+ return data['form']['date_to']
+ return ''
+
+ def get_start_period(self, data):
+ if data.get('form', False) and data['form'].get('period_from', False):
+ return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,data['form']['period_from']).name
+ return ''
+
+ def get_end_period(self, data):
+ if data.get('form', False) and data['form'].get('period_to', False):
+ return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr, self.uid, data['form']['period_to']).name
+ return ''
+
+ def _get_account(self, data):
+ if data.get('form', False) and data['form'].get('chart_account_id', False):
+ return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr, self.uid, data['form']['chart_account_id']).name
+ return ''
+
+ def _get_sortby(self, data):
+ raise (_('Error'), _('Not implemented'))
+
+ def _get_filter(self, data):
+ if data.get('form', False) and data['form'].get('filter', False):
+ if data['form']['filter'] == 'filter_date':
+ return 'Date'
+ elif data['form']['filter'] == 'filter_period':
+ return 'Periods'
+ return 'No Filter'
+
+ def _sum_debit_period(self, period_id, journal_id=None):
+ journals = journal_id or self.journal_ids
+ if not journals:
+ return 0.0
+ self.cr.execute('SELECT SUM(debit) FROM account_move_line l '
+ 'WHERE period_id=%s AND journal_id IN %s '+ self.query_get_clause +'',
+ (period_id, tuple(journals)))
+
+ return self.cr.fetchone()[0] or 0.0
+
+ def _sum_credit_period(self, period_id, journal_id=None):
+ journals = journal_id or self.journal_ids
+ if not journals:
+ return 0.0
+ self.cr.execute('SELECT SUM(credit) FROM account_move_line l '
+ 'WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause +' ',
+ (period_id, tuple(journals)))
+ return self.cr.fetchone()[0] or 0.0
+
+ def _get_fiscalyear(self, data):
+ if data.get('form', False) and data['form'].get('fiscalyear_id', False):
+ return pooler.get_pool(self.cr.dbname).get('account.fiscalyear').browse(self.cr, self.uid, data['form']['fiscalyear_id']).name
+ return ''
+
+ def _get_company(self, data):
+ if data.get('form', False) and data['form'].get('chart_account_id', False):
+ return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr, self.uid, data['form']['chart_account_id']).company_id.name
+ return ''
+
+ def _get_journal(self, data):
+ codes = []
+ if data.get('form', False) and data['form'].get('journal_ids', False):
+ self.cr.execute('select code from account_journal where id IN %s',(tuple(data['form']['journal_ids']),))
+ codes = [x for x, in self.cr.fetchall()]
+ return codes
+
+ def _get_currency(self, data):
+ if data.get('form', False) and data['form'].get('chart_account_id', False):
+ return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr, self.uid, data['form']['chart_account_id']).company_id.currency_id.code
+ return ''
+
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py
deleted file mode 100644
index 631930ce3a7..00000000000
--- a/addons/account/report/general_journal.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-from operator import itemgetter
-import pooler
-import time
-from report import report_sxw
-
-#
-# Use period and Journal for selection or resources
-#
-class journal_print(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(journal_print, self).__init__(cr, uid, name, context=context)
- self.localcontext.update( {
- 'time': time,
- 'lines': self.lines,
- 'periods': self.periods,
- 'sum_debit_period': self._sum_debit_period,
- 'sum_credit_period': self._sum_credit_period,
- 'sum_debit': self._sum_debit,
- 'sum_credit': self._sum_credit
- })
-
- def set_context(self, objects, data, ids, report_type = None):
- super(journal_print, self).set_context(objects, data, ids, report_type)
- self.cr.execute('SELECT period_id, journal_id '
- 'FROM account_journal_period '
- 'WHERE id IN %s',
- (tuple(ids),))
- res = self.cr.fetchall()
- self.period_ids, self.journal_ids = zip(*res)
-
- # returns a list of period objs
- def periods(self, journal_period_objs):
- dic = {}
- def filter_unique(o):
- key = o.period_id.id
- res = key in dic
- if not res:
- dic[key] = True
- return not res
- filtered_objs = filter(filter_unique, journal_period_objs)
- return map(lambda x: x.period_id, filtered_objs)
-
- def lines(self, period_id, journal_id=[]):
- if type(period_id)==type([]):
- ids_final = []
- for journal in journal_id:
- for period in period_id:
- ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid, [('journal_id','=',journal),('period_id','=',period)])
- if ids_journal_period:
- ids_final.append(ids_journal_period[0])
- data_jour_period = self.pool.get('account.journal.period').browse(self.cr, self.uid, ids_final)
- lines_data = []
- periods = []
- for data in data_jour_period:
- if not data.period_id.id in periods:
- periods.append(data.period_id.id)
- for period in periods:
- period_data = self.pool.get('account.period').browse(self.cr, self.uid, period)
- self.cr.execute(
- 'SELECT j.code, j.name, '
- 'SUM(l.debit) AS debit, SUM(l.credit) AS credit '
- 'FROM account_move_line l '
- 'LEFT JOIN account_journal j ON (l.journal_id=j.id) '
- 'WHERE period_id=%s AND journal_id IN %s '
- 'AND l.state<>\'draft\' '
- 'GROUP BY j.id, j.code, j.name', (period, tuple(journal_id)))
- res = self.cr.dictfetchall()
- res[0].update({'period_name':period_data.name})
- res[0].update({'pid':period})
- lines_data.append(res)
- return lines_data
- if not self.journal_ids:
- return []
-
- self.cr.execute('SELECT j.code, j.name, '
- 'SUM(l.debit) AS debit, SUM(l.credit) AS credit '
- 'FROM account_move_line l '
- 'LEFT JOIN account_journal j ON (l.journal_id=j.id) '
- 'WHERE period_id=%s AND journal_id IN %s '
- 'AND l.state<>\'draft\' '
- 'GROUP BY j.id, j.code, j.name',
- (period_id, tuple(self.journal_ids)))
- res = self.cr.dictfetchall()
- return res
-
- def _sum_debit_period(self, period_id, journal_id=None):
- journals = journal_id or self.journal_ids
- if not journals:
- return 0.0
- self.cr.execute('SELECT SUM(debit) FROM account_move_line '
- 'WHERE period_id=%s AND journal_id IN %s '
- 'AND state<>\'draft\'',
- (period_id, tuple(journals)))
- return self.cr.fetchone()[0] or 0.0
-
- def _sum_credit_period(self, period_id, journal_id=None):
- journals = journal_id or self.journal_ids
- if not journals:
- return 0.0
- self.cr.execute('SELECT SUM(credit) FROM account_move_line '
- 'WHERE period_id=%s AND journal_id IN %s '
- 'AND state<>\'draft\'',
- (period_id, tuple(journals)))
- return self.cr.fetchone()[0] or 0.0
-
- def _sum_debit(self, period_id=None, journal_id=None):
- journals = journal_id or self.journal_ids
- periods = period_id or self.period_ids
- if not (journals and periods):
- return 0.0
- self.cr.execute('SELECT SUM(debit) FROM account_move_line '
- 'WHERE period_id IN %s '
- 'AND journal_id IN %s '
- 'AND state<>\'draft\'',
- (tuple(periods), tuple(journals)))
- return self.cr.fetchone()[0] or 0.0
-
- def _sum_credit(self, period_id=None, journal_id=None):
- periods = period_id or self.period_ids
- journals = journal_id or self.journal_ids
- if not (periods and journals):
- return 0.0
- self.cr.execute('SELECT SUM(credit) FROM account_move_line '
- 'WHERE period_id IN %s '
- 'AND journal_id IN %s '
- 'AND state<>\'draft\'',
- (tuple(periods), tuple(journals)))
- return self.cr.fetchone()[0] or 0.0
-report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml', parser=journal_print)
-report_sxw.report_sxw('report.account.general.journal.wiz', 'account.journal.period', 'addons/account/report/wizard_general_journal.rml', parser=journal_print, header=False)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/report/general_journal.rml b/addons/account/report/general_journal.rml
deleted file mode 100644
index 6c62d82eb88..00000000000
--- a/addons/account/report/general_journal.rml
+++ /dev/null
@@ -1,200 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/addons/account/report/wizard_central_journal.rml b/addons/account/report/wizard_central_journal.rml
index 13282ce67b3..1a8d9b62187 100644
--- a/addons/account/report/wizard_central_journal.rml
+++ b/addons/account/report/wizard_central_journal.rml
@@ -34,6 +34,10 @@
+
+
+
+
@@ -51,6 +55,13 @@
+
+
+
+
+
+
+
@@ -65,6 +76,13 @@
+
+
+
+
+
+
+
@@ -123,7 +141,8 @@
-
+
+ [[ repeatIn(objects, 'o') ]]
+ id="menu_reconcile_select" parent="periodical_processing_reconciliation" /> -->
-
\ No newline at end of file
+
diff --git a/addons/account/wizard/account_move_line_select_view.xml b/addons/account/wizard/account_move_line_select_view.xml
index 8c462318271..645b5a098e3 100644
--- a/addons/account/wizard/account_move_line_select_view.xml
+++ b/addons/account/wizard/account_move_line_select_view.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/addons/account/wizard/account_move_line_unreconcile_select_view.xml b/addons/account/wizard/account_move_line_unreconcile_select_view.xml
index f2a3882db91..ae1b069a1dc 100644
--- a/addons/account/wizard/account_move_line_unreconcile_select_view.xml
+++ b/addons/account/wizard/account_move_line_unreconcile_select_view.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/addons/account/wizard/account_open_closed_fiscalyear_view.xml b/addons/account/wizard/account_open_closed_fiscalyear_view.xml
index afc7b7e6828..435f15388c1 100644
--- a/addons/account/wizard/account_open_closed_fiscalyear_view.xml
+++ b/addons/account/wizard/account_open_closed_fiscalyear_view.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/addons/account/wizard/account_partner_balance_report.py b/addons/account/wizard/account_partner_balance_report.py
deleted file mode 100644
index c6d82128256..00000000000
--- a/addons/account/wizard/account_partner_balance_report.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-import time
-
-from tools.translate import _
-from osv import fields, osv
-
-class account_partner_balance(osv.osv_memory):
- """
- This wizard will provide the partner balance report by periods, between any two dates.
- """
- _name = 'account.partner.balance'
- _description = 'Account Partner Balance'
- _columns = {
- 'company_id': fields.many2one('res.company', 'Company', required=True),
- 'state': fields.selection([('bydate','By Date'),
- ('byperiod','By Period'),
- ('all','By Date and Period'),
- ('none','No Filter')
- ],'Date/Period Filter'),
- 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
- 'periods': fields.many2many('account.period', 'period_report_rel', 'report_id', 'period_id', 'Periods', help='All periods if empty'),
- 'result_selection': fields.selection([('customer','Receivable Accounts'),
- ('supplier','Payable Accounts'),
- ('all','Receivable and Payable Accounts')],
- 'Partner', required=True),
- 'soldeinit': fields.boolean('Include initial balances'),
- 'date1': fields.date('Start date', required=True),
- 'date2': fields.date('End date', required=True),
- }
-
- def _get_company(self, cr, uid, context=None):
- user_obj = self.pool.get('res.users')
- company_obj = self.pool.get('res.company')
- user = user_obj.browse(cr, uid, uid, context=context)
- if user.company_id:
- return user.company_id.id
- else:
- return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
-
- _defaults={
- 'state' : 'none',
- 'date1' : time.strftime('%Y-01-01'),
- 'date2' : time.strftime('%Y-%m-%d'),
- 'result_selection' : 'all',
- 'soldeinit' : True,
- 'company_id' : _get_company,
- 'fiscalyear' : False,
- }
-
- def check_state(self, cr, uid, ids, context=None):
- data = {
- 'ids':[],
- 'model': 'res.partner',
- 'form': self.read(cr, uid, ids, [])[0],
- }
- if data['form']['state'] == 'bydate' :
- return self._check_date(cr, uid, data, context)
- if data['form']['state'] == 'byperiod':
- if not data['form']['periods']:
- raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
-
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'account.partner.balance',
- 'datas': data,
- 'nodestroy':True,
- }
-
- def _check_date(self, cr, uid, data, context):
- sql = """
- SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
- cr.execute(sql, (data['form']['date1'],))
- res = cr.dictfetchall()
- if res:
- if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
- raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
- else:
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'account.partner.balance',
- 'datas': data,
- 'nodestroy':True,
- }
- else:
- raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
-
-account_partner_balance()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/account_partner_balance_report_view.xml b/addons/account/wizard/account_partner_balance_report_view.xml
deleted file mode 100644
index 4827fac5480..00000000000
--- a/addons/account/wizard/account_partner_balance_report_view.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
- Select period
- account.partner.balance
- form
-
-
-
-
-
-
- Select Period
- account.partner.balance
- ir.actions.act_window
- form
- tree,form
-
- {'record_id':active_id}
- new
- This report is analysis by partner. It is a PDF report containing one line per partner representing the cumulative credit balance.
-
-
-
-
-
-
diff --git a/addons/account/wizard/account_pl_report.py b/addons/account/wizard/account_pl_report.py
deleted file mode 100644
index 9ae7a4dbedf..00000000000
--- a/addons/account/wizard/account_pl_report.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-import time
-
-from osv import osv, fields
-from tools.translate import _
-
-class account_pl_report(osv.osv_memory):
- """
- This wizard will provide the account profit and loss report by periods, between any two dates.
- """
- _name = 'account.pl.report'
- _description = 'Account Profit And Loss Report'
- _columns = {
- 'Account_list': fields.many2one('account.account', 'Chart account',
- required=True, domain = [('parent_id','=',False)]),
- 'company_id': fields.many2one('res.company', 'Company', required=True),
- 'display_account': fields.selection([('bal_movement','With movements'),
- ('bal_solde','With balance is not equal to 0'),
- ('bal_all','All'),
- ],'Display accounts'),
- 'display_type': fields.boolean("Landscape Mode"),
- 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
- 'state': fields.selection([('bydate','By Date'),
- ('byperiod','By Period'),
- ('all','By Date and Period'),
- ('none','No Filter')
- ],'Date/Period Filter'),
- 'periods': fields.many2many('account.period', 'period_account_balance_rel',
- 'report_id', 'period_id', 'Periods',
- help='Keep empty for all open fiscal year'),
- 'date_from': fields.date('Start date', required=True),
- 'date_to': fields.date('End date', required=True),
- }
-
- def _get_company(self, cr, uid, context=None):
- user_obj = self.pool.get('res.users')
- company_obj = self.pool.get('res.company')
- user = user_obj.browse(cr, uid, uid, context=context)
- if user.company_id:
- return user.company_id.id
- else:
- return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
-
- _defaults={
- 'state' : 'none',
- 'date_from' : time.strftime('%Y-01-01'),
- 'date_to' : time.strftime('%Y-%m-%d'),
- 'company_id' : _get_company,
- 'fiscalyear' : False,
- 'display_account': 'bal_all',
- 'display_type': True,
- }
-
- def next_view(self, cr, uid, ids, context=None):
- obj_model = self.pool.get('ir.model.data')
- if context is None:
- context = {}
- data = self.read(cr, uid, ids, [])[0]
- context.update({'Account_list': data['Account_list']})
- model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_pl_report_view')])
- resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
- return {
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'account.pl.report',
- 'views': [(resource_id,'form')],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- 'context': context
- }
-
- def check_state(self, cr, uid, ids, context=None):
- if context is None:
- context = {}
- data={}
- data['ids'] = context['active_ids']
- data['form'] = self.read(cr, uid, ids, ['date_from', 'company_id', 'state', 'periods', 'date_to', 'display_account', 'display_type', 'fiscalyear'])[0]
- data['form']['Account_list'] = context.get('Account_list',[])
- data['form']['context'] = context
- if data['form']['Account_list']:
- data['model'] = 'ir.ui.menu'
- else:
- data['model'] = 'account.account'
-
- if data['form']['state'] == 'bydate' :
- return self._check_date(cr, uid, data, context)
- elif data['form']['state'] == 'byperiod':
- if not data['form']['periods']:
- raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
- if data['form']['display_type']:
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pl.account.horizontal',
- 'datas': data,
- }
- else:
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pl.account',
- 'datas': data,
- }
-
- def _check_date(self, cr, uid, data, context=None):
- if context is None:
- context = {}
- sql = """
- SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
- cr.execute(sql,(data['form']['date_from'],))
- res = cr.dictfetchall()
- if res:
-
- if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
- raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
- else:
- if data['form']['display_type']:
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pl.account.horizontal',
- 'datas': data,
- 'nodestroy':True,
- }
- else:
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pl.account',
- 'datas': data,
- 'nodestroy':True,
- }
- else:
- raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
-
-account_pl_report()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_pl_report_view.xml b/addons/account/wizard/account_pl_report_view.xml
deleted file mode 100644
index 219d41d312f..00000000000
--- a/addons/account/wizard/account_pl_report_view.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-
- Select period
- account.pl.report
- form
-
-
-
-
-
-
- Account Profit And Loss
- account.pl.report
- ir.actions.act_window
- form
- form
-
- new
-
-
-
- Account Chart
- account.pl.report
- form
-
-
-
-
-
-
- Select Account
- account.pl.report
- ir.actions.act_window
- form
- tree,form
-
- {'record_id':active_id}
- new
-
-
-
-
-
-
diff --git a/addons/account/wizard/account_print_journal.py b/addons/account/wizard/account_print_journal.py
deleted file mode 100644
index f40efe3eb99..00000000000
--- a/addons/account/wizard/account_print_journal.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-from osv import osv, fields
-from tools.translate import _
-
-class account_print_journal(osv.osv_memory):
- _name = 'account.print.journal'
- _description = 'Account Print Journal'
-
- _columns = {
- 'journal_id': fields.many2many('account.journal', 'account_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
- 'period_id': fields.many2many('account.period', 'account_period_rel', 'account_id', 'period_id', 'Periods', required=True),
- 'sort_selection': fields.selection([('date','By date'),
- ('ref','Reference Number'),],
- 'Entries Sorted By', required=True),
- }
-
- _defaults = {
- 'sort_selection': lambda *a: 'date',
- }
-
- def check_data(self, cr, uid, ids, context=None):
- obj_jperiod = self.pool.get('account.journal.period')
- datas = {}
- datas['ids'] = []
- datas['model'] = 'account.journal.period'
- datas['form'] = self.read(cr, uid, ids)[0]
- period_id = datas['form']['period_id']
- journal_id = datas['form']['journal_id']
-
- if type(period_id)==type([]):
- ids_final = []
- for journal in journal_id:
- for period in period_id:
- ids_journal_period = obj_jperiod.search(cr,uid, [('journal_id','=',journal),('period_id','=',period)], context=context)
- if ids_journal_period:
- ids_final.append(ids_journal_period)
- if not ids_final:
- raise osv.except_osv(_('No Data Available'), _('No records found for your selection!'))
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'account.journal.period.print',
- 'datas': datas,
- 'nodestroy':True,
- }
-
-account_print_journal()
-
-#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_print_journal_view.xml b/addons/account/wizard/account_print_journal_view.xml
deleted file mode 100644
index 31cbe322bd3..00000000000
--- a/addons/account/wizard/account_print_journal_view.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Account Print Journal
- account.print.journal
- form
-
-
-
-
-
-
- Account Print Journal
- ir.actions.act_window
- account.print.journal
- form
- form
- new
-
-
-
-
-
-
diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py
index 59ea16b2c23..e8db687edf7 100644
--- a/addons/account/wizard/account_reconcile.py
+++ b/addons/account/wizard/account_reconcile.py
@@ -23,19 +23,19 @@ import time
from osv import fields, osv
from tools.translate import _
-#class account_move_line_reconcile_prompt(osv.osv_memory):
-# """
-# Asks user he wants to reconcile entries or not.
-# """
-# _name = 'account.move.line.reconcile.prompt'
-# _description = 'Account move line reconcile'
-# _columns = {
-# }
-#
-# def ask_reconcilation(self, cr, uid, ids, context):
-# return self.pool.get('account.move.line.reconcile').partial_check(cr, uid, ids, context)
-#
-#account_move_line_reconcile_prompt()
+class account_move_line_reconcile_prompt(osv.osv_memory):
+ """
+ Asks user he wants to reconcile entries or not.
+ """
+ _name = 'account.move.line.reconcile.prompt'
+ _description = 'Account move line reconcile'
+ _columns = {
+ }
+
+ def ask_reconcilation(self, cr, uid, ids, context):
+ return self.pool.get('account.move.line.reconcile').partial_check(cr, uid, ids, context)
+
+account_move_line_reconcile_prompt()
class account_move_line_reconcile(osv.osv_memory):
"""
diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml
index 5ce124bfcc7..49d194af792 100644
--- a/addons/account/wizard/account_reconcile_view.xml
+++ b/addons/account/wizard/account_reconcile_view.xml
@@ -2,30 +2,30 @@
-
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -36,43 +36,43 @@
-
-
-
+
+
+ account.move.line.reconcile.full.formaccount.move.line.reconcileform
-
-
- Reconcile Entries
+
+
+ Reconcile Entriesaccount.move.line.reconcileformtree,form
-
- new
+
+ new
-
+
@@ -81,72 +81,72 @@
actionaccount.move.line
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+ account.move.line.reconcile.writeoff.formaccount.move.line.reconcile.writeoffform
-
+
diff --git a/addons/account/wizard/account_report_account_balance.py b/addons/account/wizard/account_report_account_balance.py
new file mode 100644
index 00000000000..6c9744979ff
--- /dev/null
+++ b/addons/account/wizard/account_report_account_balance.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from lxml import etree
+
+from osv import osv
+
+class account_balance_report(osv.osv_memory):
+ _inherit = "account.common.account.report"
+ _name = 'account.balance.report'
+ _description = 'Account Balance Report'
+
+ _defaults = {
+ 'journal_ids': [],
+ }
+
+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+ mod_obj = self.pool.get('ir.model.data')
+ res = super(account_balance_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
+ doc = etree.XML(res['arch'])
+ nodes = doc.xpath("//field[@name='journal_ids']")
+ for node in nodes:
+ node.set('readonly', '1')
+ node.set('required', '0')
+ res['arch'] = etree.tostring(doc)
+ return res
+
+ def _print_report(self, cr, uid, ids, data, query_line, context=None):
+ data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
+ return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data}
+
+account_balance_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_report_account_balance_view.xml b/addons/account/wizard/account_report_account_balance_view.xml
new file mode 100644
index 00000000000..548469ebce1
--- /dev/null
+++ b/addons/account/wizard/account_report_account_balance_view.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+ Account Balance
+ account.balance.report
+ form
+
+
+
+
+
+
+
+
+
+
+ Account Balance
+ ir.actions.act_window
+ account.balance.report
+ form
+ form
+
+ new
+
+
+
+
+
+
+
+ Account Balance
+ client_print_multi
+
+ action
+ account.account
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/wizard/account_aged_trial_balance.py b/addons/account/wizard/account_report_aged_partner_balance.py
similarity index 99%
rename from addons/account/wizard/account_aged_trial_balance.py
rename to addons/account/wizard/account_report_aged_partner_balance.py
index dee5e20e086..5a534c3889f 100644
--- a/addons/account/wizard/account_aged_trial_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 *
@@ -58,7 +59,7 @@ class account_aged_trial_balance(osv.osv_memory):
'company_id': _get_company,
'period_length': 30,
'date1' : time.strftime('%Y-%m-%d'),
- 'result_selection': 'all',
+ 'result_selection': 'customer',
'direction_selection': 'past',
}
diff --git a/addons/account/wizard/account_aged_trial_balance_view.xml b/addons/account/wizard/account_report_aged_partner_balance_view.xml
similarity index 100%
rename from addons/account/wizard/account_aged_trial_balance_view.xml
rename to addons/account/wizard/account_report_aged_partner_balance_view.xml
diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py
new file mode 100644
index 00000000000..8398731cc5f
--- /dev/null
+++ b/addons/account/wizard/account_report_balance_sheet.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from lxml import etree
+
+from osv import osv, fields
+
+class account_bs_report(osv.osv_memory):
+ """
+ This wizard will provide the account balance sheet report by periods, between any two dates.
+ """
+ _name = 'account.bs.report'
+ _inherit = "account.common.account.report"
+ _description = 'Account Balance Sheet Report'
+
+ _columns = {
+ 'display_type': fields.boolean("Landscape Mode"),
+ 'reserve_account_id': fields.many2one('account.account', 'Reserve & Surplus Account',required = True,
+ help='This Account is used for trasfering Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be duducted.), Which is calculated from Profilt & Loss Report', domain = [('type','=','payable')]),
+ }
+
+ _defaults={
+ 'display_type': True,
+ 'journal_ids': [],
+ }
+
+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+ mod_obj = self.pool.get('ir.model.data')
+ res = super(account_bs_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
+ doc = etree.XML(res['arch'])
+ nodes = doc.xpath("//field[@name='journal_ids']")
+ for node in nodes:
+ node.set('readonly', '1')
+ node.set('required', '0')
+ res['arch'] = etree.tostring(doc)
+ return res
+
+ def _print_report(self, cr, uid, ids, data, query_line, context=None):
+ if context is None:
+ context = {}
+ data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
+ data['form'].update(self.read(cr, uid, ids, ['display_type', 'reserve_account_id'])[0])
+ if data['form']['display_type']:
+ return {
+ '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()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_report_balance_sheet_view.xml b/addons/account/wizard/account_report_balance_sheet_view.xml
new file mode 100644
index 00000000000..14e0cc70e0e
--- /dev/null
+++ b/addons/account/wizard/account_report_balance_sheet_view.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Account Balance Sheet
+ account.bs.report
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Balance Sheet
+ account.bs.report
+ ir.actions.act_window
+ form
+ form
+
+ new
+
+
+
+
+
+
diff --git a/addons/account/wizard/account_report_central_journal.py b/addons/account/wizard/account_report_central_journal.py
new file mode 100644
index 00000000000..c424f397cde
--- /dev/null
+++ b/addons/account/wizard/account_report_central_journal.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from osv import osv, fields
+
+class account_central_journal(osv.osv_memory):
+ _name = 'account.central.journal'
+ _description = 'Account Central Journal'
+ _inherit = "account.common.journal.report"
+
+ def _print_report(self, cr, uid, ids, data, query_line, context=None):
+ data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.central.journal',
+ 'datas': data,
+ }
+
+account_central_journal()
+
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_central_journal_view.xml b/addons/account/wizard/account_report_central_journal_view.xml
similarity index 57%
rename from addons/account/wizard/account_central_journal_view.xml
rename to addons/account/wizard/account_report_central_journal_view.xml
index 9c9d687785c..9920a5fa80d 100644
--- a/addons/account/wizard/account_central_journal_view.xml
+++ b/addons/account/wizard/account_report_central_journal_view.xml
@@ -5,24 +5,14 @@
Account central Journalaccount.central.journal
+ form
-
+
+
+
+
+
@@ -33,6 +23,7 @@
formformnew
+