bug fix in third party ledger

bzr revid: patelamit2003@gmail.com-20081106073754-htbzyzvqcjvm05o2
This commit is contained in:
apa-tiny
2008-11-06 13:07:54 +05:30
parent 4acaf9b162
commit 0d9dbc1df5
2 changed files with 38 additions and 37 deletions
+37 -36
View File
@@ -184,7 +184,8 @@ class third_party_ledger(rml_parse.rml_parse):
partner_to_use = []
if data['form']['soldeinit'] :
print"self.date_lst[0]",self.date_lst[0]
print"self.date_lst[len(self.date_lst)-1]",self.date_lst[len(self.date_lst)-1]
self.cr.execute(
"SELECT DISTINCT line.partner_id " \
"FROM account_move_line AS line, account_account AS account " \
@@ -198,22 +199,22 @@ class third_party_ledger(rml_parse.rml_parse):
"AND account.company_id = %d " \
"AND account.active " ,
(self.date_lst[0],self.date_lst[len(self.date_lst)-1],data['form']['company_id']))
else:
self.cr.execute(
"SELECT DISTINCT line.partner_id " \
"FROM account_move_line AS line, account_account AS account " \
"WHERE line.partner_id IS NOT NULL " \
"AND line.account_id = account.id " \
"AND line.date IN (" + self.date_lst_string + ") " \
"AND line.account_id IN (" + self.account_ids + ") " \
" " + PARTNER_REQUEST + " " \
"AND account.company_id = %d " \
"AND account.active " ,
(data['form']['company_id']))
# else:
#
# self.cr.execute(
# "SELECT DISTINCT line.partner_id " \
# "FROM account_move_line AS line, account_account AS account " \
# "WHERE line.partner_id IS NOT NULL " \
# "AND line.account_id = account.id " \
# "AND line.date IN (" + self.date_lst_string + ") " \
# "AND line.account_id IN (" + self.account_ids + ") " \
# " " + PARTNER_REQUEST + " " \
# "AND account.company_id = %d " \
# "AND account.active " ,
# (data['form']['company_id']))
res = self.cr.dictfetchall()
print"=====res====",res
for res_line in res:
partner_to_use.append(res_line['partner_id'])
new_ids = partner_to_use
@@ -229,26 +230,26 @@ class third_party_ledger(rml_parse.rml_parse):
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
if data['form']['soldeinit'] :
self.cr.execute(
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
"FROM account_move_line l " \
"LEFT JOIN account_journal j " \
"ON (l.journal_id = j.id) " \
"WHERE l.partner_id = %d " \
"AND l.account_id IN (" + self.account_ids + ") " \
"AND l.date <= %s " \
"AND l.reconcile_id IS NULL "
"ORDER BY l.id",
(partner.id, self.date_lst[0]))
res = self.cr.dictfetchall()
sum = 0.0
for r in res:
sum = r['debit'] - r['credit']
r['progress'] = sum
full_account.append(r)
# if data['form']['soldeinit'] :
#
# self.cr.execute(
# "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
# "FROM account_move_line l " \
# "LEFT JOIN account_journal j " \
# "ON (l.journal_id = j.id) " \
# "WHERE l.partner_id = %d " \
# "AND l.account_id IN (" + self.account_ids + ") " \
# "AND l.date <= %s " \
# "AND l.reconcile_id IS NULL "
# "ORDER BY l.id",
# (partner.id, self.date_lst[0]))
# res = self.cr.dictfetchall()
# print"----res----",res
# sum = 0.0
# for r in res:
# sum = r['debit'] - r['credit']
# r['progress'] = sum
# full_account.append(r)
self.cr.execute(
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
@@ -262,7 +263,7 @@ class third_party_ledger(rml_parse.rml_parse):
"ORDER BY l.id",
(partner.id,))
res = self.cr.dictfetchall()
print":::::res::::::",res
sum = 0.0
for r in res:
sum = r['debit'] - r['credit']
@@ -119,7 +119,7 @@ class wizard_report(wizard.interface):
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all':
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all' or data['form']['state'] == 'none':
data['form']['fiscalyear'] = False
else :
data['form']['fiscalyear'] = True