<?xml version="1.0"?>
<terp>
	<data>

		<record model="ir.ui.view" id="view_account_analytic_account_list">
			<field name="name">account.analytic.account.list</field>
			<field name="model">account.analytic.account</field>
			<field name="type">tree</field>
			<field name="priority" eval="8"/>
			<field name="arch" type="xml">
				<tree string="Analytic Account" colors="red:date and (date&lt;=current_date); red:quantity_max and (quantity_max&gt;quantity)">
				<!--<tree string="Analytic Account" colors="red:date and (date&lt;=current_date)">-->
					<field name="code" />
					<field name="complete_name"/>
					<field name="partner_id" />
					<field name="quantity" />
					<field name="quantity_max" />
					<field name="date" />
				</tree>
			</field>
		</record>

		<record model="ir.ui.view" id="view_account_analytic_account_tree">
			<field name="name">account.analytic.account.tree</field>
			<field name="model">account.analytic.account</field>
			<field name="type">tree</field>
			<field name="field_parent">child_ids</field>
			<field name="arch" type="xml">
				<tree string="Analytic Account" colors="red:date and (date&lt;=current_date); red:quantity_max and (quantity_max&gt;quantity)">
				<!--<tree string="Analytic Account" colors="red:date and (date&lt;=current_date) or quantity_max and (quantity_max&gt;quantity)">-->
					<field name="name"/>
					<field name="code"/>
					<field name="partner_id" />
					<field name="date" />
					<field name="balance" />
					<field name="quantity" />
				</tree>
			</field>
		</record>

		<record model="ir.ui.view" id="view_account_analytic_account_form">
			<field name="name">account.analytic.account.form</field>
			<field name="model">account.analytic.account</field>
			<field name="type">form</field>
			<field name="arch" type="xml">
				<form string="Analytic Account">
					<notebook>
						<page string="Account Data">
							<field name="name" select="1"/>
							<field name="code" select="1"/>
							<field name="parent_id" on_change="on_change_parent(parent_id)" />
							<field name="type" select="1" />
							<field name="partner_id" select="1" />
							<newline/>
							<field name="date_start" />
							<field name="date" select="1" />
							<newline/>
							<field name="quantity_max" />
							<field name="user_id" />
							<separator string="Note" colspan="4" />
							<field name="description" colspan="4" nolabel="1" />
						</page>
						<page string="Statistics">
							<field name="stats_ids" colspan="4" nolabel="1"/>
						</page>
					</notebook>
				</form>
			</field>
		</record>

		<record model="ir.actions.act_window" id="action_account_analytic_account_form">
			<field name="name">account.analytic.account</field>
			<field name="type">ir.actions.act_window</field>
			<field name="res_model">account.analytic.account</field>
			<field name="view_type">form</field>
			<field name="view_id" ref="view_account_analytic_account_form"/>
		</record>
		<menuitem name="Financial Management/Configuration/Analytic Accounts/Accounts Definition" id="account_analytic_def_account"
		   	action="action_account_analytic_account_form"/>

		<record model="ir.actions.act_window" id="action_account_analytic_account_tree2">
			<field name="name">account.analytic.account</field>
			<field name="type">ir.actions.act_window</field>
			<field name="res_model">account.analytic.account</field>
			<field name="domain">[('parent_id','=',False)]</field>
			<field name="view_type">tree</field>
			<field name="view_id" ref="view_account_analytic_account_tree"/>
		</record>
		<menuitem name="Financial Management/Configuration/Analytic Accounts/Analytic Accounts Charts" id="account_analytic_def_chart"
		   	action="action_account_analytic_account_tree2"/>
		<menuitem name="Financial Management/Charts/Analytic Accounts Charts" id="account_analytic_chart"
		   	action="action_account_analytic_account_tree2"/>
		<menuitem name="Financial Management/Reporting/Analytic/Analytic Balance" id="account_analytic_chart_balance"
		   	action="action_account_analytic_account_tree2"/>

		<record model="ir.ui.view" id="view_account_analytic_line_form">
			<field name="name">account.analytic.line.form</field>
			<field name="model">account.analytic.line</field>
			<field name="type">form</field>
			<field name="arch" type="xml">
				<form string="Analytic Entry">
					<field name="name" select="1" colspan="3"/>
					<field name="amount"  select="1"/>
					<field name="date" select="1"/>
					<field name="account_id" select="1"/>
					<field name="journal_id" select="1"/>
					<field name="general_account_id" select="1"/>
					<field name="move_id" select="1"/>
					<field name="unit_amount" select="1"/>
					<newline/>
					<field name="product_id" select="1"/>
					<field name="product_uom_id" select="1"/>
				</form>
			</field>
		</record>
		<record model="ir.ui.view" id="view_account_analytic_line_tree">
			<field name="name">account.analytic.line.tree</field>
			<field name="model">account.analytic.line</field>
			<field name="type">tree</field>
			<field name="arch" type="xml">
				<tree string="Analytic Entries" editable="top">
					<field name="date"/>
					<field name="name" />
					<field name="unit_amount" />
					<field name="amount" />
					<field name="account_id" domain="[('type','=','normal')]"/>
					<field name="general_account_id"/>
					<field name="journal_id"/>
				</tree>
			</field>
		</record>
		<record model="ir.actions.act_window" id="action_account_analytic_line_form">
			<field name="name">action.account.analytic.line.form</field>
			<field name="type">ir.actions.act_window</field>
			<field name="res_model">account.analytic.line</field>
			<field name="view_type">form</field>
			<field name="view_id" ref="view_account_analytic_line_form"/>
		</record>
		<menuitem name="Financial Management/Entries/Analytic account/Entries" id="account_entries_analytic_entries" action="action_account_analytic_line_form" />


		<record model="ir.actions.act_window" id="action_account_tree1">
			<field name="name">account.account.tree1</field>
			<field name="res_model">account.analytic.line</field>
			<field name="view_type">form</field>
			<field name="view_mode">tree,form</field>
			<field name="domain">[('account_id','=', active_id)]</field>
		</record>
		<record model="ir.values" id="ir_open_account_analytic_account">
			<field name="key2" eval="'tree_but_open'"/>
			<field name="model" eval="'account.analytic.account'"/>
			<field name="name">Open Account Tree</field>
			<field name="value" eval="'ir.actions.act_window,%d'%action_account_tree1"/>
			<field name="object" eval="True"/>
		</record>

		<record model="ir.ui.view" id="account_analytic_line_extended_form">
			<field name="name">account.analytic.line.extended_form</field>
			<field name="model">account.analytic.line</field>
			<field name="type">form</field>
			<field name="arch" type="xml">
				<form string="Project line">
					<field name="name" />
					<field name="account_id" />
					<field name="account_id" />
					<field name="date" />
					<field name="journal_id" />
					<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" />
					<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" />
					<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" />
					<field name="amount" colspan="3" />
				</form>
			</field>
		</record>
		<record model="ir.actions.act_window" id="action_account_analytic_account_line_extended_form">
			<field name="name">account.analytic.line.form_extended</field>
			<field name="type">ir.actions.act_window</field>
			<field name="res_model">account.analytic.line</field>
			<field name="view_type">form</field>
			<field name="view_id" ref="account_analytic_line_extended_form" />
		</record>


	#
	# Analytic Journal
	#

	<record model="ir.ui.view" id="view_account_analytic_journal_tree">
		<field name="name">account.analytic.journal.tree</field>
		<field name="model">account.analytic.journal</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
			<tree string="Analytic Journal">
				<field name="code"/>
				<field name="name"/>
				<field name="type"/>
			</tree>
		</field>
	</record>

	<record model="ir.ui.view" id="view_account_analytic_journal_form">
		<field name="name">account.analytic.journal.form</field>
		<field name="model">account.analytic.journal</field>
		<field name="type">form</field>
		<field name="arch" type="xml">
			<form string="Analytic Journal">
				<field name="name" select="1"/>
				<field name="code" select="1"/>
				<field name="type" select="1" />
				<field name="active" select="1" />
			</form>
		</field>
	</record>
	<record model="ir.actions.act_window" id="action_account_analytic_journal_form">
		<field name="name">account.analytic.journal.form</field>
		<field name="res_model">account.analytic.journal</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
	</record>
	<menuitem name="Financial Management/Configuration/Journal/Analytic Journal Definition" id="account_def_analytic_journal" 
		action="action_account_analytic_journal_form"/>

	#
	# Open journal entries
	#

	<record model="ir.actions.act_window" id="action_account_analytic_journal_open_form">
		<field name="name">account.analytic.line.form</field>
		<field name="res_model">account.analytic.line</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree,form</field>
		<field name="domain">[('journal_id','=',active_id)]</field>
	</record>
	<record model="ir.values" id="ir_open_account_journal_analytic">
		<field name="key2" eval="'tree_but_open'"/>
		<field name="model" eval="'account.analytic.journal'"/>
		<field name="name">Open Analytic Journal</field>
		<field name="value" eval="'ir.actions.act_window,%d'%action_account_analytic_journal_open_form"/>
		<field name="object" eval="True"/>
	</record>

	#
	# Reporting
	#

	<record model="ir.actions.act_window" id="action_account_analytic_journal_tree">
		<field name="name">account.analytic.journal.tree</field>
		<field name="res_model">account.analytic.journal</field>
		<field name="view_type">tree</field>
	</record>
	<menuitem name="Financial Management/Reporting/Analytic/Print analytic journals"
		id="account_analytic_journal_print"
	   	action="action_account_analytic_journal_tree"/> 


	<record model="ir.actions.act_window" id="action_account_analytic_journal_tree2">
		<field name="name">account.analytic.journal.tree</field>
		<field name="res_model">account.analytic.journal</field>
		<field name="view_type">tree</field>
		<field name="view_id" ref="view_account_analytic_journal_tree"/>
	</record>
	<menuitem name="Financial Management/Entries/Analytic account/Journal Entries"
		id="account_analytic_journal_entries"
		action="action_account_analytic_journal_tree2"/>

	#
	# Statistics
	# 

	<record model="ir.ui.view" id="report_hr_timesheet_invoice_journal_form">
		<field name="name">report.hr.timesheet.invoice.journal.form</field>
		<field name="model">report.hr.timesheet.invoice.journal</field>
		<field name="type">tree</field>
		<field name="arch" type="xml">
			<tree string="Analytic Entries Stats">
				<field name="name"/>
				<field name="account_id"/>
				<field name="journal_id"/>
				<field name="quantity"/>
				<field name="revenue"/>
				<field name="cost"/>
			</tree>
		</field>
	</record>

	<record model="ir.actions.act_window" id="report_account_analytic_journal_tree">
		<field name="name">report.hr.timesheet.invoice.journal</field>
		<field name="res_model">report.hr.timesheet.invoice.journal</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree</field>
	</record>
	<menuitem name="Financial Management/Reporting/Analytic/All Months/Account Cost and Revenue by journal"
		id="report_account_analytic_journal_print"
		action="report_account_analytic_journal_tree"/> 
	<record model="ir.actions.act_window" id="report_account_analytic_journal_tree_month">
		<field name="name">report.hr.timesheet.invoice.journal</field>
		<field name="res_model">report.hr.timesheet.invoice.journal</field>
		<field name="view_type">form</field>
		<field name="view_mode">tree</field>
		<field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
	</record>
	<menuitem name="Financial Management/Reporting/Analytic/This Month/Account Cost and Revenue by journal"
		id="report_account_analytic_journal_print_month"
		action="report_account_analytic_journal_tree_month"/> 
	
	</data>
</terp>
