diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py
index c27f3fcee24..e00a594f95f 100755
--- a/addons/account/report/general_ledger.py
+++ b/addons/account/report/general_ledger.py
@@ -167,31 +167,34 @@ class general_ledger(rml_parse.rml_parse):
## We will now compute solde initiaux
- for move in res:
-
- SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'"
- self.cr.execute(SOLDEINIT)
- resultat = self.cr.dictfetchall()
-
- if resultat[0] :
+ if not len(res):
+ return[account]
+ else:
+ for move in res:
- if resultat[0]['sum_debit'] == None:
- sum_debit = 0
- else:
-
- sum_debit = resultat[0]['sum_debit']
- if resultat[0]['sum_credit'] == None:
- sum_credit = 0
- else:
- sum_credit = resultat[0]['sum_credit']
-
- move.init_credit = sum_credit
- move.init_debit = sum_debit
+ SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'"
+ self.cr.execute(SOLDEINIT)
+ resultat = self.cr.dictfetchall()
- else:
- move.init_credit = 0
- move.init_debit = 0
-
+ if resultat[0] :
+
+ if resultat[0]['sum_debit'] == None:
+ sum_debit = 0
+ else:
+
+ sum_debit = resultat[0]['sum_debit']
+ if resultat[0]['sum_credit'] == None:
+ sum_credit = 0
+ else:
+ sum_credit = resultat[0]['sum_credit']
+
+ move.init_credit = sum_credit
+ move.init_debit = sum_debit
+
+ else:
+ move.init_credit = 0
+ move.init_debit = 0
+
##
return res
diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py
index 3410d1ffc11..762e7035f61 100755
--- a/addons/account/report/general_ledger_landscape.py
+++ b/addons/account/report/general_ledger_landscape.py
@@ -179,7 +179,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
def get_children_accounts(self, account, form):
-
+ print"account",account
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
[('parent_id', 'child_of', self.ids)])
#
@@ -223,7 +223,10 @@ class general_ledger_landscape(rml_parse.rml_parse):
context=ctx)) <> 0 :
res.append(child_account)
##
- if form['soldeinit']:
+ if not len(res):
+ print"==================="
+ return [account]
+ else:
## We will now compute solde initiaux
for move in res:
SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date < '" + self.borne_date['max_date'] + "'" + " AND l.date > '" + self.borne_date['min_date'] + "'"
@@ -246,7 +249,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
move.init_credit = 0
move.init_debit = 0
- ##
+ print"res",res
return res
def lines(self, account, form):
diff --git a/addons/account/wizard/wizard_account_balance_report.py b/addons/account/wizard/wizard_account_balance_report.py
index af23f0581ca..8e3b2a142c9 100644
--- a/addons/account/wizard/wizard_account_balance_report.py
+++ b/addons/account/wizard/wizard_account_balance_report.py
@@ -35,7 +35,7 @@ period_form = '''