Corrected Aged receivable reports

bzr revid: jvo@tinyerp.com-20090327115624-1clgz78v4e307hsi
This commit is contained in:
Jay (Open ERP) 2009-03-27 17:26:24 +05:30
parent e8696ddb2e
commit 9035a23859
2 changed files with 8 additions and 6 deletions

View File

@ -61,7 +61,7 @@ class aged_trial_report(rml_parse.rml_parse):
context={'fiscalyear': form['fiscalyear']})
self.cr.execute("SELECT DISTINCT res_partner.id AS id, " \
"res_partner.name AS name " \
"FROM res_partner,account_move_line AS line, account_account,account_move_reconcile AS recon " \
"FROM res_partner,account_move_line AS line, account_account " \
"WHERE (line.account_id=account_account.id) " \
"AND ((reconcile_id IS NULL) " \
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \

View File

@ -103,10 +103,10 @@ class report_aged_receivable(osv.osv):
res = {}
for period in self.read(cr,uid,ids,['name']):
date1,date2 = period['name'].split(' to ')
query = "SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
query = "SELECT SUM(debit-credit) FROM account_move_line AS line, account_account as ac \
WHERE (line.account_id=ac.id) AND ac.type='receivable' \
AND (COALESCE(line.date,date) BETWEEN '%s' AND '%s') \
AND (reconcile_id IS NULL) AND ac.active"%(str(date2),str(date1))
AND ((reconcile_id IS NULL) OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > '%s' ))) AND ac.active"%(str(date2),str(date1),str(date1))
cr.execute(query)
amount = cr.fetchone()
amount = amount[0] or 0.00
@ -121,12 +121,14 @@ class report_aged_receivable(osv.osv):
def init(self, cr, uid=1):
""" This view will be used in dashboard
The reason writing this code here is, we need to check date range from today to first date of fiscal year.
"""
# ranges = _get_ranges(cr) # Gets the ranges for the x axis of the graph (name column values)
pool_obj_fy = pooler.get_pool(cr.dbname).get('account.fiscalyear')
today = mx.DateTime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') - mx.DateTime.RelativeDateTime(days=1)
today = today.strftime('%Y-%m-%d')
fy_id = pool_obj_fy.find(cr,uid)
# today = mx.DateTime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') - mx.DateTime.RelativeDateTime(days=1)
today = time.strftime('%Y-%m-%d')
fy_id = pool_obj_fy.find(cr,uid)
LIST_RANGES = []
if fy_id:
fy_start_date = pool_obj_fy.read(cr, uid, fy_id, ['date_start'])['date_start']