<openerp>
   <data>

   <!-- Sales by journal's view  -->

	    <record model="ir.ui.view" id="view_sale_journal_report_tree">
	        <field name="name">sale.journal.report.tree</field>
	        <field name="model">sale.journal.report</field>
	        <field name="type">tree</field>
	        <field name="arch" type="xml">
	            <tree string="Sales by Journal">
	                <field name="name" invisible="1"/>
	                <field name="state" invisible="1"/>
	                <field name="journal_id" invisible="1"/>
	                <field name="quantity"/>
	                <field name="count"/>
	                <field name="price_average"/>
	                <field name="price_total"/>
	            </tree>
	        </field>
	    </record>

	    <!-- sales journal graph view -->

	    <record id="view_sale_journal_graph" model="ir.ui.view">
	        <field name="name">sale.journal.report.graph</field>
            <field name="model">sale.journal.report</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
               <graph string="Sales journal Statistics" type="bar">
                 <field name="journal_id"/>
                 <field name="price_total"/>
              </graph>
           </field>
       </record>

	  <!-- sales by journal search view -->

	    <record model="ir.ui.view" id="view_sale_journal_report_search">
	        <field name="name">sale.journal.report.search</field>
	        <field name="model">sale.journal.report</field>
	        <field name="type">search</field>
	        <field name="arch" type="xml">
	            <search string="Sales by Journal">
	            	<group col="8" colspan="4">
		            	<filter icon="terp-go-year" string="This Year" domain="[('name','!=','')]" help="Sale journal in this year"/>
		               	<filter icon="terp-go-month" string="This Month" domain="[('name','=',time.strftime('%%Y-%%m-01'))]" help="Sale journal in this month"/>
		               	<separator orientation="vertical"/>
		                <filter icon="terp-document-new"
		                    	string="Quotations"
		                    	domain="[('state','=','draft')]"/>
		                <filter icon="terp-gtk-media-pause"
		                		string="Waiting Schedule"
		                		domain="[('state','=','waiting_date')]"/>
		                <filter icon="terp-camera_test"
		                		string="In progress"
		                		domain="[('state','=','progress')]"/>
		                <separator orientation="vertical"/>
		                <field name="name" select="1"/>
		                <field name="state" select="1"/>
		                <field name="journal_id" widget="selection"/>
					</group>
					<newline/>
					<group expand="1" string="Group By..." colspan="4" col="12">
						<filter string="journal" name="journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
						<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
					</group>
	            </search>
	        </field>
	    </record>

	<!-- Action of sales by journal view-->

	    <record model="ir.actions.act_window" id="action_sale_journal_report_open_menu_all">
	    	<field name="name">Sales by Journal</field>
	        <field name="res_model">sale.journal.report</field>
	        <field name="type">ir.actions.act_window</field>
	        <field name="view_type">form</field>
	        <field name="view_mode">tree,graph</field>
	        <field name="search_view_id" ref="view_sale_journal_report_search"/>
	        <field name="context">{'search_default_journal': 1,'group_by_no_leaf':1,'group_by':[]}</field>
	    </record>

	    <menuitem name="Sales by Journal" id="menu_sale_journal_report_open_all"
	              parent="base.next_id_64" action="action_sale_journal_report_open_menu_all" sequence="2" groups="base.group_sale_manager"/>

	</data>
</openerp>
