diff --git a/addons/crm_profiling/__openerp__.py b/addons/crm_profiling/__openerp__.py index 19f5615ee78..fdc85ba3d4d 100644 --- a/addons/crm_profiling/__openerp__.py +++ b/addons/crm_profiling/__openerp__.py @@ -39,7 +39,7 @@ It also has been merged with the earlier CRM & SRM segmentation tool because the 'website': 'http://www.openerp.com', 'depends': ['base', 'crm'], 'init_xml': [], - 'update_xml': ['security/ir.model.access.csv', 'crm_profiling_view.xml'], + 'update_xml': ['security/ir.model.access.csv', 'wizard/open_questionnaire_view.xml', 'crm_profiling_view.xml'], 'demo_xml': ['crm_profiling_demo.xml'], 'test': [ #'test/process/profiling.yml', #TODO:It's not debuging because problem to write data for open.questionnaire from partner section. diff --git a/addons/crm_profiling/crm_profiling.py b/addons/crm_profiling/crm_profiling.py index 59137966da0..587ddbe0b52 100644 --- a/addons/crm_profiling/crm_profiling.py +++ b/addons/crm_profiling/crm_profiling.py @@ -159,30 +159,6 @@ class questionnaire(osv.osv): _name="crm_profiling.questionnaire" _description= "Questionnaire" - def build_form(self, cr, uid, data, context=None): - """ - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param data: Get Data - @param context: A standard dictionary for contextual values """ - - query = """ - select name, id - from crm_profiling_question - where id in ( select question from profile_questionnaire_quest_rel where questionnaire = %s)""" - res = cr.execute(query, (data['form']['questionnaire_name'],)) - result = cr.fetchall() - quest_fields={} - quest_form=''' -
''' % _('Questionnaire') - for name, oid in result: - quest_form = quest_form + '' % (oid,) - quest_fields['quest_form%d' % (oid,)] = {'string': name, 'type': 'many2one', \ - 'relation': 'crm_profiling.answer', 'domain': [('question_id','=',oid)] } - quest_form = quest_form + '''''' - return quest_form, quest_fields - _columns = { 'name': fields.char("Questionnaire",size=128, required=True), 'description':fields.text("Description", required=True), @@ -210,25 +186,19 @@ class partner(osv.osv): "partner","answer","Answers"), } - def _questionnaire_compute(self, cr, uid, data, context=None): + def _questionnaire_compute(self, cr, uid, answers, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param data: Get Data @param context: A standard dictionary for contextual values """ - - temp = [] - for x in data['form']: - if x.startswith("quest_form") and data['form'][x] != 0 : - temp.append(data['form'][x]) - + partner_id = context.get('active_id') query = "select answer from partner_question_rel where partner=%s" - cr.execute(query, (data['id'],)) + cr.execute(query, (partner_id,)) for x in cr.fetchall(): - temp.append(x[0]) - - self.write(cr, uid, [data['id']], {'answers_ids':[[6, 0, temp]]}, context=context) + answers.append(x[0]) + self.write(cr, uid, [partner_id], {'answers_ids': [[6, 0, answers]]}, context=context) return {} diff --git a/addons/crm_profiling/crm_profiling_view.xml b/addons/crm_profiling/crm_profiling_view.xml index 258de2e4e2d..a54d3d4b0a9 100644 --- a/addons/crm_profiling/crm_profiling_view.xml +++ b/addons/crm_profiling/crm_profiling_view.xml @@ -2,13 +2,6 @@ - - Questionnaires crm_profiling.questionnaire @@ -140,7 +133,7 @@