diff options
| author | Vijaykumar Baladaniya <vba@tinyerp.com> | 2012-08-21 11:06:25 +0530 |
|---|---|---|
| committer | Vijaykumar Baladaniya <vba@tinyerp.com> | 2012-08-21 11:06:25 +0530 |
| commit | 7245850cf75d038483cf85fa09c7d25fbef57f3a (patch) | |
| tree | 2f90576b543f56945e2ef328ebf7e1ca621b276d /addons | |
| parent | f4f0d42a70d62320b0d0b0d3aab16336b696a485 (diff) | |
Fixed footer for wizard navigation
bzr revid: vba@tinyerp.com-20120821053625-wwoki5pcd4xrw4fj
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/survey/__openerp__.py | 1 | ||||
| -rw-r--r-- | addons/survey/static/src/css/survey.css | 2 | ||||
| -rw-r--r-- | addons/survey/static/src/js/survey.js | 24 | ||||
| -rw-r--r-- | addons/survey/survey.py | 22 | ||||
| -rw-r--r-- | addons/survey/survey_view.xml | 12 | ||||
| -rw-r--r-- | addons/survey/wizard/survey_answer.py | 40 |
6 files changed, 48 insertions, 53 deletions
diff --git a/addons/survey/__openerp__.py b/addons/survey/__openerp__.py index 7f8a0f63fb4..62f0848ebcc 100644 --- a/addons/survey/__openerp__.py +++ b/addons/survey/__openerp__.py @@ -59,6 +59,5 @@ user name and password for the invitation of the survey. 'certificate' : '001131639736864143245', 'images': ['images/survey_answers.jpeg','images/survey_pages.jpeg','images/surveys.jpeg'], 'css': ['static/src/css/survey.css','static/css/survey.css'], - 'js' : ['static/src/js/survey.js'], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/survey/static/src/css/survey.css b/addons/survey/static/src/css/survey.css index 746f7a1d465..ef79300fbbd 100644 --- a/addons/survey/static/src/css/survey.css +++ b/addons/survey/static/src/css/survey.css @@ -6,7 +6,7 @@ } .oe_survey_title_height{ - height: 33px; + height: 26px; } .oe_survey_title_page { diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js deleted file mode 100644 index 13b32321735..00000000000 --- a/addons/survey/static/src/js/survey.js +++ /dev/null @@ -1,24 +0,0 @@ -openerp.survey = function (instance) { - var QWeb = instance.web.qweb, - _t = instance.web._t; - instance.web.ViewManagerAction = instance.web.ViewManagerAction.extend({ - on_mode_switch: function (view_type, no_store, options) { - var self = this; - return $.when(this._super.apply(this, arguments)).then(function () { - var controller = self.views[self.active_view].controller, - fvg = controller.fields_view, - view_id = (fvg && fvg.view_id) || '--'; - self.$element.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', { - view: controller, - view_manager: self - })); - if (!self.action.name && fvg) { - var title = self.$element.find('.oe_view_title_text'); - if(!_.isEmpty(title)) - title = $('.ui-dialog-title'); - title.text(fvg.arch.attrs.string || fvg.name); - } - }); - }, - }); -}; diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 4a07f887b6b..255128ffba0 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -149,15 +149,33 @@ class survey(osv.osv): return report def fill_survey(self, cr, uid, ids, context=None): + sur_obj = self.read(cr, uid, ids,['title'], context=context) + for sur in sur_obj: + name = sur['title'] + context.update({'active':False,'survey_id': ids[0]}) return { 'view_type': 'form', 'view_mode': 'form', 'res_model': 'survey.question.wiz', 'type': 'ir.actions.act_window', 'target': 'new', - 'context': {'survey_id': ids[0]} + 'name': name, + 'context': context + } + def test_survey(self, cr, uid, ids, context=None): + sur_obj = self.read(cr, uid, ids,['title'], context=context) + for sur in sur_obj: + name = sur['title'] + context.update({'active':True,'survey_id': ids[0]}) + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'survey.question.wiz', + 'type': 'ir.actions.act_window', + 'target': 'new', + 'name': name, + 'context': context } - survey() class survey_history(osv.osv): diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 159d1673d5f..753dfab208b 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -26,8 +26,8 @@ </header> <sheet> <div class="oe_button_box oe_right"> - <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel" string="Test Survey" type="action" icon="gtk-new" context="{'active':True,'survey_id': active_id}" attrs="{'invisible':[('id','=',0)]}"/> - <button name="%(action_view_survey_question_message)d" states="open" string="Answer Survey" type="action" icon="gtk-execute" context="{'active':False, 'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/> + <button name="test_survey" states="open,draft,close,cancel" string="Test Survey" type="object" icon="gtk-new" context="{'survey_id': active_id}" attrs="{'invisible':[('id','=',0)]}"/> + <button name="fill_survey" states="open" string="Answer Survey" type="object" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/> </div> <div class="oe_title"> <label for="title" class="oe_edit_only"/> @@ -254,11 +254,11 @@ <field name="tot_start_survey" string="Started"/> <field name="tot_comp_survey" string="Completed"/> <field name="state"/> - <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel" - string="Test Survey" type="action" icon="gtk-new" - context="{'active':True,'survey_id': active_id}"/> + <button name="test_survey" states="open,draft,close,cancel" + string="Test Survey" type="object" icon="gtk-new" + context="{'survey_id': active_id}"/> <button name="fill_survey" states="open" - string="Answer Survey" type="object" icon="gtk-execute" context="{'active':False,'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/> + string="Answer Survey" type="object" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/> <button name="action_print_survey" states="open,draft,close,cancel" string="Print Answer" type="object" icon="gtk-print"/> </tree> diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 67e9aa1c45b..da7db34243e 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -152,24 +152,8 @@ class survey_question_wiz(osv.osv_memory): etree.SubElement(xml_header_title, 'label', {'string': tools.ustr(pag_rec.title) ,'colspan': '2' ,'class' : 'oe_survey_title'}) xml_header_group = etree.SubElement(xml_header_title, 'group', {'col': '4', 'colspan': '1'}) - xml_group = etree.SubElement(xml_form, 'group', {'col': '8', 'colspan': '4'}) - - etree.SubElement(xml_header_group, 'button', {'special': "cancel",'string':"Exit", 'class':"oe_right"}) - if pre_button: - etree.SubElement(xml_header_group, 'button', {'name':"action_previous",'string':"Previous",'type':"object", 'class':"oe_right"}) - but_string = "Next" - if int(page_number) + 1 == total_pages: - but_string = "Done" - if context.has_key('active') and context.get('active',False) and int(page_number) + 1 == total_pages and context.has_key('response_id') and context.has_key('response_no') and context.get('response_no',0) + 1 == len(context.get('response_id',0)): - etree.SubElement(xml_header_group, 'button', {'special' : 'cancel','string': tools.ustr("Done") ,'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) - elif context.has_key('active') and context.get('active', False) and int(page_number) + 1 == total_pages and context.has_key('response_id'): - etree.SubElement(xml_header_group, 'button', {'name':"action_forward_next",'string': tools.ustr("Next Answer") ,'type':"object",'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) - elif context.has_key('active') and context.get('active',False) and int(page_number) + 1 == total_pages: - etree.SubElement(xml_header_group, 'button', {'special': "cancel", 'string' : 'Done', 'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) - else: - etree.SubElement(xml_header_group, 'button', {'name':"action_next",'string': tools.ustr(but_string) ,'type':"object",'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) - etree.SubElement(xml_header_group, 'label', {'string': tools.ustr(page_number+ 1) + "/" + tools.ustr(total_pages), 'class':"oe_right1 oe_survey_title_page"}) +# Button and page if context.has_key('active') and context.get('active',False) and context.has_key('edit'): etree.SubElement(xml_form, 'separator', {'string' : '','colspan': '4'}) context.update({'page_id' : tools.ustr(p_id),'page_number' : sur_name_rec.page_no , 'transfer' : sur_name_read.transfer}) @@ -386,6 +370,24 @@ class survey_question_wiz(osv.osv_memory): etree.SubElement(xml_form, 'separator', {'colspan': '4'}) + xml_button_group = etree.SubElement(xml_form, 'group', {'col': '8', 'colspan': '1', 'class':"oe_right"}) + + etree.SubElement(xml_button_group, 'button', {'special': "cancel",'string':"Exit", 'class':"oe_right", 'width':'80%'}) + if pre_button: + etree.SubElement(xml_button_group, 'button', {'name':"action_previous",'string':"Previous",'type':"object", 'class':"oe_right"}) + but_string = "Next" + if int(page_number) + 1 == total_pages: + but_string = "Done" + if context.has_key('active') and context.get('active',False) and int(page_number) + 1 == total_pages and context.has_key('response_id') and context.has_key('response_no') and context.get('response_no',0) + 1 == len(context.get('response_id',0)): + etree.SubElement(xml_button_group, 'button', {'special' : 'cancel','string': tools.ustr("Done") ,'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) + elif context.has_key('active') and context.get('active', False) and int(page_number) + 1 == total_pages and context.has_key('response_id'): + etree.SubElement(xml_button_group, 'button', {'name':"action_forward_next",'string': tools.ustr("Next Answer") ,'type':"object",'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) + elif context.has_key('active') and context.get('active',False) and int(page_number) + 1 == total_pages: + etree.SubElement(xml_button_group, 'button', {'special': "cancel", 'string' : 'Done', 'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) + else: + etree.SubElement(xml_button_group, 'button', {'name':"action_next",'string': tools.ustr(but_string) ,'type':"object",'context' : tools.ustr(context), 'class':"oe_right oe_highlight"}) + etree.SubElement(xml_button_group, 'label', {'string': tools.ustr(page_number+ 1) + "/" + tools.ustr(total_pages), 'class':"oe_survey_title_page"}) + root = xml_form.getroottree() result['arch'] = etree.tostring(root) result['fields'] = fields @@ -402,7 +404,7 @@ class survey_question_wiz(osv.osv_memory): if sur_rec.send_response: survey_data = survey_obj.browse(cr, uid, survey_id) response_id = surv_name_wiz.read(cr, uid, context.get('sur_name_id',False))['response'] - context.update({'response_id':response_id}) + report = self.create_report(cr, uid, [survey_id], 'report.survey.browse.response', survey_data.title,context) attachments = {} file = open(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf") @@ -416,7 +418,7 @@ class survey_question_wiz(osv.osv_memory): attachments[survey_data.title + ".pdf"] = file_data file.close() os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf") - + context.update({'response_id':response_id}) user_email = user_obj.browse(cr, uid, uid, context).email resp_email = survey_data.responsible_id and survey_data.responsible_id.email or False |
