solved error of fiscal year and period in report-account_balance.py

bzr revid: jvo@tinyerp.com-20080728134757-lll1l23vo829ox8z
This commit is contained in:
Jay Vora
2008-07-28 19:17:57 +05:30
parent c5a38b2a18
commit 931e97624b
+19 -6
View File
@@ -44,16 +44,29 @@ class account_balance(report_sxw.rml_parse):
'get_periods':self.get_periods,
})
self.context = context
def get_fiscalyear(self, form):
fisc_id = form['fiscalyear']
self.cr.execute("select name from account_fiscalyear where id = %d" %(int(fisc_id)))
res=self.cr.fetchone()
return res and res[0] or ''
if fisc_id:
self.cr.execute("select name from account_fiscalyear where id = %d" %(int(fisc_id)))
else:
self.cr.execute("select name from account_fiscalyear where state='draft'")
res=self.cr.fetchall()
result=''
for r in res:
result+=r[0]+","
return str(result and result[:-1]) or ''
def get_periods(self, form):
period_ids = ",".join([str(x) for x in form['periods'][0][2] if x])
self.cr.execute("select name from account_period where id in (%s)" % (period_ids))
periods=form['periods'][0][2]
if periods:
period_ids = ",".join([str(x) for x in form['periods'][0][2] if x])
self.cr.execute("select name from account_period where id in (%s)" % (period_ids))
else:
if form['fiscalyear']:
self.cr.execute("select name from account_period where fiscalyear_id = %d"%(int(form['fiscalyear'])))
else:
self.cr.execute("select name from account_period")
res=self.cr.fetchall()
result=''
for r in res: