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

        <!-- View used in the wizard -->
        <record model="ir.ui.view" id="view_move_line_tree_wiz">
            <field name="name">account.move.line.tree</field>
            <field name="model">account.move.line</field>
            <field name="type">tree</field>
            <field name="priority" eval="1"/>
            <field name="arch" type="xml">
                <tree string="Account Entry Line">
                    <field name="partner_id"/>
                    <field name="ref"/>
                    <field name="name"/>
                    <field name="date_maturity"/>
                    <field name="date"/>
                    <field name="debit" sum="Total debit"/>
                    <field name="credit" sum="Total credit"/>
                    <field name="amount_currency"/>
                    <field name="currency_id"/>
                </tree>
            </field>
        </record>

        <menuitem id="menu_main" name="Payment" parent="account.menu_finance"/>
        
        <record id="view_payment_type_form" model="ir.ui.view">
            <field name="name">payment.type.form</field>
            <field name="model">payment.type</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Payment type">
                    <field name="name" select="1"/>
                    <field name="code"/>
                    <newline/>
                    <field colspan="4" name="suitable_bank_types" select="1"/>
                </form>
            </field>
        </record>
        
        <record id="view_payment_mode_tree" model="ir.ui.view">
            <field name="name">payment.mode.tree</field>
            <field name="model">payment.mode</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Payment mode">
                    <field name="name"/>
                    <field name="journal"/>
                </tree>
            </field>
        </record>
        <record id="view_payment_mode_form" model="ir.ui.view">
            <field name="name">payment.mode.form</field>
            <field name="model">payment.mode</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Payment mode">
                    <field name="name" select="1"/>
                    <field name="type"/>
                    <field name="journal"/>
                    <field name="bank_id"/>
                </form>
            </field>
        </record>
        <record id="action_payment_mode_form" model="ir.actions.act_window">
            <field name="name">Payment mode</field>
            <field name="res_model">payment.mode</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>
        
        <menuitem id="next_id_44" name="Payment" parent="account.menu_finance_configuration"/><menuitem action="action_payment_mode_form" id="menu_action_payment_mode_form" parent="next_id_44"/>
        
        <record id="view_payment_order_form" model="ir.ui.view">
            <field name="name">payment.order.form</field>
            <field name="model">payment.order</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Payment order">
                    <field name="reference"/>
                    <field name="mode"/>
                    <field name="date_prefered"/>
                    <field name="date_planned" select="1"/>
                    <field name="user_id" select="2"/>
                    <button colspan="2" name="%(wizard_populate_payment)d" string="Select Invoices to Pay" type="action"/>
                    <field name="line_ids" colspan="4" widget="one2many_list" nolabel="1">
                        <form string="Payment Line">
                            <notebook>
                                <page string="Payment">
                                    <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)" select="1"/>
                                    <!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
                                    <separator colspan="4" string="Transaction Information"/>
                                    <field name="date"/>
                                    <group colspan="2">
                                        <field name="amount_currency" select="2"/>
                                        <field name="currency" nolabel="1"/>
                                    </group>
                                    <field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
                                    <field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
                                    <separator colspan="2" string="Owner Account"/>
                                    <separator colspan="2" string="Desitination Account"/>
                                    <field colspan="2" name="info_owner" nolabel="1"/>
                                    <field colspan="2" name="info_partner" nolabel="1"/>
                                    
                                    <field colspan="4" name="communication"/>
                                    <field colspan="4" name="communication2"/>
                                    <field name="name"/>
                                     <field name="state"/>
                                </page>
                                <page string="Information">
                                    
                                    <separator colspan="4" string="General Information"/>
                                    <group colspan="2">
                                        <field name="amount" select="1"/>
                                    <!--<field name="currency"/>-->
                                        <field name="company_currency" nolabel="1"/>
                                    </group>
                                    <field name="partner_payable"/>
                                    <separator colspan="4" string="Entry Information"/>
                                    <field name="create_date" readonly="1"/>
                                    <field name="ml_maturity_date"/>
                                    <field name="ml_inv_ref"/>
                                    <!--<field name="to_pay_currency"/>
                                    <field name="to_pay"/>-->
                                </page>
                            </notebook>
                        </form>
                        <tree string="Payment Line"> <!-- editable="bottom"  colors="red:to_pay_currency&lt;amount_currency" -->
                            <field name="ml_inv_ref" />
                            <field name="partner_id" select="1"/>
                            <field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
                            <field name="ml_maturity_date"/>
                            <field name="ml_date_created"/>
                            <!--<field name="value_date"/>-->
                            <field name="amount" sum="Amount Total"/>
                            <field name="amount_currency" sum="Currency Amount Total" select="2"/>
                            <field name="currency"/>
                            <!--<field name="to_pay_currency"/>
                            <field name="to_pay"/>-->
                            <!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
                            <field name="name"/>
                            <!--<field name="communication"/>
                            <field name="state"/>
                            <field name="date"/>-->
                            <!-- <field invisible="1" name="to_pay_currency"/>-->
                        </tree>
                    </field>
                    <field name="date_created" select="2"/>
                    <field name="date_done" select="2"/>
                    <field name="state" readonly="1" select="1"/>
                    <group col="4" colspan="2">
                        <button name="cancel" states="draft,open" string="Cancel"/>
                        <button name="open" states="draft" string="Open"/>
                        <button name="%(wizard_pay_payment)d" states="open" string="Make Payment" type="action"/>
                        <button name="set_to_draft" states="cancel" string="Set to draft" type="object"/>
                    </group>
                </form>
            </field>
        </record>
        
        <record id="view_payment_order_tree" model="ir.ui.view">
            <field name="name">payment.order.tree</field>
            <field name="model">payment.order</field>
            <field name="type">tree</field>
            <field eval="4" name="priority"/>
            <field name="arch" type="xml">
                <tree string="Payment order">
                    <field name="reference"/>
                    <field name="mode"/>
                    <!--<field name="line_ids"/>-->
                    <field name="date_planned"/>
                    <field name="date_created" select="2"/>
                    <field name="date_done" select="2"/>
                    <field name="total"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        
        <record id="action_payment_order_tree" model="ir.actions.act_window">
            <field name="name">Payment order</field>
            <field name="res_model">payment.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">form,tree</field>
        </record>
        <menuitem action="action_payment_order_tree" id="menu_action_payment_order_form" parent="account_payment.menu_main" sequence="3"/>
        
        <record id="action_payment_order_draft" model="ir.actions.act_window">
            <field name="name">Draft payment order</field>
            <field name="res_model">payment.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state','=','draft')]</field>
        </record>
        <menuitem action="action_payment_order_draft" id="menu_action_payment_order_draft" parent="account_payment.menu_action_payment_order_form" sequence="1"/>
        
        <record id="action_payment_order_open" model="ir.actions.act_window">
            <field name="name">Payment orders to validate</field>
            <field name="res_model">payment.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state','=','open')]</field>
        </record>
        <menuitem action="action_payment_order_open" id="menu_action_payment_order_open" parent="account_payment.menu_action_payment_order_form" sequence="2"/>
        
        <record id="view_payment_line_form" model="ir.ui.view">
            <field name="name">Payment Line</field>
            <field name="model">payment.line</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Payment Line">
                    <notebook>
                        <page string="Payment">
                            <field name="order_id" select="1"/>
                            <!--<field name="reference" />-->
                            <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)" select="1"/>
                            <!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
                            <separator colspan="4" string="Transaction Information"/>
                            <field name="date"/>
                            <group colspan="2">
                                <field name="amount_currency" select="2"/>
                                <field name="currency" nolabel="1"/>
                            </group>
                            <field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
                            <field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
                            <separator colspan="2" string="Owner Account"/>
                            <separator colspan="2" string="Desitination Account"/>
                            <field colspan="2" name="info_owner" nolabel="1"/>
                            <field colspan="2" name="info_partner" nolabel="1"/>
                            
                            <field colspan="4" name="communication"/>
                            <field colspan="4" name="communication2"/>
                            <field name="name"/>
                             <field name="state"/>
                        </page>
                        <page string="Information">
                            
                            <separator colspan="4" string="General Information"/>
                            <group colspan="2">
                                <field name="amount" select="1"/>
                            <!--<field name="currency"/>-->
                                <field name="company_currency" nolabel="1"/>
                            </group>
                            <field name="partner_payable"/>
                            <separator colspan="4" string="Entry Information"/>
                            <field name="create_date"/>
                            <field name="ml_maturity_date"/>
                            <field name="ml_inv_ref"/>

                            <!--<field name="due_date"/>-->
                            <!--<field name="to_pay_currency"/>
                            <field name="to_pay"/>-->
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="view_payment_line_tree" model="ir.ui.view">
            <field name="name">Payment Lines</field>
            <field name="model">payment.line</field>
            <field name="type">tree</field>
            <field eval="4" name="priority"/>
            <field name="arch" type="xml">
                <tree string="Payment Line"> <!-- editable="bottom"  colors="red:to_pay_currency&lt;amount_currency" -->
                    <field name="order_id"/>
                    <field name="ml_inv_ref" />
                    <field name="ml_maturity_date"/>
                    <!--<field name="value_date"/>-->
                    <field name="partner_id" select="1"/>
                    <field name="amount" sum="Amount Total"/>
                    <field name="amount_currency" sum="Currency Amount Total" select="2"/>
                    <field name="currency"/>
                    <field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
                    <!--<field name="to_pay_currency"/>
                    <field name="to_pay"/>-->

                    <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
                    <!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
                    <field domain="[('partner_id', '=', partner_id)]" name="bank_id"/>
                    <field name="partner_payable"/>
                    <field name="create_date"/>
                    <field name="name"/>
                    <!--<field name="communication"/>
                    <field name="state"/>
                    <field name="date"/>-->
                    <!-- <field invisible="1" name="to_pay_currency"/>-->
                    
                </tree>
            </field>
        </record>
        <record id="action_payment_line_form" model="ir.actions.act_window">
            <field name="name">Payment Line</field>
            <field name="res_model">payment.line</field>
            <field name="view_type">tree</field>
            <field name="view_mode">form,tree</field>
        </record>
        
        <record id="view_bank_statement_form" model="ir.ui.view">
            <field name="name">account.bank.statement.form.inherit</field>
            <field name="model">account.bank.statement</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="account.view_bank_statement_form"/>
            <field name="arch" type="xml">
                <field name="period_id" position="after">
                    <button colspan="2" name="%(wizard_populate_statement)d" string="Import payment lines" type="action"/>
                </field>
            </field>
        </record>
        
        <act_window domain="[('move_line_id.move_id.id', '=', move_id)]" id="act_account_invoice_2_payment_line" name="Payment Lines" res_model="payment.line" src_model="account.invoice"/>
        
    </data>
</terp>
