<?xml version="1.0" ?>
<openerp>
	<data>
<!--		<wizard
			string="Select partners"
			model="crm.segmentation"
			name="open_partner"
			menu="False"
			id="wizard_open_partner"/>
-->

		<wizard
			string="Using a questionnaire"
			model="crm_profiling.questionnaire"
			name="open_questionnaire"
			menu="False"
			id="wizard_open_questionnaire"/>

		<record model="ir.actions.act_window" id="open_questionnaires">
		  <field name="name">Questionnaires</field>
		  <field name="res_model">crm_profiling.questionnaire</field>
		  <field name="view_type">form</field>
		  <field name="view_mode">tree,form</field>
		</record>
		<menuitem parent="crm.next_id_53" id="menu_segm_questionnaire" 
				  action="open_questionnaires" />


		<record model="ir.actions.act_window" id="open_questions">
		  <field name="name">Questions</field>
		  <field name="res_model">crm_profiling.question</field>
		  <field name="view_type">form</field>
		  <field name="view_mode">tree,form</field>
		</record>
		<menuitem parent="crm.next_id_53" id="menu_segm_answer" 
				  action="open_questions" />

<!--		<record model="ir.actions.act_window" id="open_crm_segmentations">
		  <field name="name">Profiles</field>
		  <field name="res_model">crm.segmentation</field>
		  <field name="view_type">form</field>
		  <field name="view_mode">tree,form</field>
		</record>
		<menuitem name="Partners/Configuration/Profiling/Profiles" id="menu_segm_crm_segmentation"
				  action="open_crm_segmentations" />
-->
	<record model="ir.ui.view" id="view_questionnaire_tree">
		<field name="name">Questionnaires</field>
		<field name="model">crm_profiling.questionnaire</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
		  <tree string="Questionnaires">
			<field name="name" select="1" colspan="4"/>
			<field name="description" select="1" colspan="4"/>
			<field name="questions_ids" colspan="4" nolabel="1"/>
		  </tree>
		</field>
	</record>

	<record model="ir.ui.view" id="view_questionnaire_form">
		<field name="name">Questionnaires</field>
		<field name="model">crm_profiling.questionnaire</field>
		<field name="type">form</field>
		<field name="arch" type="xml">
		  <form string="Questionnaires">
			<field name="name" select="1" />
			<newline/>
			<field name="description" select="1" />
			<newline/>
			<field name="questions_ids" colspan="4"/>
		  </form>
		</field>
	</record>

	<record model="ir.ui.view" id="view_answer">
		<field name="name">Answers</field>
		<field name="model">crm_profiling.answer</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
		  <tree string="Answers">
			<field name="question_id" select="1"/>
			<field name="name" select="1"/>
		  </tree>
		</field>
	</record>

	<record model="ir.ui.view" id="view_answer_form">
		<field name="name">Answers</field>
		<field name="model">crm_profiling.answer</field>
		<field name="type">form</field>
		<field name="arch" type="xml">
		  <form string="Answers">
			<field name="question_id" select="1"/>
			<field name="name" select="1"/>
		  </form>
		</field>
	</record>

	<record model="ir.ui.view" id="view_question_tree">
		<field name="name">Questions</field>
		<field name="model">crm_profiling.question</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
		  <tree string="Questions">
			<field name="name" select="1" colspan="4"/>
			<field name="answers_ids" colspan="4" nolabel="1"/>
		  </tree>
		</field>
	</record>

	<record model="ir.ui.view" id="view_question_form">
		<field name="name">Questions</field>
		<field name="model">crm_profiling.question</field>
		<field name="type">form</field>
		<field name="arch" type="xml">
		  <form string="Questions">
			<newline/>
			<field name="name" select="1" />
			<newline/>
			<separator string="Avalaible answers" colspan="4"/>
			<field name="answers_ids" colspan="4" nolabel="1" editable="bottom">
			  <tree string="Answers" editable="bottom">
				<field name="name" select="1"/>
			  </tree>
			  <form string="Answers">
				<field name="name" select="1"/>
			  </form>
			</field>
		  </form>
		</field>
	</record>


	<record model="ir.ui.view" id="view_partner_form">
		<field name="name">res.partner.profile.form</field>
		<field name="model">res.partner</field>
		<field name="type">form</field>
		<field name="inherit_id" ref="base.view_partner_form"/>
		<field name="arch" type="xml">
			<notebook position="inside">
				<page string="Profiling">
				  <button string="Use a questionnaire" name="%(wizard_open_questionnaire)d" type="action" colspan="1"/>
				  <newline/>
				  <field name="answers_ids" colspan="4" nolabel="1"/>
				</page>
			</notebook>
		</field>
	</record>

	<record model="ir.ui.view" id="crm.crm_segmentation-view">
		<field name="name">crm.segmentation.form</field>
		<field name="model">crm.segmentation</field>
		<field name="type">form</field>
		<field name="arch" type="xml">
			<form string="Partner Segmentation">
				<notebook>
				<page string="Segmentation">
					<separator string="Segmentation Description" colspan="4"/>
					<field name="name" select="1"/>
					<field name="exclusif"/>
					<newline/>
					<field name="categ_id" select="2" colspan="2"/>
					<newline/>
					<field name="description" select="2" colspan="4"/>
					<field name="state"/>
					<group col="3" colspan="2">
						<button name="process_start" states="not running" string="Compute Segmentation" type="object"/>
						<button name="process_stop" states="running" string="Stop Process" type="object"/>
						<button name="process_continue" states="running" string="Continue Process" type="object"/>
					</group>
				</page>
				<page string="Sales Purchase">
					<field name="sales_purchase_active"/>
					<separator string="State of Mind Computation" colspan="4"/>
					<field name="som_interval"/>
					<field name="som_interval_max"/>
					<field name="som_interval_decrease"/>
					<field name="som_interval_default"/>
					<separator string="Segmentation Test" colspan="4"/>
					<field name="segmentation_line" widget="one2many_list" colspan="4"/>
				</page>
				<page string="Profiling">
					<field name="profiling_active" colspan="2"/>
					<separator string="Profiling Options" colspan="4"/>
					<field name="parent_id" colspan="2"/><newline/>
					<separator string="Included Answers :" colspan="2" />
					<separator string="Excluded Answers :" colspan="2"/>
					<field name="answer_yes" nolabel="1" colspan="2"/>
					<field name="answer_no" nolabel="1" colspan="2"/>
				</page>
				</notebook>
			</form>
		</field>
	</record>

	<record model="ir.ui.view" id="view_partner_crm_segmentation_tree">
	<!--	<field name="name">crm.segmentation.tree</field>
		<field name="model">crm.segmentation</field>
		<field name="type">tree</field>
		<field name="field_parent">child_ids</field>
		<field name="arch" type="xml">
			<tree string="Partner Profiles">
				<field name="name"/>
				
			</tree>
		</field>
-->		<field name="name">crm.segmentation.tree</field>
		<field name="model">crm.segmentation</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
			<tree string="Partner Segmentations">
				<field name="name"/>
				<field name="description"/>
				<field name="categ_id"/>
			</tree>
		</field>
	</record>

<!--	<record model="ir.actions.act_window" id="action_partner_crm_segmentation">
		<field name="name">Partner profile</field>
		<field name="type">ir.actions.act_window</field>
		<field name="res_model">crm.segmentation</field>
		<field name="view_type">tree</field>
		<field name="view_id" ref="view_partner_crm_segmentation_tree"/>
		<field name="domain">[('parent_id','=',False)]</field>
	</record>
-->
<!--	<menuitem
		name="Partners/Partners by Profile" 
		sequence="1"
		action="action_partner_crm_segmentation" 
		id="menu_partner_crm_segmentation_main"/>
-->
<!--	<record model="ir.values" id="ir_action_partner_by_crm_segmentation">
		<field name="key2" eval="'tree_but_open'"/>
		<field name="model" eval="'crm.segmentation'"/>
		<field name="name">Open partners</field>
		<field name="value" eval="'ir.actions.wizard,%d'%wizard_open_partner"/>
		<field name="object" eval="True"/>
	</record>
-->
	</data>
</openerp>
