[IMP]survey:Improved all yaml files regarding this module

bzr revid: ssu@tinyerp.com-20111216062550-dv6fgywst8dwvutw
This commit is contained in:
Saurang Suthar (OpenERP) 2011-12-16 11:55:50 +05:30
parent b98867779a
commit c4a3dce55e
7 changed files with 324 additions and 167 deletions

View File

@ -48,7 +48,9 @@ Partners are also sent mails with user name and password for the invitation of t
'wizard/survey_send_invitation.xml'],
'demo_xml': ['survey_demo.xml'],
'test': [
'test/survey00.yml',
'test/draft2open2close_survey.yml',
'test/draft2open2close_request.yml',
'test/surey_question_type.yml',
'test/survey_report.yml',
],
'installable': True,

View File

@ -6,6 +6,155 @@
<field eval="[(4, ref('base.group_tool_user')),(4, ref('base.group_survey_user'))]" name="groups_id"/>
</record>
<!-- Initial Partner Feedback Demo data -->
<record model="survey" id="survey_Initial_partner_feedback">
<field name="title">Initial Partner Feedback</field>
<field name="responsible_id" ref="base.user_root"/>
<field name="max_response_limit">20</field>
<field name="type" ref="survey_type2"/>
<field name="state">open</field>
<field name="tot_comp_survey">1</field>
<field name="tot_start_survey">1</field>
<field name="response_user">5</field>
<field name="date_open" eval="time.strftime('%Y-%m-%d %H:%M:%S')"/>
</record>
<record id="survey_page_initial_who_are_you" model="survey.page">
<field name="title">Who are you?</field>
<field name="survey_id" ref="survey_Initial_partner_feedback" />
<field eval="1" name="sequence"/>
</record>
<record id="survey_initial_question_company_name" model="survey.question">
<field name="question">What is your company's name?</field>
<field name="page_id" ref="survey_page_initial_who_are_you" />
<field name="type">single_textbox</field>
<field name="in_visible_rating_weight">1</field>
<field name="in_visible_menu_choice">1</field>
<field eval="1" name="sequence"/>
<field name="in_visible_answer_type">1</field>
</record>
<record id="survey_initial_question_company_size" model="survey.question">
<field name="question">What is your company's size?</field>
<field name="page_id" ref="survey_page_initial_who_are_you" />
<field name="type">multiple_choice_only_one_ans</field>
<field eval="2" name="sequence"/>
<field name="in_visible_answer_type">1</field>
</record>
<record id="survey_initial_question_company_size_1" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">1 - 10</field>
<field name="question_id" ref="survey_initial_question_company_size" />
<field eval="1" name="sequence"/>
</record>
<record id="survey_initial_question_company_size_11" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">11 - 50</field>
<field name="question_id" ref="survey_initial_question_company_size" />
<field eval="2" name="sequence"/>
</record>
<record id="survey_initial_question_company_size_51" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">51 - 100</field>
<field name="question_id" ref="survey_initial_question_company_size" />
<field eval="3" name="sequence"/>
</record>
<record id="survey_initial_question_company_size_101" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">101 - 250</field>
<field name="question_id" ref="survey_initial_question_company_size" />
<field name="sequence" eval="4"/>
</record>
<record id="survey_initial_question_company_size_251" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">251 - 500</field>
<field name="question_id" ref="survey_initial_question_company_size" />
<field name="sequence" eval="5"/>
</record>
<record id="survey_initial_question_company_size_501" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">501 - 1000</field>
<field name="question_id" ref="survey_initial_question_company_size" />
<field name="sequence" eval="6"/>
</record>
<record id="survey_initial_question_company_size_1000" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">> 1000</field>
<field name="question_id" ref="survey_initial_question_company_size" />
<field name="sequence" eval="7"/>
</record>
<record id="survey_initial_question_company_size" model="survey.question">
<field eval="True" name="is_require_answer"/>
</record>
<record id="survey_initial_page_Contracts" model="survey.page">
<field name="title">Contracts</field>
<field name="survey_id" ref="survey_Initial_partner_feedback" />
<field name="sequence" eval="2"/>
</record>
<record id="survey_initial_question_sell_to_your_customers" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="question">Which maintenance contract do you sell to your customers?</field>
<field name="page_id" ref="survey_initial_page_Contracts" />
<field name="type">multiple_choice_only_one_ans</field>
<field eval="1" name="sequence"/>
</record>
<record id="survey_initial_answer_maintenance_contract" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">OpenERP maintenance contract</field>
<field name="question_id" ref="survey_initial_question_sell_to_your_customers" />
<field name="sequence" eval="1"/>
</record>
<record id="survey_initial_answer_buy_an_openerp_one" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Your own contract, but you buy an OpenERP one</field>
<field name="question_id" ref="survey_initial_question_sell_to_your_customers" />
<field name="sequence" eval="2"/>
</record>
<record id="survey_initial_answer_buying_an_openerp" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Your own contract without buying an OpenERP one</field>
<field name="question_id" ref="survey_initial_question_sell_to_your_customers" />
<field name="sequence" eval="3"/>
</record>
<record id="survey_initial_question_contract_customers" model="survey.question">
<field name="in_visible_answer_type">1</field>
<field name="question">When do you propose a maintenance contract to your customers?</field>
<field name="page_id" ref="survey_initial_page_Contracts" />
<field name="type">multiple_choice_only_one_ans</field>
<field name="comment_field_type">text</field>
<field name="comment_label">Why?</field>
<field eval="2" name="sequence"/>
<field name="is_comment_require">True</field>
</record>
<record id="survey_initial_answer_very_integration" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">With each integration</field>
<field name="question_id" ref="survey_initial_question_contract_customers" />
<field name="sequence" eval="1"/>
</record>
<record id="survey_initial_answer_sometimes" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Sometimes</field>
<field name="question_id" ref="survey_initial_question_contract_customers" />
<field name="sequence" eval="2"/>
</record>
<record id="survey_initial_answer_never" model="survey.answer">
<field name="in_visible_answer_type">1</field>
<field name="answer">Never... </field>
<field name="question_id" ref="survey_initial_question_contract_customers" />
<field name="sequence" eval="3"/>
</record>
<record id="survey_initial_question_contract_customers" model="survey.question">
<field eval="True" name="is_require_answer"/>
</record>
<!-- Partner Feedback Demo data -->
<record model="survey" id="survey_partner_feedback">
<field name="title">OpenERP Partner Feedback</field>

View File

@ -0,0 +1,48 @@
-
In order to check Survey Request of the survey "Initial Partner Feedback" I create a Survey Request for survey "Initial Partner Feedback".
-
!record {model: survey.request, id: survey_request_1}:
survey_id: survey_Initial_partner_feedback
user_id: base.user_demo
state: draft
-
I set Survey Request for the survey in waiting state.
-
!python {model: survey.request}: |
self.survey_req_waiting_answer(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey Request for the survey is waiting or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in waiting state}:
- state == 'waiting_answer'
-
I cancel the Survey Request of the survey.
-
!python {model: survey.request}: |
self.survey_req_cancel(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey Request of the survey is cancel or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in cancel state}:
- state == 'cancel'
-
I set Survey Request of the survey in draft state.
-
!python {model: survey.request}: |
self.survey_req_draft(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey request of the survey is draft or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in draft state}:
- state == 'draft'
-
I set survey request of the survey in done state.
-
!python {model: survey.request}: |
self.survey_req_waiting_answer(cr, uid, [ref("survey_request_1")], context)
self.survey_req_done(cr, uid, [ref("survey_request_1")], context)
-
I check that state of Survey request of the survey is done or not.
-
!assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in done state}:
- state == 'done'

View File

@ -0,0 +1,111 @@
-
In order to check the survey module in OpenERP I use the survey "Initial Partner Feedback".
-
I set the survey in Open state.
-
!python {model: survey}: |
sur = self.survey_open(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
I check state of survey is open or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in open state}:
- state == 'open'
-
I check that the survey is reopened or not.
-
!python {model: survey}: |
self.survey_cancel(cr, uid, [ref('survey_Initial_partner_feedback')],context)
self.survey_open(cr, uid, [ref('survey_Initial_partner_feedback')],context)
-
I check that state of survey is open or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in open state}:
- state == 'open'
-
I set the state of the survey open.
-
!python {model: survey}: |
sur = self.survey_open(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
In order to print the survey I click on Print.
-
!python {model: survey.print}: |
id = self.create(cr, uid, {'survey_ids': [(6,0,[ref('survey.survey_Initial_partner_feedback')])]})
self.action_next(cr, uid, [id], context)
-
In order to answer the survey I click on "Answer a Survey" wizard.
-
!python {model: survey.name.wiz}: |
id = self.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")})
self.action_next(cr, uid, [id], context)
-
I give the answer of the first and second page of the survey.
-
!python {model: survey.question.wiz}: |
ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')]}
self.fields_view_get(cr, uid, ref("survey.view_survey_question_message"),"form", context=ctx)
values = self.default_get(cr, uid, ['name'], ctx)
ids = self.create(cr, uid, {str(ref("survey_initial_question_company_name")) +"_single" :'Tiny' , str(ref("survey_initial_question_company_size")) + "_selection" : int(ref("survey.survey_initial_question_company_size_51")), }, context)
self.action_next(cr, uid, [ids], context)
ids = self.create(cr, uid, {str(ref("survey_initial_question_contract_customers")) + "_selection" : int(ref("survey_initial_answer_sometimes")), str(ref("survey_initial_question_sell_to_your_customers")) + "_selection" : int(ref("survey_initial_answer_maintenance_contract")), }, context)
self.action_next(cr, uid, [ids], context)
-
I print the answers of the survey.
-
!python {model: survey.browse.answer}: |
id = self.create(cr, uid, {'survey_id': ref('survey.survey_Initial_partner_feedback')})
self.action_next(cr, uid, [id], context)
-
I edit questions of the survey as per requirement.
-
!python {model: survey.question.wiz}: |
name_wiz_obj = self.pool.get('survey.name.wiz')
id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")})
ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')], 'question_id': ref('survey_initial_question_company_name'), 'page_number': -1,'sur_name_id': id}
self.action_edit_question(cr, uid, [ref('survey_initial_question_company_name')], context = ctx)
self.action_delete_question(cr, uid, [ref('survey_initial_question_company_name')], context = ctx)
self.action_new_question(cr, uid, [], context = ctx)
-
I edit Page of the survey as per requirement.
-
!python {model: survey.question.wiz}: |
name_wiz_obj = self.pool.get('survey.name.wiz')
id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")})
ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')], 'page_id': ref('survey_initial_page_Contracts'), 'sur_name_id': id}
self.action_edit_page(cr, uid, [ref('survey_initial_page_Contracts')], context = ctx)
self.action_delete_page(cr, uid, [ref('survey_initial_page_Contracts')], context = ctx)
self.action_new_page(cr, uid, [], context = ctx)
-
In order to send invitation to the users I click on "Send Invitation" wizard.
-
!python {model: survey.send.invitation}: |
context = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')]}
values = self.default_get(cr, uid, ['mail_from', 'mail_subject', 'send_mail_existing', 'mail_subject_existing', 'mail', 'partner_ids', 'send_mail'], context)
values['mail_from'] = 'Surveyor'
new_id = self.create(cr, uid, values)
self.action_send(cr, uid, [new_id], context)
-
I set the value in "Total start survey" field.
-
!python {model: survey}: |
ids = self.write(cr, uid, ref("survey_Initial_partner_feedback"), {'tot_start_survey' : 1}, context)
-
I set the survey in Cancel state.
-
!python {model: survey}: |
sur = self.survey_cancel(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
I check state of survey is cancel or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in cancel state}:
- state == 'cancel'
-
I set the survey in close state.
-
!python {model: survey}: |
sur = self.survey_close(cr, uid, [ref("survey_Initial_partner_feedback")], context)
-
I check state of Survey is close or not.
-
!assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in close state}:
- state == 'close'

View File

@ -0,0 +1,6 @@
-
I check the question type of the survey "Initial Partner Feedback".
-
!python {model: survey.question}: |
sur_question = self.on_change_type(cr, uid, [ref("survey_Initial_partner_feedback")], ['multiple_textboxes_diff_type'])
assert sur_question

View File

@ -1,159 +0,0 @@
- |
Survey Scenario:
In order to check the survey module in OpenERP.
-
I Create the one survey and give survey title "Partner Feedback" and define the survey pages and survey question.
-
I Create "Partner Feedback" survey.
-
!record {model: 'survey', id: survey_partner_0}:
title: 'Partner Feedback'
max_response_limit: 20
-
I Create "Who are you?" page in "Partner Feedback" survey with title .
-
!record {model: 'survey.page', id: survey_partner_page_0}:
title: 'Who are you?'
survey_id: survey_partner_0
-
I Create "What is your company name?" question in "Who are you" survey page.
-
!record {model: 'survey.question', id: survey_p_question_0}:
question: 'What is your company name?'
type: single_textbox
sequence: 1
page_id: survey_partner_page_0
-
I Create "What is your company size?" question in "Who are you" survey page.
-
!record {model: 'survey.question', id: survey_p_question_1}:
question: 'What is your company size?'
type: multiple_choice_only_one_ans
sequence: 2
is_require_answer: true
page_id: survey_partner_page_0
-
I Create "1-50" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_1}:
answer: '1 - 50'
sequence: 1
question_id : survey_p_question_1
-
I Create "51 - 100" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_2}:
answer: '51 - 100'
sequence: 2
question_id : survey_p_question_1
-
I Create "100 - 500" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_3}:
answer: '100 - 500'
sequence: 3
question_id : survey_p_question_1
-
I Create "500 - 1000" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_4}:
answer: '500 - 1000'
sequence: 4
question_id : survey_p_question_1
-
I Create "> 1000" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_5}:
answer: '> 1000'
sequence: 5
question_id : survey_p_question_1
-
I Create another "Contract" page in "Partner Feedback" survey.
-
!record {model: 'survey.page', id: survey_partner_page_1}:
title: 'Contract'
survey_id: survey_partner_0
-
I Create "Which maintenance contract do you sell to your customers." question in "Contract" survey page.
-
!record {model: 'survey.question', id: survey_p_question_3}:
question: 'Which maintenance contract do you sell to your customers.'
type: multiple_choice_only_one_ans
sequence: 1
page_id: survey_partner_page_1
-
I Create "OpenERP maintenance contract" answer in question "Which maintenance contract do you sell to your customers."
-
!record {model: 'survey.answer', id: survey_p_3_1}:
answer: 'OpenERP maintenance contract'
sequence: 1
question_id : survey_p_question_3
-
I Create "Your own contract, but you buy an OpenERP one" answer in question "Which maintenance contract do you sell to your customers."
-
!record {model: 'survey.answer', id: survey_p_3_2}:
answer: 'Your own contract, but you buy an OpenERP one'
sequence: 2
question_id : survey_p_question_3
-
I Create "Your own contract without buying an OpenERP one" answer in question "Which maintenance contract do you sell to your customers."
-
!record {model: 'survey.answer', id: survey_p_3_3}:
answer: 'Your own contract without buying an OpenERP one'
sequence: 3
question_id : survey_p_question_3
-
I Create "When do you propose a maintenance contract to your customers?" question in "Contract" survey page.
-
!record {model: 'survey.question', id: survey_p_question_4}:
question: When do you propose a maintenance contract to your customers?
type: multiple_choice_only_one_ans
sequence: 2
comment_field_type: text
comment_label: Why?
is_require_answer: true
is_comment_require: true
page_id: survey_partner_page_1
-
I Create "With each integration" answer in question "When do you propose a maintenance contract to your customers?"
-
!record {model: 'survey.answer', id: survey_p_4_1}:
answer: 'With each integration'
sequence: 1
question_id : survey_p_question_4
-
I Create "Sometimes" answer in question "When do you propose a maintenance contract to your customers?"
-
!record {model: 'survey.answer', id: survey_p_4_2}:
answer: 'Sometimes'
sequence: 2
question_id : survey_p_question_4
-
I Create "Never... " answer in question "When do you propose a maintenance contract to your customers?"
-
!record {model: 'survey.answer', id: survey_p_4_3}:
answer: 'Never... '
sequence: 3
question_id : survey_p_question_4
-
Now Survey set in open state.
-
!python {model: survey}: |
self.survey_open(cr, uid, [ref("survey_partner_0")], context)
-
Give answer of the survey, Run "Answer a Survey" wizard and select the survey and press on start button then run the selected survey.
-
!python {model: survey.name.wiz}: |
id = self.create(cr, uid, {'survey_id': ref("survey_partner_0")})
self.action_next(cr, uid, [id], context)
-
Give answer of the first and second page in "Partner Feedback" survey.
-
!python {model: survey.question.wiz}: |
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)
ids = self.create(cr, uid, {str(ref("survey_p_question_3")) +"_selection" : int(ref("survey_p_3_1")), str(ref("survey_p_question_4")) +"_selection": int(ref("survey_p_4_1"))},context)
-
Set the value in "Total start survey" field.
-
!python {model: survey}: |
ids = self.write(cr, uid, ref("survey_partner_0"), {'tot_start_survey' : 1}, context)

View File

@ -1,29 +1,29 @@
-
Print the Survey Browse Response Report through the wizard
I print the Survey Browse Response Report through the wizard.
-
!python {model: survey}: |
ctx={}
ctx.update({'model': 'survey','active_ids': [(6,0,[ref('survey.survey_partner_feedback')])]})
ctx.update({'model': 'survey','active_ids': [(6,0,[ref('survey_partner_feedback')])]})
data_dict = {'response_ids' : [(6,0,[ref('survey.survey_partner_feedback')])], 'page_number' : True, 'without_pagebreak': True}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_view_survey_print_answer',wiz_data=data_dict, context=ctx, our_module='survey')
-
Print the Survey Analysis Report through the wizard
I print the Survey Analysis Report through the wizard.
-
!python {model: survey}: |
ctx={}
ctx.update({'model': 'survey','active_ids': [(6,0,[ref('survey.survey_partner_feedback')])]})
ctx.update({'model': 'survey','active_ids': [(6,0,[ref('survey_partner_feedback')])]})
data_dict = {'survey_ids' : [(6,0,[ref('survey.survey_partner_feedback')])]}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_view_survey_print_statistics',wiz_data=data_dict, context=ctx, our_module='survey')
-
Print the Survey Form Report through the wizard
I print the Survey Form Report through the wizard.
-
!python {model: survey}: |
ctx={}
ctx.update({'model': 'survey','active_ids': [(6,0,[ref('survey.survey_partner_feedback')])]})
ctx.update({'model': 'survey','active_ids': [(6,0,[ref('survey_partner_feedback')])]})
data_dict = {'survey_ids' : [(6,0,[ref('survey.survey_partner_feedback')])], 'page_number' : True, 'without_pagebreak': True}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_view_survey_print',wiz_data=data_dict, context=ctx, our_module='survey')
test_reports.try_report_action(cr, uid, 'action_view_survey_print',wiz_data=data_dict, context=ctx, our_module='survey')