Account_Report:Tree-structured report content for Indicators.
bzr revid: jvo@tinyerp.com-20081119105447-zj7pyqbrzid8vvgt
This commit is contained in:
parent
5baa991303
commit
fc46ab031f
|
@ -74,7 +74,7 @@ class account_report(osv.osv):
|
||||||
del context['fiscalyear']
|
del context['fiscalyear']
|
||||||
acc = self.pool.get('account.account')
|
acc = self.pool.get('account.account')
|
||||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||||
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0)
|
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||||
|
|
||||||
def _calc_debit(code,year=0):
|
def _calc_debit(code,year=0):
|
||||||
context['fiscalyear']=_calc_context(year,obj_fy)
|
context['fiscalyear']=_calc_context(year,obj_fy)
|
||||||
|
@ -82,7 +82,7 @@ class account_report(osv.osv):
|
||||||
del context['fiscalyear']
|
del context['fiscalyear']
|
||||||
acc = self.pool.get('account.account')
|
acc = self.pool.get('account.account')
|
||||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||||
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0)
|
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||||
|
|
||||||
def _calc_balance(code,year=0):
|
def _calc_balance(code,year=0):
|
||||||
context['fiscalyear']=_calc_context(year,obj_fy)
|
context['fiscalyear']=_calc_context(year,obj_fy)
|
||||||
|
@ -90,12 +90,12 @@ class account_report(osv.osv):
|
||||||
del context['fiscalyear']
|
del context['fiscalyear']
|
||||||
acc = self.pool.get('account.account')
|
acc = self.pool.get('account.account')
|
||||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||||
return reduce(lambda y,x=0: x.balance+y, acc.browse(cr, uid, acc_id, context),0)
|
return reduce(lambda y,x=0: x.balance+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||||
|
|
||||||
def _calc_report(*code):
|
def _calc_report(*code):
|
||||||
acc = self.pool.get('account.report.report')
|
acc = self.pool.get('account.report.report')
|
||||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||||
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0)
|
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||||
|
|
||||||
def _calc_tax_code(code,period=0):
|
def _calc_tax_code(code,period=0):
|
||||||
context['period_id']=_calc_context(period,obj_period)
|
context['period_id']=_calc_context(period,obj_period)
|
||||||
|
@ -104,7 +104,7 @@ class account_report(osv.osv):
|
||||||
context['period_id']=context['period_id'][0]
|
context['period_id']=context['period_id'][0]
|
||||||
acc = self.pool.get('account.tax.code')
|
acc = self.pool.get('account.tax.code')
|
||||||
acc_id = acc.search(cr, uid, [('code','in',code)])
|
acc_id = acc.search(cr, uid, [('code','in',code)])
|
||||||
return reduce(lambda y,x=0: x.sum_period+y, acc.browse(cr, uid, acc_id, context),0)
|
return reduce(lambda y,x=0: x.sum_period+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||||
result = {}
|
result = {}
|
||||||
for rep in self.browse(cr, uid, ids, context):
|
for rep in self.browse(cr, uid, ids, context):
|
||||||
objdict = {
|
objdict = {
|
||||||
|
|
|
@ -208,7 +208,8 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||||
level=0
|
level=0
|
||||||
self.level=0
|
self.level=0
|
||||||
self.child_dist=0
|
self.child_dist=0
|
||||||
def draw_tree2(obj_history,base_x,base_y,level=0,i=0):
|
|
||||||
|
def draw_tree(obj_history,base_x,base_y,level=0,i=0):
|
||||||
self.line_y=base_y
|
self.line_y=base_y
|
||||||
if obj_history.child_ids:
|
if obj_history.child_ids:
|
||||||
if self.child_dist:
|
if self.child_dist:
|
||||||
|
@ -235,7 +236,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
for child in obj_history.child_ids:
|
for child in obj_history.child_ids:
|
||||||
draw_tree2(child,base_x+(100),base_y,level,i)
|
draw_tree(child,base_x+(100),base_y,level,i)
|
||||||
i+=1
|
i+=1
|
||||||
|
|
||||||
child_dist=len(obj_history.child_ids)
|
child_dist=len(obj_history.child_ids)
|
||||||
|
@ -248,7 +249,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||||
else:
|
else:
|
||||||
base_y=base_y-(50*(i))
|
base_y=base_y-(50*(i))
|
||||||
|
|
||||||
tb12 = text_box.T(loc=(base_x,base_y), text=str(obj_history.code))
|
tb12 = text_box.T(loc=(base_x,base_y), text="/hC"+str(obj_history.code)+":\n"+str(obj_history.amount))
|
||||||
tb12.draw()
|
tb12.draw()
|
||||||
|
|
||||||
if i>0:
|
if i>0:
|
||||||
|
@ -257,7 +258,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||||
a.draw([(base_x-30,base_y), (base_x,base_y)])
|
a.draw([(base_x-30,base_y), (base_x,base_y)])
|
||||||
self.level=base_y
|
self.level=base_y
|
||||||
self.line_y=900
|
self.line_y=900
|
||||||
draw_tree2(obj_history,0,900,0)
|
draw_tree(obj_history,0,900,0)
|
||||||
can.close()
|
can.close()
|
||||||
|
|
||||||
os.system('cp '+'tree_image'+str(self.treecount)+'.png ' +path+str(self.treecount)+'.png')
|
os.system('cp '+'tree_image'+str(self.treecount)+'.png ' +path+str(self.treecount)+'.png')
|
||||||
|
|
Loading…
Reference in New Issue