diff --git a/addons/account/report/aged_trial_balance.py b/addons/account/report/aged_trial_balance.py index c268c643537..447aa7a5cb8 100644 --- a/addons/account/report/aged_trial_balance.py +++ b/addons/account/report/aged_trial_balance.py @@ -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 ))) " \ diff --git a/addons/report_account/report_receivable.py b/addons/report_account/report_receivable.py index 1cb353b9f07..cd22daeebe5 100644 --- a/addons/report_account/report_receivable.py +++ b/addons/report_account/report_receivable.py @@ -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']