<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>

    <record model="ir.ui.view" id="view_asset_asset_report_tree">
      <field name="name">asset.asset.report.tree</field>
      <field name="model">asset.asset.report</field>
      <field name="arch" type="xml">
        <tree string="Assets" create="false">
          <field name="name" invisible="1"/>
          <field name="asset_id" invisible="1"/>
          <field name="asset_category_id" invisible="1"/>
          <field name="state"  invisible="1"/>
          <field name="date_start" invisible="1"/>
          <field name="date_remove" invisible="1"/>
          <field name="depreciation_date" invisible="1"/>
          <field name="move_check" invisible="1"/>
          <field name="company_id" invisible="1"/>
          <field name="nbr" sum="# of Depreciation Lines"/>
          <field name="asset_value"/>
          <field name="depreciation_value" sum="Amount of Depreciation Lines"/>
          <field name="posted_value"/>
          <field name="unposted_value" invisible="not context.get('unposted_value_visible', True)"/>
        </tree>
      </field>
    </record>

    <record model="ir.ui.view" id="action_account_asset_report_graph">
      <field name="name">asset.asset.report.graph</field>
      <field name="model">asset.asset.report</field>
      <field name="arch" type="xml">
        <graph string="Assets Analysis" type="bar">
          <field name="asset_id"/>
          <field name="depreciation_value"/>
        </graph>
      </field>
    </record>

    <record id="view_asset_asset_report_search" model="ir.ui.view">
      <field name="name">asset.asset.report.search</field>
      <field name="model">asset.asset.report</field>
      <field name="arch" type="xml">
        <search string="Assets Analysis">
          <field name="date_start"/>
          <field name="date_remove"/>
          <field name="depreciation_date"/>
          <filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]" help="Draft Assets"/>
          <filter string="Running" icon="terp-check" domain="[('state','=','open')]" help="Assets in Running state"/>
          <filter icon="terp-check" string="Close" domain="[('state','=', 'close')]" help="Assets in Close State"/>
          <filter icon="terp-dialog-close" string="Removed" domain="[('state','=', 'removed')]" help="Assets which have been removed"/>
          <separator/>
          <filter string="Posted" name="posted" icon="terp-camera_test" domain="[('move_check','=',True)]" help="Posted depreciation lines" context="{'unposted_value_visible': 0}"/>
          <field name="asset_id"/>
          <field name="asset_category_id"/>
          <group expand="0" string="Extended Filters...">
            <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
            <field name="company_id" groups="base.group_multi_company"/>
          </group>
          <group expand="1" string="Group By...">
            <filter string="Asset" name="asset" context="{'group_by':'asset_id'}"/>
            <filter string="Asset Category" name="asset_category" icon="terp-stock_symbol-selection" context="{'group_by':'asset_category_id'}"/>
            <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
            <filter string="Asset Start Date" icon="terp-go-month"
                    domain="[]" context="{'group_by':'date_start'}"/>
            <filter string="Depreciation Date" icon="terp-go-today"
                    domain="[]" context="{'group_by':'depreciation_date'}" help="Date of depreciation"/>
          </group>
        </search>
      </field>
    </record>

    <record model="ir.actions.act_window" id="action_asset_asset_report">
      <field name="name">Assets Analysis</field>
      <field name="res_model">asset.asset.report</field>
      <field name="view_type">form</field>
      <field name="view_mode">tree,graph</field>
      <field name="search_view_id" ref="view_asset_asset_report_search"/>
      <field name="context">{'search_default_year':1,'search_default_this_month':1,'search_default_asset_category':1, 'search_default_posted':1, 'group_by':[], 'group_by_no_leaf':1}</field>
      <field name="help" type="html">
        <p>
          From this report, you can have an overview on all depreciations. The
          tool search can also be used to personalise your Assets reports and
          so, match this analysis to your needs;
        </p>
      </field>
    </record>

    <menuitem action="action_asset_asset_report"
              id="menu_action_asset_asset_report"
              parent="account.menu_finance_reporting"/>
  </data>
</openerp>
