Harry (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-survey-layout-tta into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-survey-layout-tta/+merge/115909
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-survey-layout-tta/+merge/115909
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-survey-layout-tta.
=== modified file 'project/security/project_security.xml'
--- project/security/project_security.xml	2012-06-28 12:18:20 +0000
+++ project/security/project_security.xml	2012-07-20 08:43:27 +0000
@@ -69,5 +69,20 @@
         <field name="domain_force">[(1,'=',1)]</field>
         <field name="groups" eval="[(4,ref('project.group_project_manager'))]"/>
     </record>
+
+    <record model="ir.rule" id="project_visibility_rule">
+        <field name="name" >Project According to User</field>
+        <field name="model_id" ref="model_project_project"/>
+        <field name="global" eval="True"/>
+        <field name="domain_force">['|',('user_id','=',False),('user_id','=',user.id)]</field>
+    </record>
+
+    <record model="ir.rule" id="project_manager_all_project_rule">
+        <field name="name">Project Managers all projects</field>
+        <field name="model_id" ref="model_project_project"/>
+        <field name="domain_force">[(1,'=',1)]</field>
+        <field name="groups" eval="[(4,ref('project.group_project_manager'))]"/>
+    </record>
+
 </data>
 </openerp>

=== modified file 'survey/__openerp__.py'
--- survey/__openerp__.py	2012-04-17 05:50:10 +0000
+++ survey/__openerp__.py	2012-07-20 08:43:27 +0000
@@ -53,10 +53,11 @@
         'test/survey_question_type.yml',
         'test/survey_report.yml',
     ],
-    'css': ['static/src/css/survey.css'],
     'installable': True,
     'auto_install': False,
     'certificate' : '001131639736864143245',
-    'images': ['images/survey_answers.jpeg','images/survey_pages.jpeg','images/surveys.jpeg'],
+    '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:

=== modified file 'survey/specification/survey.png'
Binary files survey/specification/survey.png	2011-01-14 00:11:01 +0000 and survey/specification/survey.png	2012-07-20 08:43:27 +0000 differ
=== modified file 'survey/specification/survey_page.png'
Binary files survey/specification/survey_page.png	2011-01-14 00:11:01 +0000 and survey/specification/survey_page.png	2012-07-20 08:43:27 +0000 differ
=== modified file 'survey/specification/survey_question.png'
Binary files survey/specification/survey_question.png	2011-01-14 00:11:01 +0000 and survey/specification/survey_question.png	2012-07-20 08:43:27 +0000 differ
=== modified file 'survey/specification/survey_response.png'
Binary files survey/specification/survey_response.png	2011-01-14 00:11:01 +0000 and survey/specification/survey_response.png	2012-07-20 08:43:27 +0000 differ
=== added directory 'survey/static.moved'
=== added directory 'survey/static.moved/src'
=== added directory 'survey/static.moved/src/css'
=== added file 'survey/static.moved/src/css/survey.css'
--- survey/static.moved/src/css/survey.css	1970-01-01 00:00:00 +0000
+++ survey/static.moved/src/css/survey.css	2012-07-20 08:43:27 +0000
@@ -0,0 +1,15 @@
+.oe_survey_title {
+    font-weight: bold;
+    font-size: 22px;
+    margin: 8px 0px 8px 0px;
+    color: #5B5B5B;
+}
+
+.oe_survey_title_height{
+    height: 33px;
+    border-top: 1px #EBEBEB solid;
+}
+
+.oe_survey_title_page {
+    font-size: 14px;
+}

=== added directory 'survey/static.moved/src/js'
=== added file 'survey/static.moved/src/js/survey.js'
--- survey/static.moved/src/js/survey.js	1970-01-01 00:00:00 +0000
+++ survey/static.moved/src/js/survey.js	2012-07-20 08:43:27 +0000
@@ -0,0 +1,28 @@
+openerp.survey = function (instance) {
+    var QWeb = instance.web.qweb,
+    _t = instance.web._t;
+    instance.web.ViewManagerAction = instance.web.ViewManagerAction.extend({
+        init: function(parent, action) {
+            this._super.apply(this,arguments);
+            console.log('hello');
+        },
+        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);
+                }
+            });
+        },
+    });
+};

=== modified file 'survey/static/src/css/survey.css'
--- survey/static/src/css/survey.css	2012-07-10 11:07:40 +0000
+++ survey/static/src/css/survey.css	2012-07-20 08:43:27 +0000
@@ -1,14 +1,14 @@
-.oe_survey_responsible{
-    height: auto;
-    width: 200px;
-    font-size: 14px;
-}
-
-.oe_survey_start_date{
-    height: auto;
-    width: 200px;
-    font-size: 14px;
-}
-.oe_survey_rate{
+.oe_survey_title {
+    font-weight: bold;
+    font-size: 19px;
+    margin: 8px 0px 8px 0px;
+    color: #5B5B5B;
+}
+
+.oe_survey_title_height{
+    height: 33px;  
+}
+
+.oe_survey_title_page {
     font-size: 14px;
 }

=== added directory 'survey/static/src/js'
=== added file 'survey/static/src/js/survey.js'
--- survey/static/src/js/survey.js	1970-01-01 00:00:00 +0000
+++ survey/static/src/js/survey.js	2012-07-20 08:43:27 +0000
@@ -0,0 +1,24 @@
+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);
+                }
+            });
+        },
+    });
+};

=== modified file 'survey/survey.py'
--- survey/survey.py	2012-07-10 11:07:40 +0000
+++ survey/survey.py	2012-07-20 08:43:27 +0000
@@ -569,6 +569,7 @@
                 where question_id = %d and state = 'done'"\
                      % (rec.id, rec.question_id.id))
             res = cr.fetchone()
+            print("Records>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
             if res[0]:
                 avg = float(res[1]) * 100 / res[0]
             else:

=== modified file 'survey/survey_view.xml'
--- survey/survey_view.xml	2012-07-17 16:25:28 +0000
+++ survey/survey_view.xml	2012-07-20 08:43:27 +0000
@@ -30,7 +30,7 @@
                 <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,draft,close,cancel" string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
+                        <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')]}"/>
                     </div>
                     <div class="oe_title">
                         <label for="title" class="oe_edit_only"/>
@@ -261,10 +261,8 @@
                     <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="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
-                        string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
-                    <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
-                        string="Edit Survey" type="action" icon="gtk-edit" context="{'active':True,'edit' : True,'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')]}"/>                   
                     <button name="action_print_survey" states="open,draft,close,cancel"
                                     string="Print Answer" type="object" icon="gtk-print"/>
                 </tree>

=== modified file 'survey/wizard/survey_answer.py'
--- survey/wizard/survey_answer.py	2012-06-25 13:42:53 +0000
+++ survey/wizard/survey_answer.py	2012-07-20 08:43:27 +0000
@@ -146,7 +146,39 @@
                         pre_button = True
                 if flag:
                     pag_rec = page_obj.browse(cr, uid, p_id, context=context)
-                    xml_form = etree.Element('form', {'string': tools.ustr(pag_rec.title)})
+                    xml_form = etree.Element('form', {'string': tools.ustr(sur_rec.title)})
+                    xml_header = etree.SubElement(xml_form, 'header', {'col': '6', 'colspan': '4' ,'class': 'oe_survey_title_height'})
+                    xml_header_title = etree.SubElement(xml_header, 'group', {'col': '6', 'colspan': '6'})
+
+                    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"})
+
+                    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})
+                        xml_group3 = etree.SubElement(xml_form, 'group', {'col': '4', 'colspan': '4'})
+                        etree.SubElement(xml_group3, 'button', {'string' :'Add Page','icon': "gtk-new", 'type' :'object','name':"action_new_page", 'context' : tools.ustr(context)})
+                        etree.SubElement(xml_group3, 'button', {'string' :'Edit Page','icon': "gtk-edit", 'type' :'object','name':"action_edit_page", 'context' : tools.ustr(context)})
+                        etree.SubElement(xml_group3, 'button', {'string' :'Delete Page','icon': "gtk-delete", 'type' :'object','name':"action_delete_page", 'context' : tools.ustr(context)})
+                        etree.SubElement(xml_group3, 'button', {'string' :'Add Question','icon': "gtk-new", 'type' :'object','name':"action_new_question", 'context' : tools.ustr(context)})
+
                     xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'})
                     if context.has_key('response_id') and context.get('response_id', False) \
                          and int(context.get('response_id',0)[0]) > 0:
@@ -162,7 +194,7 @@
 
                     if wiz_id:
                         fields["wizardid_" + str(wiz_id)] = {'type':'char', 'size' : 255, 'string':"", 'views':{}}
-                        etree.SubElement(xml_form, 'field', {'invisible':'1','name': "wizardid_" + str(wiz_id),'default':str(lambda *a: 0)})
+                        etree.SubElement(xml_form, 'field', {'invisible':'1','name': "wizardid_" + str(wiz_id),'default':str(lambda *a: 0),'modifiers':'{"invisible":true}'})
 
                     if pag_rec.note:
                         xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'})
@@ -353,36 +385,7 @@
                                     fields[tools.ustr(que.id) + "_other"] = {'type': 'text', 'string': '', 'views':{}}
 
                     etree.SubElement(xml_form, 'separator', {'colspan': '4'})
-                    xml_group = etree.SubElement(xml_form, 'group', {'col': '6', 'colspan': '4'})
-                    etree.SubElement(xml_group, 'field', {'name': 'progress_bar_' + tools.ustr(page_number) , 'widget':'progressbar'})
-                    fields['progress_bar_' + tools.ustr(page_number)] = {'type':'float', 'string':"Progress", 'views':{}}
-                    etree.SubElement(xml_group, 'label', {'string': tools.ustr(page_number+ 1) + "/" + tools.ustr(total_pages)})
-                    etree.SubElement(xml_group, 'button', {'icon': "gtk-cancel", 'special': "cancel",'string':"Cancel"})
-                    
-                    if pre_button:
-                        etree.SubElement(xml_group, 'button', {'colspan':"1",'icon':"gtk-go-back",'name':"action_previous",'string':"Previous",'type':"object"})
-                    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_group, 'button', {'icon': "gtk-go-forward", 'special' : 'cancel','string': tools.ustr("Done") ,'context' : tools.ustr(context)})
-                    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_group, 'button', {'icon': "gtk-go-forward", 'name':"action_forward_next",'string': tools.ustr("Next Answer") ,'type':"object",'context' : tools.ustr(context)})
-                    elif context.has_key('active') and context.get('active',False) and int(page_number) + 1 == total_pages:
-                        etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'special': "cancel", 'string' : 'Done', 'context' : tools.ustr(context)})
-                    else:
-                        etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'name':"action_next",'string': tools.ustr(but_string) ,'type':"object",'context' : tools.ustr(context)})
-
-                    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})
-                        xml_group3 = etree.SubElement(xml_form, 'group', {'col': '4', 'colspan': '4'})
-                        etree.SubElement(xml_group3, 'button', {'string' :'Add Page','icon': "gtk-new", 'type' :'object','name':"action_new_page", 'context' : tools.ustr(context)})
-                        etree.SubElement(xml_group3, 'button', {'string' :'Edit Page','icon': "gtk-edit", 'type' :'object','name':"action_edit_page", 'context' : tools.ustr(context)})
-                        etree.SubElement(xml_group3, 'button', {'string' :'Delete Page','icon': "gtk-delete", 'type' :'object','name':"action_delete_page", 'context' : tools.ustr(context)})
-                        etree.SubElement(xml_group3, 'button', {'string' :'Add Question','icon': "gtk-new", 'type' :'object','name':"action_new_question", 'context' : tools.ustr(context)})
-
+ 
                     root = xml_form.getroottree()
                     result['arch'] = etree.tostring(root)
                     result['fields'] = fields
@@ -393,7 +396,7 @@
 
                     # mark the survey request as done; call 'survey_req_done' on its actual model
                     survey_req_obj = self.pool.get(context.get('active_model'))
-                    if survey_req_obj and hasattr(survey_req_obj, 'survey_req_done'):
+                    if survey_req_obj and hasattr(survey_req_obj, 'survey_req_done'): 
                         survey_req_obj.survey_req_done(cr, uid, context.get('active_ids', []), context=context)
 
                     if sur_rec.send_response:
@@ -423,10 +426,12 @@
                             mail_message.schedule_with_attach(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, attachments=attachments, context=context)
 
                     xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
+                    xml_header = etree.SubElement(xml_form, 'header', {'col': '6', 'colspan': '4' ,'class': 'oe_survey_title_height'})
+
                     etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"})
                     etree.SubElement(xml_form, 'label', {'string': 'Thanks for your Answer'})
                     etree.SubElement(xml_form, 'newline')
-                    etree.SubElement(xml_form, 'button', {'icon': "gtk-go-forward", 'special':"cancel",'string':"OK",'colspan':"2"})
+                    etree.SubElement(xml_header, 'button', {'special':"cancel",'string':"OK",'colspan':"2",'class':'oe_highlight'})
                     root = xml_form.getroottree()
                     result['arch'] = etree.tostring(root)
                     result['fields'] = {}
@@ -435,7 +440,7 @@
 
     def create_report(self, cr, uid, res_ids, report_name=False, file_name=False, context=None):
         """
-        If any user give answer of survey then last create report of this answer and if 'Email Notification on Answer' set True in survey  then send mail on responsible person of this survey and attach survey answer report in pdf format.
+        If any user give answer of survey then last create report of this answer and if 'E-mail Notification on Answer' set True in survey  then send mail on responsible person of this survey and attach survey answer report in pdf format.
         """
         if not report_name or not res_ids:
             return (False, Exception('Report name and Resources ids are required !!!'))
@@ -480,7 +485,6 @@
                 value[field] = tot_per
         response_obj = self.pool.get('survey.response')
         surv_name_wiz = self.pool.get('survey.name.wiz')
-
         if context.has_key('response_id') and context.get('response_id') and int(context['response_id'][0]) > 0:
             data = super(survey_question_wiz, self).default_get(cr, uid, fields_list, context)
             response_ans = response_obj.browse(cr, uid, context['response_id'][context['response_no']])
@@ -527,11 +531,11 @@
                                     value[field] = ans.answer
 
         else:
+            
             if not context.has_key('sur_name_id'):
                 return value
             if context.has_key('active') and context.get('active',False):
                 return value
-            
             sur_name_read = surv_name_wiz.read(cr, uid, context.get('sur_name_id',False))
             ans_list = []
 
@@ -539,7 +543,6 @@
                 for field in fields_list:
                     if field in list(val):
                         value[field] = val[field]
-
         return value
 
     def create(self, cr, uid, vals, context=None):
@@ -593,8 +596,9 @@
                     self.pool.get(context.get('object',False)).write(cr, uid, [int(context.get('cur_id',False))], {'response' : response_id})
                     self.pool.get(context.get('object',False)).survey_req_done(cr, uid, [int(context.get('cur_id'))], context)
                 else:
-                    self.pool.get(context.get('object',False)).write(cr, uid, [int(context.get('cur_id',False))], {'response' : response_id})
-        if sur_name_read['store_ans'] and type(sur_name_read['store_ans']) == dict:
+                    self.pool.get(context.get('object',False)).write(cr, uid, [int(context.get('cur_id',False))], {'response' : response_id})        
+        if sur_name_read['store_ans'] and type(safe_eval(sur_name_read['store_ans'])) == dict:
+            sur_name_read['store_ans'] = safe_eval(sur_name_read['store_ans'])
             for key,val in sur_name_read['store_ans'].items():
                 for field in vals:
                     if field.split('_')[0] == val['question_id']:

=== modified file 'survey/wizard/survey_answer.xml'
--- survey/wizard/survey_answer.xml	2012-06-14 09:16:17 +0000
+++ survey/wizard/survey_answer.xml	2012-07-20 08:43:27 +0000
@@ -5,8 +5,8 @@
         <!--
             Survey Question Wizard
          -->
-        <record id="view_survey_question_message" model="ir.ui.view">
-            <field name="name">Answer Survey</field>
+        <record id="view_survey_question_message" model="ir.ui.view">           
+            <field name="name">Survey Answer</field>
             <field name="model">survey.question.wiz</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
@@ -28,7 +28,6 @@
         </record>
 
         <record id="action_view_survey_question_message" model="ir.actions.act_window">
-            <field name="name">Answer Survey</field>
             <field name="type">ir.actions.act_window</field>
             <field name="res_model">survey.question.wiz</field>
             <field name="view_type">form</field>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to