diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 7e6ef369b3c..cfa1cb8c46a 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -33,7 +33,6 @@ class survey_type(osv.osv): _description = 'Survey Type' _columns = { 'name': fields.char("Name", size=128, required=1, translate=True), - 'code': fields.char("Code", size=64), } survey_type() @@ -94,11 +93,9 @@ class survey(osv.osv): help="Set to one if survey is answerable only once"), 'state': fields.selection([('draft', 'Draft'), ('open', 'Open'), ('close', 'Close'), ('cancel', 'Cancelled')], 'Status', required=1), 'sign_in': fields.boolean('User must be sign up'), - 'responsible_id': fields.many2one('res.users', 'Responsible', help="User responsible forsurvey"), 'tot_start_survey': fields.function(_get_tot_start_survey, string="Total Started Survey", type="integer"), 'tot_comp_survey': fields.function(_get_tot_comp_survey, string="Total Completed Survey", type="integer"), 'note': fields.text('Description', size=128), - 'send_response': fields.boolean('Email Notification on Answer'), 'type': fields.many2one('survey.type', 'Type'), 'color': fields.integer('Color Index'), 'response_ids': fields.one2many('survey.response', 'survey_id', 'Responses', readonly=1), @@ -108,7 +105,6 @@ class survey(osv.osv): _defaults = { 'state': "draft", 'sign_in': False, - 'send_response': 1, 'date_open': fields.datetime.now, 'token': lambda s, cr, uid, c: uuid.uuid4(), } diff --git a/addons/survey/survey_data.xml b/addons/survey/survey_data.xml index 7627c5d54b0..20410f5ea38 100644 --- a/addons/survey/survey_data.xml +++ b/addons/survey/survey_data.xml @@ -3,15 +3,12 @@ Human Resources - Human Resources Customer Feeback - Customer Feeback Supplier Selection - Supplier Selection diff --git a/addons/survey/survey_demo.xml b/addons/survey/survey_demo.xml index f5c732cf405..e92ff25f3e6 100644 --- a/addons/survey/survey_demo.xml +++ b/addons/survey/survey_demo.xml @@ -9,7 +9,6 @@ Initial Partner Feedback - 20 open @@ -157,7 +156,6 @@ OpenERP Partner Feedback - 20 open @@ -622,7 +620,6 @@ Odoo Feedback - 20 open @@ -1396,7 +1393,6 @@ - 4 20 @@ -2247,8 +2243,6 @@ Please take a few minutes to complete this survey on the quality of service we provide. We welcome your feedback and appreciate your honesty. With your help, we hope to strengthen the bond between our clients. open 0 - - 20 diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 6ce7ea940f3..d8d34bc41d0 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -41,18 +41,11 @@ - - - + - - - - - - + @@ -229,7 +222,6 @@ - @@ -254,11 +246,8 @@ - - - @@ -275,7 +264,6 @@ - @@ -305,9 +293,9 @@
@@ -1140,7 +1128,6 @@
-
@@ -1151,7 +1138,6 @@ -
diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 478b36260b9..cb0ef320e2f 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -190,27 +190,18 @@ class survey_question_wiz(osv.osv_memory): def _survey_complete(self, cr, uid, survey_id, partner_id, sur_name_read, survey_browse, context): """ list of action to do when the survey is completed """ - survey_obj = self.pool.get('survey') - sur_response_obj = self.pool.get('survey.response') - # record complete - sur_response_obj.write(cr, uid, [sur_name_read.response], {'state': 'done'}) + self.pool.get('survey.response').write(cr, uid, [sur_name_read.response], {'state': 'done'}) # send mail to the responsible - survey_browse = survey_obj.browse(cr, uid, survey_id, context) - responsible_id = survey_browse.responsible_id and survey_browse.responsible_id.id or False - if survey_browse.send_response and responsible_id: - val = { - 'type': 'notification', - 'author_id': partner_id or None, - 'partner_ids': responsible_id and [responsible_id] or None, - 'model': 'survey', - 'res_id': survey_id, - 'record_name': _("Survey N° %s") % survey_id, - 'subject': survey_browse.title or None, - 'body': _("A survey answer is completed."), - } - self.pool.get('mail.message').create(cr, uid, val, context=context) + val = { + 'type': 'notification', + 'model': 'survey', + 'res_id': survey_id, + 'record_name': _("Survey N° %s") % survey_id, + 'body': _("New response on this survey."), + } + self.pool.get('survey').message_post(cr, uid, survey_id, context=context, **val) def _check_access(self, cr, uid, survey_id, context): # get if the token of the partner or anonymous user is valid @@ -442,7 +433,7 @@ class survey_question_wiz(osv.osv_memory): else: etree.SubElement(xml_footer, 'label', {'string': ""}) etree.SubElement(xml_footer, 'button', {'name': "action_next", 'string': tools.ustr(but_string), 'type': "object", 'context': tools.ustr(context), 'class': "oe_highlight"}) - if context.get('ir_actions_act_window_target', None): + if context.get('ir_actions_act_window_target', None) != 'inline': etree.SubElement(xml_footer, 'label', {'string': "or"}) etree.SubElement(xml_footer, 'button', {'special': "cancel", 'string': "Exit", 'class': "oe_link"}) etree.SubElement(xml_footer, 'label', {'string': tools.ustr(page_number + 1) + "/" + tools.ustr(total_pages), 'class': "oe_survey_title_page oe_right"}) diff --git a/addons/survey/wizard/survey_email_compose_message.py b/addons/survey/wizard/survey_email_compose_message.py index 3616f4eb1f8..0c7f7e4a2d1 100644 --- a/addons/survey/wizard/survey_email_compose_message.py +++ b/addons/survey/wizard/survey_email_compose_message.py @@ -92,8 +92,8 @@ class survey_mail_compose_message(osv.TransientModel): # post the message values = { - 'model': 'survey', - 'res_id': wizard.res_id or False, + 'model': None, + 'res_id': None, 'subject': wizard.subject, 'body': wizard.body.replace("__URL__", url), 'parent_id': None, diff --git a/addons/survey/wizard/survey_email_compose_message.xml b/addons/survey/wizard/survey_email_compose_message.xml index 870ba22def3..ee5b5caee54 100644 --- a/addons/survey/wizard/survey_email_compose_message.xml +++ b/addons/survey/wizard/survey_email_compose_message.xml @@ -5,7 +5,6 @@ Survey - Send by Email - ${object.responsible_id and object.responsible_id.company_id and object.responsible_id.company_id.email or object.responsible_id.email or ''} ${object.title} ${object.lang} @@ -17,10 +16,7 @@ Would you please spent some of your time to fill-in our survey: ${object.title}

- % if object.responsible_id: -

Thank you for choosing ${object.responsible_id.company_id.name or 'us'}!

- % endif -
+

Thank you for choosing us!

]]>