[IMP] srcum:Improved wizards for converting backlogs to task
bzr revid: kum@tinyerp.co.in-20100318135021-d1t29o6o0hzn7miv
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user