<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2015-2020 Akretion France (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>

<record id="view_account_journal_form" model="ir.ui.view">
    <field name="name">usability.account.journal.form</field>
    <field name="model">account.journal</field>
    <field name="inherit_id" ref="account.view_account_journal_form"/>
    <field name="arch" type="xml">
        <field name="bank_statements_source" position="after">
            <field name="hide_bank_statement_balance" groups="account.group_account_readonly"/>
            <field name="account_type_current_assets_id" invisible="1"/>
        </field>
        <field name="suspense_account_id" position="attributes">
            <attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': False}</attribute>
        </field>
        <field name="payment_debit_account_id" position="attributes">
            <attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': True}</attribute>
        </field>
        <field name="payment_credit_account_id" position="attributes">
            <attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': True}</attribute>
        </field>
    </field>
</record>

<record id="account_journal_dashboard_kanban_view" model="ir.ui.view">
    <field name="name">usability.account.journal.dashboard</field>
    <field name="model">account.journal</field>
    <field name="inherit_id" ref="account.account_journal_dashboard_kanban_view"/>
    <field name="arch"  type="xml">
        <field name="kanban_dashboard" position="after">
            <field name="hide_bank_statement_balance"/>
        </field>
        <xpath expr="//div[@name='latest_statement']/.." position="attributes">
            <attribute name="t-if">dashboard.has_at_least_one_statement and dashboard.account_balance != dashboard.last_balance and !record.hide_bank_statement_balance.raw_value</attribute>
        </xpath>
        <t t-esc="dashboard.outstanding_pay_account_balance" position="replace">
            <a name="open_outstanding_payments" type="object" title="Outstanding Payments/Receipts"><t t-esc="dashboard.outstanding_pay_account_balance"/></a>
        </t>
    </field>
</record>

<record id="view_account_journal_tree" model="ir.ui.view">
    <field name="name">usability.account.journal.tree</field>
    <field name="model">account.journal</field>
    <field name="inherit_id" ref="account.view_account_journal_tree"/>
    <field name="arch" type="xml">
        <field name="name" position="after">
            <field name="code" optional="show"/>
        </field>
    </field>
</record>

<record id="view_account_journal_search" model="ir.ui.view">
    <field name="name">usability.account.journal.search</field>
    <field name="model">account.journal</field>
    <field name="inherit_id" ref="account.view_account_journal_search"/>
    <field name="arch"  type="xml">
        <filter name="inactive" position="after">
            <group name="groupby" string="Group By">
                <filter name="type_groupby" string="Type" context="{'group_by': 'type'}"/>
            </group>
        </filter>
    </field>
</record>

</odoo>
