diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml
index 299e5928353..9b3726b5c40 100644
--- a/addons/account/account_menuitem.xml
+++ b/addons/account/account_menuitem.xml
@@ -16,5 +16,6 @@
+
diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml
index d53ddc5adee..f2573a71f9b 100644
--- a/addons/account/account_wizard.xml
+++ b/addons/account/account_wizard.xml
@@ -78,5 +78,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index 624f49ebdfa..044315c538c 100755
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -35,7 +35,7 @@ import datetime
from report import report_sxw
class account_balance(report_sxw.rml_parse):
-
+
_name = 'report.account.account.balance'
def __init__(self, cr, uid, name, context):
super(account_balance, self).__init__(cr, uid, name, context)
@@ -53,20 +53,20 @@ class account_balance(report_sxw.rml_parse):
'get_periods':self.get_periods,
})
self.context = context
-
+
def get_fiscalyear(self, form):
res=[]
- if form.has_key('fiscalyear'):
+ if form.has_key('fiscalyear'):
fisc_id = form['fiscalyear']
if not (fisc_id):
return ''
self.cr.execute("select name from account_fiscalyear where id = %d" %(int(fisc_id)))
res=self.cr.fetchone()
return res and res[0] or ''
-
+
def get_periods(self, form):
result=''
- if form.has_key('periods'):
+ if form.has_key('periods'):
period_ids = ",".join([str(x) for x in form['periods'][0][2] if x])
self.cr.execute("select name from account_period where id in (%s)" % (period_ids))
res=self.cr.fetchall()
@@ -76,7 +76,7 @@ class account_balance(report_sxw.rml_parse):
else:
result+=r[0]+", "
return str(result and result[:-1]) or ''
-
+
def lines(self, form, ids={}, done=None, level=1):
if not ids:
ids = self.ids
@@ -84,10 +84,13 @@ class account_balance(report_sxw.rml_parse):
return []
if not done:
done={}
+ if form.has_key('Account_list') and form['Account_list']:
+ ids = [form['Account_list']]
+ del form['Account_list']
res={}
result_acc=[]
ctx = self.context.copy()
- if form.has_key('fiscalyear'):
+ if form.has_key('fiscalyear'):
self.transform_period_into_date_array(form)
ctx['fiscalyear'] = form['fiscalyear']
ctx['periods'] = form['periods'][0][2]
@@ -95,7 +98,7 @@ class account_balance(report_sxw.rml_parse):
self.transform_date_into_date_array(form)
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
-
+
accounts = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx)
def cmp_code(x, y):
return cmp(x.code, y.code)
@@ -103,7 +106,7 @@ class account_balance(report_sxw.rml_parse):
for account in accounts:
if account.id in done:
continue
- done[account.id] = 1
+ done[account.id] = 1
res = {
'lid' :'',
'date':'',
@@ -140,7 +143,7 @@ class account_balance(report_sxw.rml_parse):
if form['display_account'] == 'bal_mouvement':
if res['credit'] <> 0 or res['debit'] <> 0 or res['balance'] <> 0:
result_acc.append(res)
- elif form['display_account'] == 'bal_solde':
+ elif form['display_account'] == 'bal_solde':
if res['balance'] <> 0:
result_acc.append(res)
else:
@@ -156,7 +159,7 @@ class account_balance(report_sxw.rml_parse):
ids2.sort()
result_acc += self.lines(form, [x[1] for x in ids2], done, level+1)
return result_acc
-
+
def moveline(self,form,ids,level):
res={}
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
@@ -168,7 +171,7 @@ class account_balance(report_sxw.rml_parse):
"WHERE l.account_id = '"+str(ids)+"' " \
"AND l.date IN (" + self.date_lst_string + ") " \
"ORDER BY l.id")
- res = self.cr.dictfetchall()
+ res = self.cr.dictfetchall()
sum = 0.0
for r in res:
sum = r['debit1'] - r['credit1']
@@ -186,7 +189,7 @@ class account_balance(report_sxw.rml_parse):
else:
r['bal_type']=" Cr."
return res or ''
-
+
def date_range(self,start,end):
start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d")))
end = datetime.date.fromtimestamp(time.mktime(time.strptime(end,"%Y-%m-%d")))
@@ -198,7 +201,7 @@ class account_balance(report_sxw.rml_parse):
for date in date_array:
full_str_date.append(str(date))
return full_str_date
-
+
#
def transform_period_into_date_array(self,form):
## Get All Period Date
@@ -206,23 +209,23 @@ class account_balance(report_sxw.rml_parse):
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',form['fiscalyear'])])
else:
periods_id = form['periods'][0][2]
- date_array = []
+ date_array = []
for period_id in periods_id:
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
-
+
self.date_lst = date_array
self.date_lst.sort()
-
+
def transform_date_into_date_array(self,form):
return_array = self.date_range(form['date_from'],form['date_to'])
self.date_lst = return_array
self.date_lst.sort()
-
+
def _sum_credit(self):
- return self.sum_credit
-
+ return self.sum_credit
+
def _sum_debit(self):
- return self.sum_debit
+ return self.sum_debit
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False)
diff --git a/addons/account/wizard/wizard_account_balance_report.py b/addons/account/wizard/wizard_account_balance_report.py
index f038ce2bd68..431e183f156 100644
--- a/addons/account/wizard/wizard_account_balance_report.py
+++ b/addons/account/wizard/wizard_account_balance_report.py
@@ -40,7 +40,7 @@ dates_form = '''
-
+
'''
dates_fields = {
@@ -55,7 +55,7 @@ period_form = '''
-
+
'''
@@ -73,7 +73,7 @@ account_form = '''
'''
account_fields = {
- 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True},
+ 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True ,'domain':[('parent_id','=',False)]},
}
@@ -97,7 +97,7 @@ class wizard_report(wizard.interface):
else:
return 'account_selection'
-
+
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 """%(data['form']['date_from'])
@@ -108,12 +108,12 @@ class wizard_report(wizard.interface):
raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
else:
return 'report'
-
+
else:
raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
states = {
-
+
'init': {
'actions': [],
'result': {'type':'choice','next_state':_check_path}
diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py
index 80a25dde35e..c4a2f2a7438 100644
--- a/addons/account/wizard/wizard_general_ledger_report.py
+++ b/addons/account/wizard/wizard_general_ledger_report.py
@@ -61,7 +61,7 @@ account_form = '''
'''
account_fields = {
- 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True},
+ 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True ,'domain':[('parent_id','=',False)]},
}
@@ -110,7 +110,7 @@ def _check_date(self, cr, uid, data, context):
raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
else:
return 'checkreport'
-
+
else:
raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
@@ -119,13 +119,13 @@ class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- data['form']['sortbydate'] = 'sort_date'
+ data['form']['sortbydate'] = 'sort_date'
data['form']['display_account']='bal_all'
data['form']['landscape']=True
data['form']['amount_currency'] = True
return data['form']
def _get_defaults_fordate(self, cr, uid, data, context):
- data['form']['sortbydate'] = 'sort_date'
+ data['form']['sortbydate'] = 'sort_date'
data['form']['display_account']='bal_all'
data['form']['landscape']=True
data['form']['amount_currency'] = True