Merge lp:~openerp-dev/openobject-addons/trunk-bug-1103057-cga into lp:openobject-addons

Proposed by Chandni Gandhi(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1103057-cga
Merge into: lp:openobject-addons
Diff against target: 40 lines (+12/-4)
1 file modified
survey/survey.py (+12/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1103057-cga
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+146564@code.launchpad.net

Description of the change

Hello,

Add unlink for survey answers.

Thanks.

To post a comment you must log in.
8533. By Chandni Gandhi(OpenERP)

[MERGE]:With latest code

Unmerged revisions

8533. By Chandni Gandhi(OpenERP)

[MERGE]:With latest code

8532. By Chandni Gandhi(OpenERP)

[FIX]:Add unlink in survey answer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'survey/survey.py'
2--- survey/survey.py 2012-12-06 14:56:32 +0000
3+++ survey/survey.py 2013-02-08 11:38:23 +0000
4@@ -400,7 +400,10 @@
5 val.update({'in_visible_rating_weight':True, 'in_visible_menu_choice':True,\
6 'in_visible_answer_type':True})
7 return {'value': val}
8-
9+
10+ def unlink(self, cr, uid, ids, context=None):
11+ return osv.osv.unlink(self, cr, uid, ids, context=context)
12+
13 def write(self, cr, uid, ids, vals, context=None):
14 questions = self.read(cr,uid, ids, ['answer_choice_ids', 'type', 'required_type',\
15 'req_ans', 'minimum_req_ans', 'maximum_req_ans', 'column_heading_ids', 'page_id', 'question'])
16@@ -428,8 +431,6 @@
17 for ans in vals['answer_choice_ids']:
18 if type(ans[2]) == type({}):
19 ans_len += 1
20- else:
21- ans_len -= 1
22
23 if que_type not in ['descriptive_text', 'single_textbox', 'comment','table']:
24 if not ans_len:
25@@ -650,7 +651,14 @@
26 context = {}
27 data = super(survey_answer, self).default_get(cr, uid, fields, context)
28 return data
29-
30+
31+ def unlink(self, cr, uid, ids, context=None):
32+ q = self.browse(cr,uid,ids[0]).question_id
33+ res = osv.osv.unlink(self, cr, uid, ids, context=context)
34+
35+ if not len(q.answer_choice_ids):
36+ raise osv.except_osv(_('Warning!'),_('You must enter at least one Answers for question "%s"') % (q.question))
37+ return res
38 survey_answer()
39
40 class survey_response(osv.osv):

Subscribers

People subscribed via source and target branches

to all changes: