[IMP] srcum:Improved wizards for converting backlogs to task

bzr revid: kum@tinyerp.co.in-20100318135021-d1t29o6o0hzn7miv
This commit is contained in:
kum (Open ERP)
2010-03-18 19:20:21 +05:30
parent 8a476160e8
commit fb4bec8c6e
2 changed files with 18 additions and 19 deletions
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 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/>.
#
##############################################################################
@@ -48,21 +48,20 @@ bts_fields = {
def _assign_sprint(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
backlog_obj = pool.get('scrum.product.backlog')
task = pool.get('project.task')
state_open=data['form']['state_open']
task = pool.get('project.task')
state_open = data['form']['state_open']
convert_to_task = data['form']['convert_to_task']
for backlog in backlog_obj.browse(cr, uid, data['ids']):
backlog_obj.write(cr, uid, backlog.id, {'sprint_id':data['form']['sprint_id']})
for backlog in backlog_obj.browse(cr, uid, data['ids'], context=context):
backlog_obj.write(cr, uid, backlog.id, {'sprint_id':data['form']['sprint_id']}, context=context)
if convert_to_task:
task.create(cr, uid, {
'product_backlog_id': backlog.id,
'name': backlog.name,
'description': backlog.note,
'project_id': backlog.project_id.id,
'user_id': (backlog.user_id and backlog.user_id.id) or uid,
'planned_hours': backlog.planned_hours
'user_id': False,
'planned_hours':backlog.planned_hours,
'remaining_hours':backlog.expected_hours,
})
if state_open:
if backlog.state == "draft":
+9 -9
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 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/>.
#
##############################################################################
@@ -34,10 +34,10 @@ btt_fields = {
'user_id' : {'string':'Assign To', 'type':'many2one', 'relation':'res.users'},
}
def _do_create(self, cr, uid, data, context):
def _do_create(self, cr, uid, data, context={}):
pool = pooler.get_pool(cr.dbname)
backlogs = pool.get('scrum.product.backlog').browse(cr, uid, data['ids'])
mod_obj = pool.get('ir.model.data')
backlogs = pool.get('scrum.product.backlog').browse(cr, uid, data['ids'], context=context)
mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form')
id = mod_obj.read(cr, uid, result, ['res_id'])
ids = []
@@ -48,10 +48,10 @@ def _do_create(self, cr, uid, data, context):
'name': backlog.name,
'description': backlog.note,
'project_id': backlog.project_id.id,
'user_id': data['form']['user_id'] or (backlog.user_id and backlog.user_id.id) or uid,
'planned_hours': backlog.planned_hours
'user_id': data['form']['user_id'] or False,
'planned_hours': backlog.planned_hours,
'remaining_hours':backlog.expected_hours,
}))
value = {
'domain': "[('product_backlog_id','in',["+','.join(map(str,data['ids']))+"])]",
'name': 'Open Backlog Tasks',
@@ -60,7 +60,7 @@ def _do_create(self, cr, uid, data, context):
'res_model': 'project.task',
'view_id': False,
'type': 'ir.actions.act_window',
'search_view_id': id['res_id']
'search_view_id': id['res_id'],
}
return value