<terp>
<data>
	<record model="ir.ui.view" id="purchase_journal_picking_order">
		<field name="name">stock.picking.journal.view.form</field>
		<field name="type">form</field>
		<field name="model">stock.picking</field>
		<field name="inherit_id" ref="stock.view_picking_form" />
		<field name="arch" type="xml">
			<field name="origin" position="after">
				<field name="purchase_journal_id" select="1"/>
			</field>
		</field>
	</record>

	<record model="ir.ui.view" id="view_purchase_journal_form">
		<field name="name">purchase_journal.purchase.journal.form</field>
		<field name="model">purchase_journal.purchase.journal</field>
		<field name="type">form</field>
		<field name="arch" type="xml">
			<form string="purchase Journal">
				<notebook>
				<page string="Journal">
					<separator string="Journal Information" colspan="4"/>
					<field name="name" select="1"/>
					<field name="code" select="1"/>
					<field name="user_id" select="1"/>
					<field name="date" select="1"/>
					<field name="date_created" select="1"/>
					<field name="date_validation" select="1"/>
					<separator string="States" colspan="4"/>
					<field name="state"/>
					<group col="3" colspan="2">
						<button name="button_open" string="Open Journal" states="draft" type="object"/>
						<button name="button_close" string="Close Journal" states="open" type="object"/>
						<button name="button_draft" string="Set to Draft" states="close,open" type="object"/>
					</group>
				</page>
				<page string="purchases">
					<button string="Confirm purchases" name="button_purchase_confirm" states="draft,open" type="object"/>
					<button string="Cancel purchases" name="button_purchase_cancel" states="draft,open" type="object"/>
					<newline/>
					<field name="purchase_stats_ids" colspan="4" nolabel="1">
						<tree string="purchases">
							<field name="name"/>
							<field name="quantity"/>
							<field name="price_total"/>
							<field name="price_average"/>
							<field name="count"/>
							<field name="state"/>
						</tree>
					</field>
				</page><page string="Notes">
					<field name="note" colspan="4" nolabel="1"/>
				</page>
				</notebook>
			</form>
		</field>
	</record>
	<record model="ir.ui.view" id="view_purchase_journal_tree">
		<field name="name">purchase_journal.purchase.journal.tree</field>
		<field name="model">purchase_journal.purchase.journal</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
			<tree string="purchase Journal">
				<field name="name" select="1"/>
				<field name="code" select="1"/>
				<field name="user_id" select="1"/>
				<field name="date" select="1"/>
				<field name="state"/>
			</tree>
		</field>
	</record>
	<record model="ir.actions.act_window" id="action_definition_journal">
		<field name="name">purchase_journal.purchase.journal.tree</field>
		<field name="res_model">purchase_journal.purchase.journal</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
	</record>
	<menuitem
		name="Purchase Management/Configuration/purchases Journals"
		id="menu_definition_journal"
		action="action_definition_journal"/>


	<record model="ir.actions.act_window" id="action_definition_journal_tree">
		<field name="name">purchase_journal.purchase.journal.tree</field>
		<field name="res_model">purchase_journal.purchase.journal</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
		<field name="domain">[]</field>
	</record>
	<menuitem
		name="Purchase Management/purchases by Journal"
		id="menu_definition_journal_purchases"
		action="action_definition_journal_tree"/>

	<record model="ir.actions.act_window" id="action_definition_journal_tree_my">
		<field name="name">purchase_journal.purchase.journal.tree.my</field>
		<field name="res_model">purchase_journal.purchase.journal</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
		<field name="domain">[('user_id','=',uid),('state','=','open')]</field>
	</record>
	<menuitem
		name="Purchase Management/purchases by Journal/My open Journals"
		id="menu_definition_journal_purchases_my_open"
		action="action_definition_journal_tree_my"/>

	<record model="ir.actions.act_window" id="action_definition_journal_tree_all">
		<field name="name">purchase_journal.purchase.journal.tree.all</field>
		<field name="res_model">purchase_journal.purchase.journal</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
		<field name="domain">[('state','=','open')]</field>
	</record>
	<menuitem
		name="Purchase Management/purchases by Journal/All open Journals"
		id="menu_definition_journal_purchases_all_open"
		action="action_definition_journal_tree_all"/>


	<record model="ir.ui.view" id="purchase_journal_purchase_order">
		<field name="name">purchase.order.journal.view.form</field>
		<field name="type">form</field>
		<field name="model">purchase.order</field>
		<field name="inherit_id" ref="purchase.purchase_order_form" />
		<field name="arch" type="xml">
			<field name="date_approve" position="after">
				<field name="journal_id" select="1"/>
			</field>
		</field>
	</record>
	<record model="ir.ui.view" id="purchase_journal_purchase_order_tree">
		<field name="name">purchase.order.journal.view.tree</field>
		<field name="type">tree</field>
		<field name="model">purchase.order</field>
		<field name="inherit_id" ref="purchase.purchase_order_tree" />
		<field name="arch" type="xml">
			<field name="state" position="after">
				<field name="journal_id"/>
			</field>
		</field>
	</record>

	<record model="ir.ui.view" id="view_purchase_journal_purchase_stats_tree">
		<field name="name">purchase_journal.purchase.stats.tree</field>
		<field name="model">purchase_journal.purchase.stats</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
			<tree string="purchases by Journal">
				<field name="name"/>
				<field name="state"/>
				<field name="journal_id"/>
				<field name="quantity"/>
				<field name="count"/>
				<field name="price_total"/>
				<field name="price_average"/>
			</tree>
		</field>
	</record>
	<record model="ir.ui.view" id="view_purchase_journal_purchase_stats_form">
		<field name="name">purchase_journal.purchase.stats.form</field>
		<field name="model">purchase_journal.purchase.stats</field>
		<field name="type">form</field>
		<field name="arch" type="xml">
			<form string="purchases by Journal">
				<field name="name" select="1"/>
				<field name="state" select="1"/>
				<field name="journal_id" select="1"/>
				<field name="quantity"/>
				<field name="count"/>
				<field name="price_total"/>
				<field name="price_average"/>
			</form>
		</field>
	</record>

	<record model="ir.actions.act_window" id="action_purchase_purchase_stats_open_menu_month">
		<field name="name">purchase_journal.purchase.stats.open</field>
		<field name="res_model">purchase_journal.purchase.stats</field>
		<field name="type">ir.actions.act_window</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
		<field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
	</record>
	<menuitem
		name="Purchase Management/Reporting/This Month/purchases by journal"
		action="action_purchase_purchase_stats_open_menu_month"
		id="menu_purchase_purchase_stats_open_menu"/>

	<record model="ir.actions.act_window" id="action_purchase_purchase_stats_open_menu_all">
		<field name="name">purchase_journal.purchase.stats.open</field>
		<field name="res_model">purchase_journal.purchase.stats</field>
		<field name="type">ir.actions.act_window</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
	</record>
	<menuitem
		name="Purchase Management/Reporting/All Months/purchases by journal"
		action="action_purchase_purchase_stats_open_menu_all"
		id="menu_purchase_purchase_stats_open_all"/>



</data>
</terp>
