[FIX] Fix the duplicate survey

lp bug: https://launchpad.net/bugs/784594 fixed

bzr revid: asr@tinyerp.com-20110520125136-s6gqhc847rr97c5d
This commit is contained in:
Ashutosh Srivastava (Open ERP)
2011-05-20 18:21:36 +05:30
parent e7bb8477dc
commit ada1cee936
+5
View File
@@ -96,8 +96,13 @@ class survey(osv.osv):
def copy(self, cr, uid, ids, default=None, context=None):
vals = {}
current_rec = self.read(cr, uid, ids, context=context)
if current_rec.has_key('state'):
val = current_rec['state']
if val['state'] in ('open'):
raise osv.except_osv(_('Error!'),_('Cannot open the duplicate survey in open state'))
title = current_rec.get('title') + ' (Copy)'
vals.update({'title':title})
vals.update({'history':[],'tot_start_survey':0,'tot_comp_survey':0})
return super(survey, self).copy(cr, uid, ids, vals, context=context)
def action_print_survey(self, cr, uid, ids, context=None):