Dev with Bob

bzr revid: bch-52559f0f91f1679e14d5e683331c52e23ea73578
This commit is contained in:
bch 2007-01-11 09:19:34 +00:00
parent 137aa2ce97
commit e7e5cbab01
1 changed files with 21 additions and 8 deletions

View File

@ -60,14 +60,27 @@ class account_analytic_budget_report(report_sxw.rml_parse):
res[k] += r[k]
return [res]
def lines_rec(self, post_obj, date1, date2):
res = []
for a in post_obj.account_ids:
self.cr.execute("SELECT COALESCE(SUM(debit-credit), 0) FROM account_move_line WHERE account_id=%d AND date>=%s AND date<=%s and state<>'draft'", (a.id, date1, date2))
achievements = float(self.cr.fetchone()[0]) * (post_obj.sens=='produit' and -1 or 1)
res.append({'name': a.name, 'code': a.code, 'achievements': achievements})
#for c in a.child_ids: # FIXME : JUST AN IDEA doesn't work
#res.extend(lines_rec(post_obj, date1, date2))
#NEW
# def lines_rec(self, a, post_obj, date1, date2):
# self.cr.execute("SELECT COALESCE(SUM(debit-credit), 0) FROM account_move_line WHERE account_id=%d AND date>=%s AND date<=%s and state<>'draft'", (a.id, date1, date2))
# achievements = float(self.cr.fetchone()[0]) * (post_obj.sens=='produit' and -1 or 1)
# res= {'name': a.name, 'code': a.code, 'achievements': achievements}
# for c in a.child_ids:
# res.extend(lines_rec(child, post_obj, date1, date2))
# return res
#OLD
# for a in post_obj.account_ids:
# self.cr.execute("SELECT COALESCE(SUM(debit-credit), 0) FROM account_move_line WHERE account_id=%d AND date>=%s AND date<=%s and state<>'draft'", (a.id, date1, date2))
# achievements = float(self.cr.fetchone()[0]) * (post_obj.sens=='produit' and -1 or 1)
# res.append({'name': a.name, 'code': a.code, 'achievements': achievements})
# for c in a.child_ids: # FIXME : JUST AN IDEA doesn't work
# res.extend(lines_rec(post_obj, date1, date2))
def lines(self, post_obj, date1, date2):
res = []