Merge lp:~serpent-consulting-services/openobject-addons/trunk-882288-SerpentCS into lp:openobject-addons

Proposed by Serpent Consulting Services
Status: Merged
Approved by: Raphael Collet (OpenERP)
Approved revision: no longer in the source branch.
Merged at revision: 5555
Proposed branch: lp:~serpent-consulting-services/openobject-addons/trunk-882288-SerpentCS
Merge into: lp:openobject-addons
Diff against target: 116 lines (+16/-21)
3 files modified
survey/test/survey00.yml (+1/-1)
survey/wizard/survey_answer.py (+14/-19)
survey/wizard/survey_selection.py (+1/-1)
To merge this branch: bzr merge lp:~serpent-consulting-services/openobject-addons/trunk-882288-SerpentCS
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+80518@code.launchpad.net

Description of the change

The merge attached here:

1. Fixes the very first error you reported.
2. Fixes the problem of fetching address from user record, which is no more a case in 6.1.
3. Fixes the problem of default_get() at the end of the survey.
4. Correction over the YML string.
5. Better notification as an email message with enhanced body mEssage.

Thanks,
Serpent Consulting Services.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'survey/test/survey00.yml'
2--- survey/test/survey00.yml 2011-10-02 17:31:16 +0000
3+++ survey/test/survey00.yml 2011-10-26 23:34:25 +0000
4@@ -147,7 +147,7 @@
5 id = self.create(cr, uid, {'survey_id': ref("survey_partner_0")})
6 self.action_next(cr, uid, [id], context)
7 -
8- Give answer of the first and second page in "Partner Feedback" suvey.
9+ Give answer of the first and second page in "Partner Feedback" survey.
10 -
11 !python {model: survey.question.wiz}: |
12 ids = self.create(cr, uid, {str(ref("survey_p_question_0")) +"_single" :'Tiny' , str(ref("survey_p_question_1")) + "_selection" :int(ref("survey_p_1_1"))}, context)
13
14=== modified file 'survey/wizard/survey_answer.py'
15--- survey/wizard/survey_answer.py 2011-10-19 10:08:36 +0000
16+++ survey/wizard/survey_answer.py 2011-10-26 23:34:25 +0000
17@@ -42,7 +42,8 @@
18 """
19 Fields View Get method :- generate the new view and display the survey pages of selected survey.
20 """
21-
22+ if context is None:
23+ context = {}
24 result = super(survey_question_wiz, self).fields_view_get(cr, uid, view_id, \
25 view_type, context, toolbar,submenu)
26
27@@ -55,8 +56,7 @@
28 que_col_head = self.pool.get('survey.question.column.heading')
29 user_obj = self.pool.get('res.users')
30 mail_message = self.pool.get('mail.message')
31- if context is None:
32- context = {}
33+
34 if view_type in ['form']:
35 wiz_id = 0
36 sur_name_rec = None
37@@ -407,21 +407,13 @@
38 attachments[survey_data.title + ".pdf"] = file_data
39 file.close()
40 os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
41- user_email = False
42- resp_email = False
43-
44- address_id = user_obj.browse(cr, uid, uid).address_id.id
45- if address_id:
46- cr.execute("select email from res_partner_address where id =%s", (address_id,))
47- user_email = cr.fetchone()[0]
48- resp_id = survey_data.responsible_id.address_id
49-
50- if resp_id:
51- cr.execute("select email from res_partner_address where id =%s", (resp_id.id,))
52- resp_email = cr.fetchone()[0]
53+
54+ user_email = user_obj.browse(cr, uid, uid, context).user_email
55+ resp_email = survey_data.responsible_id and survey_data.responsible_id.user_email or False
56+
57 if user_email and resp_email:
58 user_name = user_obj.browse(cr, uid, uid, context=context).name
59- mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_name) + " Give Response Of " + survey_data.title + " Survey.\n\n Thanks,"
60+ mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_name) + " has given the Response Of " + survey_data.title + " Survey.\nThe Response has been attached herewith.\n\n Thanks."
61 mail_message.schedule_with_attach(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, attachments=attachments, context=context)
62
63 xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
64@@ -520,9 +512,10 @@
65 return value
66 if context.has_key('active') and context.get('active',False):
67 return value
68-
69+
70 sur_name_read = surv_name_wiz.read(cr, uid, context.get('sur_name_id',False))
71 ans_list = []
72+
73 for key,val in safe_eval(sur_name_read.get('store_ans',"{}")).items():
74 for field in fields_list:
75 if field in list(val):
76@@ -535,8 +528,10 @@
77 Create the Answer of survey and store in survey.response object, and if set validation of question then check the value of question if value is wrong then raise the exception.
78 """
79 if context is None: context = {}
80+
81+ survey_question_wiz_id = super(survey_question_wiz,self).create(cr, uid, vals, context=context)
82 if context.has_key('active') and context.get('active',False):
83- return True
84+ return survey_question_wiz_id
85
86 for key,val in vals.items():
87 if key.split('_')[0] == "progress":
88@@ -982,7 +977,7 @@
89 if que_rec['type'] in ['multiple_choice_only_one_ans','single_textbox','comment'] and que_rec['is_require_answer'] and select_count <= 0:
90 raise osv.except_osv(_('Warning !'), "'" + que_rec['question'] + "' " + tools.ustr(que_rec['req_error_msg']))
91
92- return True
93+ return survey_question_wiz_id
94
95 def action_new_question(self,cr, uid, ids, context=None):
96 """
97
98=== modified file 'survey/wizard/survey_selection.py'
99--- survey/wizard/survey_selection.py 2011-10-02 17:31:16 +0000
100+++ survey/wizard/survey_selection.py 2011-10-26 23:34:25 +0000
101@@ -41,6 +41,7 @@
102 'transfer': 1,
103 'response': 0,
104 'survey_id': lambda self,cr,uid,context:context.get('survey_id',False),
105+ 'store_ans': '{}' #Setting the default pattern as '{}' as the field is of type text. The field always gets the value in dict format
106 }
107
108 def action_next(self, cr, uid, ids, context=None):
109@@ -68,7 +69,6 @@
110 raise osv.except_osv(_('Warning !'),_("You can not give more response. Please contact the author of this survey for further assistance."))
111
112 search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
113-
114 return {
115 'view_type': 'form',
116 "view_mode": 'form',

Subscribers

People subscribed via source and target branches

to all changes: