[IMP]:scrum modules sql queries to parameterized query
bzr revid: nch@tinyerp.com-20091123114956-lr17g8i6fjp74o4e
This commit is contained in:
parent
363c136135
commit
9da3063328
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -26,14 +26,13 @@ import time
|
|||
def compute_burndown(cr, uid, tasks_id, date_start, date_stop):
|
||||
latest = False
|
||||
if len(tasks_id):
|
||||
cr.execute('select id,create_date,state,planned_hours from project_task where id in ('+','.join(map(str,tasks_id))+') order by create_date')
|
||||
cr.execute('select id,create_date,state,planned_hours from project_task where id in %s order by create_date',(tuple(tasks_id),))
|
||||
tasks = cr.fetchall()
|
||||
|
||||
cr.execute('select w.date,w.hours from project_task_work w left join project_task t on (t.id=w.task_id) where t.id in ('+','.join(map(str,tasks_id))+') and t.state in (\'open\',\'progress\') order by date')
|
||||
|
||||
cr.execute('select w.date,w.hours from project_task_work w left join project_task t on (t.id=w.task_id) where t.id in %s and t.state in (%s,%s) order by date',(tuple(tasks_id),'open','progress',))
|
||||
tasks2 = cr.fetchall()
|
||||
|
||||
cr.execute('select date_close,planned_hours from project_task where id in ('+','.join(map(str,tasks_id))+') and state in (\'cancelled\',\'done\') order by date_close')
|
||||
cr.execute('select date_close,planned_hours from project_task where id in %s and state in (%s,%s) order by date_close' ,(tuple(tasks_id),'cancelled','done',))
|
||||
tasks2 += cr.fetchall()
|
||||
tasks2.sort()
|
||||
else:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -42,9 +42,10 @@ class external_pdf(render):
|
|||
|
||||
def burndown_chart(cr, uid, tasks_id, date_start, date_stop):
|
||||
latest = False
|
||||
cr.execute('select id,date_start,state,planned_hours from project_task where id in ('+','.join(map(str,tasks_id))+') order by date_start')
|
||||
|
||||
cr.execute('select id,date_start,state,planned_hours from project_task where id in %s order by date_start'(tuple(tasks_id),))
|
||||
tasks = cr.fetchall()
|
||||
cr.execute('select id,date_close,state,planned_hours*progress/100 from project_task where id in ('+','.join(map(str,tasks_id))+') and state in (%s,%s) order by date_close', ('progress','done'))
|
||||
cr.execute('select id,date_close,state,planned_hours*progress/100 from project_task where id in %s and state in (%s,%s) order by date_close', (tuple(tasks_id),'progress','done',))
|
||||
tasks2 = cr.fetchall()
|
||||
current_date = date_start
|
||||
total = 0
|
||||
|
@ -71,14 +72,14 @@ class report_tasks(report_int):
|
|||
io = StringIO.StringIO()
|
||||
|
||||
if 'date_start' not in datas:
|
||||
cr.execute('select min(date_start) from project_task where id in ('+','.join(map(str, ids))+')')
|
||||
cr.execute('select min(date_start) from project_task where id in %s',(tuple(ids),))
|
||||
dt = cr.fetchone()[0]
|
||||
if dt:
|
||||
datas['date_start'] = dt[:10]
|
||||
else:
|
||||
datas['date_start'] = time.strftime('%Y-%m-%d')
|
||||
if 'date_stop' not in datas:
|
||||
cr.execute('select max(date_start),max(date_close) from project_task where id in ('+','.join(map(str, ids))+')')
|
||||
cr.execute('select max(date_start),max(date_close) from project_task where id in %s',(tuple(ids),))
|
||||
res = cr.fetchone()
|
||||
datas['date_stop'] = (res[0] and res[0][:10]) or time.strftime('%Y-%m-%d')
|
||||
if res[1] and datas['date_stop']<res[1]:
|
||||
|
|
Loading…
Reference in New Issue