Bugfix :Problem of Report of Crossovered budget on account budget
bzr revid: jvo@tinyerp.com-20080925130210-bmi3uuq26zit9ke3
This commit is contained in:
parent
d286f601cb
commit
18059ab817
|
@ -138,7 +138,7 @@ crossovered_budget()
|
|||
|
||||
class crossovered_budget_lines(osv.osv):
|
||||
|
||||
def _pra_amt(self, cr, uid, ids,name,args,context):
|
||||
def _prac_amt(self, cr, uid, ids,context={}):
|
||||
res = {}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
acc_ids = ','.join([str(x.id) for x in line.general_budget_id.account_ids])
|
||||
|
@ -157,7 +157,14 @@ class crossovered_budget_lines(osv.osv):
|
|||
res[line.id]=result
|
||||
return res
|
||||
|
||||
def _theo_amt(self, cr, uid, ids,name,args,context):
|
||||
def _prac(self, cr, uid, ids,name,args,context):
|
||||
res={}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
res[line.id]=self._prac_amt(cr,uid,[line.id],context=context)[line.id]
|
||||
|
||||
return res
|
||||
|
||||
def _theo_amt(self, cr, uid, ids,context={}):
|
||||
res = {}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
today=datetime.datetime.today()
|
||||
|
@ -184,6 +191,13 @@ class crossovered_budget_lines(osv.osv):
|
|||
res[line.id]=theo_amt
|
||||
return res
|
||||
|
||||
def _theo(self, cr, uid, ids,name,args,context):
|
||||
res={}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
res[line.id]=self._theo_amt(cr,uid,[line.id],context=context)[line.id]
|
||||
|
||||
return res
|
||||
|
||||
def _perc(self, cr, uid, ids,name,args,context):
|
||||
res = {}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
|
@ -202,8 +216,8 @@ class crossovered_budget_lines(osv.osv):
|
|||
'date_to': fields.date('End Date',required=True),
|
||||
'paid_date': fields.date('Paid Date'),
|
||||
'planned_amount':fields.float('Planned Amount',required=True),
|
||||
'practical_amount':fields.function(_pra_amt,method=True, string='Practical Amount',type='float'),
|
||||
'theoritical_amount':fields.function(_theo_amt,method=True, string='Theoritical Amount',type='float'),
|
||||
'practical_amount':fields.function(_prac,method=True, string='Practical Amount',type='float'),
|
||||
'theoritical_amount':fields.function(_theo,method=True, string='Theoritical Amount',type='float'),
|
||||
'percentage':fields.function(_perc,method=True, string='Percentage',type='float'),
|
||||
}
|
||||
crossovered_budget_lines()
|
||||
|
|
|
@ -63,6 +63,7 @@ class budget_report(report_sxw.rml_parse):
|
|||
|
||||
budgets = self.pool.get('crossovered.budget').browse(self.cr, self.uid, [object.id], self.context.copy())
|
||||
|
||||
c_b_lines_obj=self.pool.get('crossovered.budget.lines')
|
||||
for budget_id in budgets:
|
||||
|
||||
res={}
|
||||
|
@ -90,6 +91,7 @@ class budget_report(report_sxw.rml_parse):
|
|||
self.cr.execute('select distinct(analytic_account_id) from crossovered_budget_lines where id in (%s)'%(b_line_ids))
|
||||
an_ids=self.cr.fetchall()
|
||||
|
||||
context={'wizard_date_from':d_from,'wizard_date_to':d_to}
|
||||
for i in range(0,len(an_ids)):
|
||||
|
||||
analytic_name=self.pool.get('account.analytic.account').browse(self.cr, self.uid,[an_ids[i][0]])
|
||||
|
@ -106,9 +108,9 @@ class budget_report(report_sxw.rml_parse):
|
|||
}
|
||||
result.append(res)
|
||||
|
||||
line_ids = self.pool.get('crossovered.budget.lines').search(self.cr, self.uid, [('id', 'in', budget_ids),('analytic_account_id','=',an_ids[i][0])])
|
||||
line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids),('analytic_account_id','=',an_ids[i][0])])
|
||||
|
||||
line_id = self.pool.get('crossovered.budget.lines').browse(self.cr,self.uid,line_ids)
|
||||
line_id = c_b_lines_obj.browse(self.cr,self.uid,line_ids)
|
||||
tot_theo=tot_pln=tot_prac=tot_perc=0.00
|
||||
|
||||
done_budget=[]
|
||||
|
@ -116,8 +118,8 @@ class budget_report(report_sxw.rml_parse):
|
|||
|
||||
if line.id in budget_lines:
|
||||
theo=pract=0.00
|
||||
theo=line._theo_amt(self.cr, self.uid, [line.id],"theoritical_amount",None,context={'wizard_date_from':d_from,'wizard_date_to':d_to})[line.id]
|
||||
pract=line._pra_amt(self.cr, self.uid, [line.id],"practical_amount",None,context={'wizard_date_from':d_from,'wizard_date_to':d_to})[line.id]
|
||||
theo=c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id],context)[line.id]
|
||||
pract=c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id],context)[line.id]
|
||||
|
||||
if line.general_budget_id.id in done_budget:
|
||||
|
||||
|
|
Loading…
Reference in New Issue