remove print
bzr revid: hda@tinyerp.com-20081021140246-iwi29p5ngx4ixwmi
This commit is contained in:
@@ -31,13 +31,13 @@ import rml_parse
|
||||
from report import report_sxw
|
||||
|
||||
class aged_trial_report(rml_parse.rml_parse):
|
||||
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(aged_trial_report, self).__init__(cr, uid, name, context)
|
||||
self.line_query = ''
|
||||
self.total_account = []
|
||||
|
||||
|
||||
|
||||
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_lines': self._get_lines,
|
||||
@@ -46,19 +46,19 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
'get_for_period': self._get_for_period,
|
||||
'get_company': self._get_company,
|
||||
'get_currency': self._get_currency,
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
def _get_lines(self, form):
|
||||
|
||||
|
||||
if (form['result_selection'] == 'customer' ):
|
||||
self.ACCOUNT_TYPE = "('receivable')"
|
||||
elif (form['result_selection'] == 'supplier'):
|
||||
self.ACCOUNT_TYPE = "('payable')"
|
||||
else:
|
||||
self.ACCOUNT_TYPE = "('payable','receivable')"
|
||||
|
||||
|
||||
|
||||
res = []
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
@@ -78,7 +78,7 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
for i in range(7):
|
||||
self.total_account.append(0)
|
||||
#
|
||||
|
||||
|
||||
for partner in partners:
|
||||
values = {}
|
||||
## If choise selection is in the future
|
||||
@@ -94,7 +94,7 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
"AND account_account.active",
|
||||
(form['date1'], partner['id'],form['date1'], form['company_id']))
|
||||
before = self.cr.fetchone()
|
||||
|
||||
|
||||
self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
|
||||
|
||||
values['direction'] = before and before[0] or 0.0
|
||||
@@ -112,7 +112,6 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
after = self.cr.fetchone()
|
||||
self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
|
||||
values['direction'] = after and after[0] or ""
|
||||
#print str(values['direction'])
|
||||
for i in range(5):
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
@@ -128,8 +127,6 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
during = self.cr.fetchone()
|
||||
# Ajout du compteur
|
||||
self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
|
||||
|
||||
#print str(during)
|
||||
values[str(i)] = during and during[0] or ""
|
||||
self.cr.execute("SELECT SUM(debit-credit) " \
|
||||
"FROM account_move_line AS line, account_account " \
|
||||
@@ -145,19 +142,16 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
values['total'] = total and total[0] or 0.0
|
||||
## Add for total
|
||||
self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
|
||||
print self.total_account,">>>>>>>>>>>>>Total>>>>>>>>>>>>>>>>"
|
||||
values['name'] = partner['name']
|
||||
#t = 0.0
|
||||
#for i in range(5)+['direction']:
|
||||
# t+= float(values.get(str(i), 0.0) or 0.0)
|
||||
#values['total'] = t
|
||||
|
||||
|
||||
if values['total']:
|
||||
|
||||
res.append(values)
|
||||
|
||||
|
||||
total = 0.0
|
||||
|
||||
totals = {}
|
||||
for r in res:
|
||||
total += float(r['total'] or 0.0)
|
||||
@@ -166,24 +160,17 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
totals[str(i)] += float(r[str(i)] or 0.0)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
|
||||
def _get_total(self,pos):
|
||||
print self.total_account,"========_get_total========"
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
return period
|
||||
|
||||
|
||||
def _get_direction(self,pos):
|
||||
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
return period
|
||||
|
||||
def _get_for_period(self,pos):
|
||||
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
return period
|
||||
|
||||
def _get_company(self, form):
|
||||
return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
|
||||
@@ -194,5 +181,5 @@ class aged_trial_report(rml_parse.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner',
|
||||
'addons/account/report/aged_trial_balance.rml',parser=aged_trial_report,header=False)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ import pooler
|
||||
|
||||
class general_ledger_landscape(rml_parse.rml_parse):
|
||||
_name = 'report.account.general.ledger_landscape'
|
||||
|
||||
|
||||
|
||||
|
||||
def preprocess(self, objects, data, ids):
|
||||
##
|
||||
self.borne_date = self.get_min_date(data['form'])
|
||||
@@ -46,18 +46,18 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
new_ids = ids
|
||||
else:
|
||||
new_ids.append(data['form']['Account_list'])
|
||||
|
||||
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
|
||||
super(general_ledger_landscape, self).preprocess(objects, data, new_ids)
|
||||
|
||||
|
||||
super(general_ledger_landscape, self).preprocess(objects, data, new_ids)
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(general_ledger_landscape, self).__init__(cr, uid, name, context)
|
||||
self.query = ""
|
||||
self.child_ids = ""
|
||||
self.tot_currency = 0.0
|
||||
self.period_sql = ""
|
||||
self.sold_accounts = {}
|
||||
self.sold_accounts = {}
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
@@ -66,7 +66,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
'sum_solde_account': self._sum_solde_account,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'sum_solde': self._sum_solde,
|
||||
'sum_solde': self._sum_solde,
|
||||
'get_children_accounts': self.get_children_accounts,
|
||||
'sum_currency_amount_account': self._sum_currency_amount_account
|
||||
})
|
||||
@@ -75,7 +75,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
result = {}
|
||||
#for id in ids:
|
||||
# result.setdefault(id, False)
|
||||
|
||||
|
||||
for account_line in self.pool.get('account.move.line').browse(cr, uid, ids, context):
|
||||
# For avoid long text in the field we will limit it to 5 lines
|
||||
#
|
||||
@@ -85,7 +85,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
num_id_move = str(account_line.move_id.id)
|
||||
num_id_line = str(account_line.id)
|
||||
account_id = str(account_line.account_id.id)
|
||||
# search the basic account
|
||||
# search the basic account
|
||||
# We have the account ID we will search all account move line from now until this time
|
||||
# We are in the case of we are on the top of the account move Line
|
||||
cr.execute('SELECT distinct(ac.code) as code_rest,ac.name as name_rest from account_account AS ac, account_move_line mv\
|
||||
@@ -103,10 +103,8 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
result[account_line.id] = concat + '...'
|
||||
break
|
||||
rup_id+=1
|
||||
|
||||
#print str(result)
|
||||
return result
|
||||
|
||||
|
||||
def get_min_date(self,form):
|
||||
## Get max born from account_fiscal year
|
||||
#
|
||||
@@ -123,9 +121,9 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
|
||||
"""
|
||||
else:
|
||||
else:
|
||||
periods_id = ','.join(map(str, periods))
|
||||
sql = """
|
||||
Select min(p.date_start) from account_period as p where p.id in ( """ + periods_id + """)
|
||||
@@ -141,30 +139,30 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
}
|
||||
return date_borne
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def get_children_accounts(self, account, form):
|
||||
|
||||
|
||||
|
||||
|
||||
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
|
||||
[('parent_id', 'child_of', self.ids)])
|
||||
#
|
||||
#
|
||||
res = []
|
||||
ctx = self.context.copy()
|
||||
## We will make the test for period or date
|
||||
## We will now make the test
|
||||
#
|
||||
if form.has_key('fiscalyear'):
|
||||
if form.has_key('fiscalyear'):
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
else:
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
##
|
||||
|
||||
|
||||
#
|
||||
self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
|
||||
|
||||
for child_id in self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])]):
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
@@ -175,7 +173,6 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
#print "Type de vue :" + form['display_account']
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
@@ -183,7 +180,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
context=ctx)) <> 0 :
|
||||
if ( sold_account <> 0.0):
|
||||
res.append(child_account)
|
||||
else:
|
||||
else:
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
@@ -205,17 +202,17 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
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
|
||||
|
||||
|
||||
def lines(self, account, form):
|
||||
inv_types = {
|
||||
'out_invoice': 'CI: ',
|
||||
@@ -229,9 +226,9 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
else:
|
||||
sorttag = 'j.code'
|
||||
sql = """
|
||||
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name, l.debit, l.credit, l.period_id
|
||||
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name, l.debit, l.credit, l.period_id
|
||||
FROM account_move_line l LEFT JOIN res_currency c on (l.currency_id=c.id) JOIN account_journal j on (l.journal_id=j.id)
|
||||
AND account_id = %d AND %s
|
||||
AND account_id = %d AND %s
|
||||
ORDER by %s"""%(account.id,self.query,sorttag)
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
@@ -258,11 +255,11 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
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']
|
||||
|
||||
self.tot_currency = self.tot_currency + l['amount_currency']
|
||||
|
||||
return res
|
||||
|
||||
def _sum_debit_account(self, account, form):
|
||||
@@ -291,7 +288,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
sum_credit += account.init_credit
|
||||
#
|
||||
##
|
||||
|
||||
|
||||
return sum_credit
|
||||
|
||||
def _sum_solde_account(self, account, form):
|
||||
@@ -301,7 +298,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
if form['soldeinit']:
|
||||
sum_solde += account.init_debit - account.init_credit
|
||||
|
||||
|
||||
return sum_solde
|
||||
|
||||
def _sum_debit(self, form):
|
||||
@@ -330,31 +327,24 @@ class general_ledger_landscape(rml_parse.rml_parse):
|
||||
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query)
|
||||
# print ("SELECT (sum(debit) - sum(credit)) as Test "\
|
||||
# "FROM account_move_line l "\
|
||||
# "WHERE l.account_id in ("+','.join(map(str, child_ids))+") AND "+query+period_sql)
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
return sum_solde
|
||||
|
||||
|
||||
def _set_get_account_currency_code(self, account_id):
|
||||
print"====account_id=====",account_id
|
||||
self.cr.execute("SELECT c.code as code "\
|
||||
"FROM res_currency c,account_account as ac "\
|
||||
"WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
|
||||
result = self.cr.fetchone()
|
||||
print"====result====",result
|
||||
if result:
|
||||
self.account_currency = result[0]
|
||||
else:
|
||||
self.account_currency = False
|
||||
|
||||
|
||||
|
||||
def _sum_currency_amount_account(self, account, form):
|
||||
|
||||
self._set_get_account_currency_code(account.id)
|
||||
self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %d "%account.id)
|
||||
total = self.cr.fetchone()
|
||||
|
||||
|
||||
if self.account_currency:
|
||||
return_field = str(total[0]) + self.account_currency
|
||||
return return_field
|
||||
|
||||
@@ -59,7 +59,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
for date in date_array:
|
||||
full_str_date.append(str(date))
|
||||
return full_str_date
|
||||
|
||||
|
||||
#
|
||||
def transform_period_into_date_array(self,data):
|
||||
## Get All Period Date
|
||||
@@ -67,66 +67,61 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
else:
|
||||
periods_id = data['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,data):
|
||||
return_array = self.date_range(data['form']['date1'],data['form']['date2'])
|
||||
self.date_lst = return_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_both_into_date_array(self,data):
|
||||
|
||||
|
||||
if not data['form']['periods'][0][2] :
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
else:
|
||||
periods_id = data['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)
|
||||
|
||||
|
||||
period_start_date = date_array[0]
|
||||
date_start_date = data['form']['date1']
|
||||
period_stop_date = date_array[-1]
|
||||
date_stop_date = data['form']['date2']
|
||||
|
||||
|
||||
if period_start_date<date_start_date:
|
||||
start_date = period_start_date
|
||||
else :
|
||||
start_date = date_start_date
|
||||
|
||||
|
||||
if date_stop_date<period_stop_date:
|
||||
stop_date = period_stop_date
|
||||
else :
|
||||
stop_date = date_stop_date
|
||||
|
||||
print"start_date",start_date
|
||||
print"stop_date",stop_date
|
||||
final_date_array = []
|
||||
final_date_array = final_date_array + self.date_range(start_date, stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
|
||||
def transform_none_into_date_array(self,data):
|
||||
sql = "SELECT min(date) as start_date from account_move_line"
|
||||
self.cr.execute(sql)
|
||||
start_date = self.cr.fetchone()[0]
|
||||
print"start_date",start_date
|
||||
sql = "SELECT max(date) as start_date from account_move_line"
|
||||
self.cr.execute(sql)
|
||||
stop_date = self.cr.fetchone()[0]
|
||||
print"stop_date",stop_date
|
||||
array= []
|
||||
array = array + self.date_range(start_date, stop_date)
|
||||
self.date_lst = array
|
||||
self.date_lst.sort()
|
||||
|
||||
|
||||
|
||||
|
||||
def comma_me(self,amount):
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
@@ -145,36 +140,31 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
for date_string in self.date_lst:
|
||||
string_map = date_string + ','
|
||||
return string_map
|
||||
|
||||
|
||||
def preprocess(self, objects, data, ids):
|
||||
PARTNER_REQUEST = ''
|
||||
if (data['model'] == 'res.partner'):
|
||||
print"data['model']",data['model']
|
||||
## Si on imprime depuis les partenaires
|
||||
if ids:
|
||||
PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")"
|
||||
# Transformation des date
|
||||
#
|
||||
#
|
||||
# if data['form']['fiscalyear']:
|
||||
# if data['form']['fiscalyear']:
|
||||
# self.transform_period_into_date_array(data)
|
||||
# else:
|
||||
# self.transform_date_into_date_array(data)
|
||||
##
|
||||
if data['form']['state'] == 'none':
|
||||
print"-----none-----"
|
||||
self.transform_none_into_date_array(data)
|
||||
elif data['form']['state'] == 'bydate':
|
||||
print"-----bydate-------"
|
||||
self.transform_date_into_date_array(data)
|
||||
elif data['form']['state'] == 'byperiod':
|
||||
print"-----byperiod-------"
|
||||
self.transform_period_into_date_array(data)
|
||||
elif data['form']['state'] == 'all':
|
||||
print"-----all-------"
|
||||
self.transform_both_into_date_array(data)
|
||||
|
||||
|
||||
|
||||
|
||||
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
|
||||
#
|
||||
#new_ids = [id for (id,) in self.cr.fetchall()]
|
||||
@@ -197,7 +187,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
partner_to_use = []
|
||||
|
||||
|
||||
if data['form']['soldeinit'] :
|
||||
self.cr.execute(
|
||||
"SELECT DISTINCT line.partner_id " \
|
||||
@@ -227,7 +217,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
for res_line in res:
|
||||
partner_to_use.append(res_line['partner_id'])
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
|
||||
for res_line in res:
|
||||
partner_to_use.append(res_line['partner_id'])
|
||||
new_ids = partner_to_use
|
||||
@@ -260,7 +250,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
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 " \
|
||||
"FROM account_move_line l " \
|
||||
@@ -278,11 +268,11 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
sum = r['debit'] - r['credit']
|
||||
r['progress'] = sum
|
||||
full_account.append(r)
|
||||
|
||||
|
||||
return full_account
|
||||
|
||||
def _sum_debit_partner(self, partner,data):
|
||||
|
||||
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
if data['form']['reconcil'] :
|
||||
@@ -303,7 +293,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
|
||||
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
@@ -313,14 +303,14 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ") " ,
|
||||
(partner.id,))
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
return result_tmp
|
||||
|
||||
|
||||
def _sum_credit_partner(self, partner,data):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
@@ -342,7 +332,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
@@ -352,13 +342,13 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
"AND date IN (" + self.date_lst_string + ") " ,
|
||||
(partner.id,))
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
return result_tmp
|
||||
|
||||
|
||||
def _sum_debit(self,data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
@@ -389,18 +379,18 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ") "
|
||||
"AND date IN (" + self.date_lst_string + ") "
|
||||
)
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
|
||||
return result_tmp
|
||||
|
||||
|
||||
|
||||
|
||||
def _sum_credit(self,data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
@@ -430,14 +420,14 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
"WHERE partner_id IN (" + self.partner_ids + ") " \
|
||||
# "AND account_id IN (" + self.account_ids + ") " \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ") "
|
||||
"AND date IN (" + self.date_lst_string + ") "
|
||||
)
|
||||
contemp = self.cr.fetchone()
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
else:
|
||||
result_tmp = result_tmp + 0.0
|
||||
|
||||
|
||||
return result_tmp
|
||||
|
||||
def _get_company(self, form):
|
||||
@@ -445,7 +435,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
||||
|
||||
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.name
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
|
||||
'addons/account/report/third_party_ledger.rml',parser=third_party_ledger,
|
||||
header=False)
|
||||
|
||||
Reference in New Issue
Block a user