<?xml version="1.0"?>
<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
    <data>
        <record model="ir.ui.view" id="payment_journal_view_form">
            <field name="model">account.payment.journal</field>
            <field name="inherit" ref="account_payment.payment_journal_view_form"/>
            <field name="name">payment_journal_form</field>
        </record>

        <record model="ir.ui.view" id="account_view_form">
            <field name="model">account.payment.braintree.account</field>
            <field name="type">form</field>
            <field name="name">account_form</field>
        </record>

        <record model="ir.ui.view" id="account_view_list">
            <field name="model">account.payment.braintree.account</field>
            <field name="type">tree</field>
            <field name="name">account_list</field>
        </record>

        <record model="ir.action.act_window" id="act_account_form">
            <field name="name">Braintree Accounts</field>
            <field name="res_model">account.payment.braintree.account</field>
        </record>
        <record model="ir.action.act_window.view" id="act_account_form_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="account_view_list"/>
            <field name="act_window" ref="act_account_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_account_form_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="account_view_form"/>
            <field name="act_window" ref="act_account_form"/>
        </record>
        <menuitem
            parent="account_payment.menu_payment_configuration"
            sequence="50"
            action="act_account_form"
            id="menu_account_form"/>

        <record model="ir.model.button" id="account_new_identifier_button">
            <field name="model">account.payment.braintree.account</field>
            <field name="name">new_identifier</field>
            <field name="string">New URL</field>
            <field name="confirm">This action will make the previous URL unusable. Do you want to continue?</field>
        </record>

        <record model="ir.model.access" id="access_account">
            <field name="model">account.payment.braintree.account</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_account_account_admin">
            <field name="model">account.payment.braintree.account</field>
            <field name="group" ref="account.group_account_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>
        <record model="ir.model.access" id="access_account_payment">
            <field name="model">account.payment.braintree.account</field>
            <field name="group" ref="account_payment.group_payment"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>

        <record model="ir.model.field.access" id="access_account_private_key">
            <field name="model">account.payment.braintree.account</field>
            <field name="field">private_key</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>

        <record model="ir.model.field.access" id="access_account_private_key_account_admin">
            <field name="model">account.payment.braintree.account</field>
            <field name="field">private_key</field>
            <field name="group" ref="account.group_account_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.ui.view" id="payment_view_form">
            <field name="model">account.payment</field>
            <field name="inherit" ref="account_payment.payment_view_form"/>
            <field name="name">payment_form</field>
        </record>

        <record model="ir.ui.view" id="payment_view_list">
            <field name="model">account.payment</field>
            <field name="inherit" ref="account_payment.payment_view_list"/>
            <field name="name">payment_list</field>
        </record>

        <record model="ir.model.button" id="payment_braintree_checkout_button">
            <field name="model">account.payment</field>
            <field name="name">braintree_checkout</field>
            <field name="string">Braintree Checkout</field>
        </record>

        <record model="ir.model.button" id="payment_braintree_settle_payment_button">
            <field name="model">account.payment</field>
            <field name="name">braintree_do_settle_payment</field>
            <field name="string">Braintree Settle Payment</field>
        </record>

        <record model="ir.model.button" id="payment_braintree_pull_button">
            <field name="model">account.payment</field>
            <field name="name">braintree_do_pull</field>
            <field name="string">Braintree Pull</field>
        </record>

        <record model="ir.ui.view" id="refund_view_form">
            <field name="model">account.payment.braintree.refund</field>
            <field name="type">form</field>
            <field name="name">refund_form</field>
        </record>
        <record model="ir.ui.view" id="refund_view_list">
            <field name="model">account.payment.braintree.refund</field>
            <field name="type">tree</field>
            <field name="name">refund_list</field>
        </record>

        <record model="ir.action.act_window" id="act_refund_form">
            <field name="name">Braintree Refunds</field>
            <field name="res_model">account.payment.braintree.refund</field>
        </record>
        <record model="ir.action.act_window.view" id="act_refund_form_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="refund_view_list"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_refund_form_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="refund_view_form"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_refund_form_domain_draft">
            <field name="name">Draft</field>
            <field name="sequence" eval="10"/>
            <field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
            <field name="count" eval="True"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_refund_form_domain_to_approve">
            <field name="name">To Approve</field>
            <field name="sequence" eval="20"/>
            <field name="domain" eval="[('state', '=', 'submitted')]" pyson="1"/>
            <field name="count" eval="True"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_refund_form_domain_to_process">
            <field name="name">To Process</field>
            <field name="sequence" eval="30"/>
            <field name="domain" eval="[('state', '=', 'approved')]" pyson="1"/>
            <field name="count" eval="True"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_refund_form_domain_processing">
            <field name="name">Processing</field>
            <field name="sequence" eval="40"/>
            <field name="domain" eval="[('state', '=', 'processing')]" pyson="1"/>
            <field name="count" eval="True"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_refund_form_domain_suceeded">
            <field name="name">Succeeded</field>
            <field name="sequence" eval="50"/>
            <field name="domain" eval="[('state', '=', 'succeeded')]" pyson="1"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_refund_form_domain_failed">
            <field name="name">Failed</field>
            <field name="sequence" eval="60"/>
            <field name="domain" eval="[('state', '=', 'failed')]" pyson="1"/>
            <field name="act_window" ref="act_refund_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_refund_form_domain_all">
            <field name="name">All</field>
            <field name="sequence" eval="9999"/>
            <field name="domain"></field>
            <field name="act_window" ref="act_refund_form"/>
        </record>

        <menuitem
            parent="account_payment.menu_payments"
            sequence="20"
            action="act_refund_form"
            id="menu_refund_form"/>

        <record model="ir.model.button" id="refund_draft_button">
            <field name="model">account.payment.braintree.refund</field>
            <field name="name">draft</field>
            <field name="string">Draft</field>
        </record>

        <record model="ir.model.button" id="refund_submit_button">
            <field name="model">account.payment.braintree.refund</field>
            <field name="name">submit</field>
            <field name="string">Submit</field>
        </record>

        <record model="ir.model.button" id="refund_approve_button">
            <field name="model">account.payment.braintree.refund</field>
            <field name="name">approve</field>
            <field name="string">Approve</field>
        </record>

        <record model="ir.ui.view" id="customer_view_form">
            <field name="model">account.payment.braintree.customer</field>
            <field name="type">form</field>
            <field name="name">customer_form</field>
        </record>

        <record model="ir.ui.view" id="customer_view_list">
            <field name="model">account.payment.braintree.customer</field>
            <field name="type">tree</field>
            <field name="name">customer_list</field>
        </record>

        <record model="ir.action.act_window" id="act_customer_form">
            <field name="name">Braintree Customers</field>
            <field name="res_model">account.payment.braintree.customer</field>
        </record>
        <record model="ir.action.act_window.view" id="act_customer_form_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="customer_view_list"/>
            <field name="act_window" ref="act_customer_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_customer_form_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="customer_view_form"/>
            <field name="act_window" ref="act_customer_form"/>
        </record>
        <menuitem
            parent="account_payment.menu_payments"
            sequence="50"
            action="act_customer_form"
            id="menu_customer_form"/>

        <record model="ir.model.access" id="access_customer">
            <field name="model">account.payment.braintree.customer</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_customer_payment">
            <field name="model">account.payment.braintree.customer</field>
            <field name="group" ref="account_payment.group_payment"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>
        <record model="ir.model.button" id="customer_braintree_checkout_button">
            <field name="model">account.payment.braintree.customer</field>
            <field name="name">braintree_checkout</field>
            <field name="string">Add Card</field>
        </record>
        <record model="ir.model.button" id="customer_braintree_update_button">
            <field name="model">account.payment.braintree.customer</field>
            <field name="name">braintree_update</field>
            <field name="string">Update</field>
        </record>

        <record model="ir.model.button" id="customer_payment_method_delete_button">
            <field name="model">account.payment.braintree.customer</field>
            <field name="name">delete_payment_method</field>
            <field name="string">Delete Payment Method</field>
        </record>

        <record model="ir.action.wizard" id="wizard_customer_payment_method_delete">
            <field name="name">Delete Payment Method</field>
            <field name="wiz_name">account.payment.braintree.customer.payment_method.delete</field>
            <field name="model">account.payment.braintree.customer</field>
        </record>

        <record model="ir.ui.view" id="customer_payment_method_delete_ask_view_form">
            <field name="model">account.payment.braintree.customer.payment_method.delete.ask</field>
            <field name="type">form</field>
            <field name="name">customer_payment_method_delete_ask_form</field>
        </record>

        <record model="ir.action.url" id="url_checkout">
            <field name="name">Braintree Checkout</field>
            <field name="url">%(http_host)s/%(database)s/account_payment_braintree/checkout/%(model)s/%(id)s</field>
        </record>

        <record model="ir.action.report" id="report_checkout">
            <field name="name">Braintree Checkout</field>
            <field name="model" eval="None"/>
            <field name="report_name">account.payment.braintree.checkout</field>
            <field name="report">account_payment_braintree/checkout.html</field>
            <field name="template_extension">html</field>
        </record>
    </data>
    <data grouped="1" noupdate="1">
        <record model="ir.cron" id="cron_transact_payment">
            <field name="method">account.payment|braintree_transact</field>
            <field name="interval_number" eval="15"/>
            <field name="interval_type">minutes</field>
        </record>

        <record model="ir.cron" id="cron_pull_payment">
            <field name="method">account.payment|braintree_pull</field>
            <field name="interval_number" eval="15"/>
            <field name="interval_type">minutes</field>
        </record>

        <record model="ir.cron" id="cron_refund">
            <field name="method">account.payment.braintree.refund|braintree_refund</field>
            <field name="interval_number" eval="15"/>
            <field name="interval_type">minutes</field>
        </record>

        <record model="ir.cron" id="cron_pull_refund">
            <field name="method">account.payment.braintree.refund|braintree_pull</field>
            <field name="interval_number" eval="15"/>
            <field name="interval_type">minutes</field>
        </record>

        <record model="ir.cron" id="cron_create_customer">
            <field name="method">account.payment.braintree.customer|braintree_create</field>
            <field name="interval_number" eval="1"/>
            <field name="interval_type">hours</field>
        </record>

        <record model="ir.cron" id="cron_delete_customer">
            <field name="method">account.payment.braintree.customer|braintree_delete</field>
            <field name="interval_number" eval="1"/>
            <field name="interval_type">hours</field>
        </record>
    </data>
</tryton>
