<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2011 Alexis de Lattre <alexis.delattre@akretion.com>
     Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="view_move_tree" model="ir.ui.view">
    <field name="name">Add to_be_reversed column</field>
    <field name="model">account.move</field>
    <field name="inherit_id" ref="account.view_move_tree" />
    <field name="arch" type="xml">
        <field name="state" position="after">
            <field name="to_be_reversed"/>
        </field>
    </field>
</record>

<record id="view_move_form" model="ir.ui.view">
    <field name="name">Add to_be_reversed and reversal_id fields</field>
    <field name="model">account.move</field>
    <field name="inherit_id" ref="account.view_move_form"/>
    <field name="arch" type="xml">
            <button name="%(account.action_view_account_move_reversal)d" position="attributes">
                <attribute name="name">%(act_account_move_reverse)d</attribute>
            </button>
            <xpath expr="//field[@name='company_id']" position="after">
            <field name="to_be_reversed"/>
            <field name="reversal_id"
                   attrs="{'invisible': [('to_be_reversed', '=', False), ('reversal_id', '=', False)]}"/>
        </xpath>
    </field>
</record>

<record id="view_account_move_filter" model="ir.ui.view">
    <field name="name">Add to_be_reversed filter</field>
    <field name="model">account.move</field>
    <field name="inherit_id" ref="account.view_account_move_filter" />
    <field name="arch" type="xml">
        <field name="date" position="after">
            <filter name="to_be_reversed"
                string="To Be Reversed"
                domain="[('to_be_reversed', '=', True), ('reversal_id', '=', False)]"
                help="Journal Entries to be Reversed"/>
        </field>
    </field>
</record>

<act_window
    context="{'search_default_to_be_reversed':1}"
    id="action_move_to_be_reversed" name="Journal Entries to be Reversed"
    res_model="account.move"
    view_id="account.view_move_tree"/>

<menuitem id="menu_move_to_be_reversed"
          parent="account.menu_finance_entries" sequence="80"
          name="Journal Entries to be Reversed"
          action="action_move_to_be_reversed"/>

</odoo>
