~account-payment-team/account-payment/7.0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <!--
    =======================================================================================================
        PAYMENT MODE
    =======================================================================================================
    -->
    <record id="view_payment_mode_form_require_bank_account" model="ir.ui.view">
        <field name="name">payment.mode.form.require_bank_account</field>
        <field name="model">payment.mode</field>
        <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
        <field name="arch" type="xml">
            <field name="bank_id" position="before">
                <field name="require_bank_account"/>
                <field name="type"/>
            </field>
        </field>
    </record>

    <!--************ account.move.line extension to show additional fields ********** -->
    <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="inherit_id" ref="account.view_move_line_tree"/>
        <field name="arch" type="xml">
            <field name="reconcile" position="after">
                <field name="amount_to_pay"/>
            </field>
            <field name="currency_id" position="replace">
                <field name="currency_id" groups="base.group_multi_currency"/>
                <field name="reconcile_id"/>
                <field name="reconcile_partial_id"/>
                <field name="state"/>
                <field name="payment_type"/>
            </field>
        </field>
    </record>

    <record model="ir.ui.view" id="payments_move_line_form">
        <field name="name">account.payments.move.line.form</field>
        <field name="model">account.move.line</field>
        <field name="inherit_id" ref="account.view_move_line_form"/>
        <field name="arch" type="xml">
            <field name="narration" position="before">
        <!--        <group col="2" colspan="2">
                    <separator colspan="2" string="Payment"/> -->
                    <field name="payment_type" select="1" widget="selection"/>
                    <field name="partner_bank_id" domain="[('partner_id','=',partner_id)]"/>
                    <field name="received_check"/>
        <!--        </group> -->
            </field>
        </field>
    </record>

    <!--
    ========================================================================================================
         BANK STATEMENT
     ========================================================================================================


    <record id="view_bank_statement_form_ext" model="ir.ui.view">
        <field name="name">account.bank.statement.form.ext</field>
        <field name="model">account.bank.statement</field>
        <field name="inherit_id" ref="account_payment.view_bank_statement_form"/>
        <field name="arch" type="xml">
            <button name="%(account_payment.action_account_populate_statement_confirm)d" position="replace">
                  <button name="%(act_wizard_populate_statement)d" string="Import payment lines" type="action" attrs="{'invisible':[('state','=','confirm')]}" icon="gtk-execute"/>
            </button>
        </field>
    </record>
     -->
    <!--
    ====================================================================================================
         PAYMENT ORDER
    ====================================================================================================
    -->
    <!-- Filter invoices by payment type. Allow negative payment amounts -->
    <record id="view_payment_order_form_ext1" model="ir.ui.view">
        <field name="name">payment.order.form.ext1</field>
        <field name="model">payment.order</field>
        <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
        <field name="arch" type="xml">
            <button name="%(account_payment.action_create_payment_order)d" position="replace">
                <button name="%(action_create_payment_extension_order)d" string="Select invoices to pay/receive payment" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
            </button>
            <button name="cancel" position="after">
                <button name="cancel_from_done" states="done" type="object" string="Cancel" icon="gtk-cancel"/>
            </button>
            <field name="mode" position="after">
                <field name="payment_type_name" invisible="1"/>
                <field name="type"/>
                <field name="create_account_moves"/>
                    <field name="period_id" attrs="{'required': [('create_account_moves', '!=', 'bank-statement')], 'invisible': [('create_account_moves', '=', 'bank-statement')]}"/>
            </field>
            <field name="move_line_id" position="replace">
            <group col="6" colspan="4">
                <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" select="1"/>
                <field name="account_id"/>
                <field name="payment_move_id"/>
            </group>
            </field>
        </field>
    </record>

    <record id="view_payment_line_form_ext1" model="ir.ui.view">
        <field name="name">payment.line.ext1</field>
        <field name="model">payment.line</field>
        <field name="inherit_id" ref="account_payment.view_payment_line_form"/>
        <field name="arch" type="xml">
            <field name="move_line_id" position="replace">
                <group col="6" colspan="4">
                    <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" select="1"/>
                    <field name="account_id"/>
                    <field name="payment_move_id"/>
                </group>
            </field>
        </field>
    </record>

    <!--
    ====================================================================================================
        PAYABLE PAYMENT ORDER
    ====================================================================================================
    -->
    <record id="account_payment.action_payment_order_tree" model="ir.actions.act_window">
        <field name="name">Pay. 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">[('type', '=', 'payable')]</field>
        <field name="context">{'type': 'payable'}</field>
    </record>

    <!--
    ======================================================================================================
        RECEIVABLE PAYMENT ORDER
    ======================================================================================================
    -->
    <record id="action_rec_payment_order_tree" model="ir.actions.act_window">
        <field name="name">Rec. 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">[('type', '=', 'receivable')]</field>
        <field name="context">{'type': 'receivable'}</field>
    </record>
    <menuitem action="action_rec_payment_order_tree" id="menu_action_rec_payment_order_form" parent="account_payment.menu_main_payment" sequence="2"/>

    <!--
    =========================================================================================
     PAYMENTS
    =========================================================================================
    -->
    <record id="view_payments_tree" model="ir.ui.view">
        <field name="name">Payments</field>
        <field name="model">account.move.line</field>
        <field name="field_parent">partner_id</field>
        <field name="priority" eval="20"/>
        <field name="arch" type="xml">
            <tree string="Payments" editable="top" colors="grey:reconcile_id!=0;blue:amount_to_pay==0;red:date_maturity&lt;time.strftime('%%Y-%%m-%%d')">
                <field name="invoice" readonly="1"/>
                <field name="partner_id" readonly="1"/>
                <field name="account_id" readonly="1"/>
                <field name="debit" readonly="1" sum="Total Debit"/>
                <field name="credit" readonly="1" sum="Total Credit"/>
                <field name="amount_to_pay" readonly="1" sum="Total Amount to Pay"/>
                <field name="payment_type" readonly="1"/>
                <field name="partner_bank_id" domain="[('partner_id','=',partner_id)]"/>
                <field name="received_check"/>
                <field name="date_maturity"/>
                <field name="move_id" readonly="1"/>
                <field name="reconcile_id" readonly="1"/>
                <field name="reconcile_partial_id" readonly="1"/>
            </tree>
        </field>
    </record>

    <record id="view_payments_filter" model="ir.ui.view">
        <field name="name">Invoice Payments Select</field>
        <field name="model">account.move.line</field>
        <field name="priority" eval="20"/>
        <field name="arch" type="xml">
            <search string="Search Invoice Payments">
                    <filter icon="terp-sale" string="Receive" domain="[('account_id.type','=','receivable')]" help="Receivable payments"/>
                    <filter icon="terp-purchase" string="Pay" domain="[('account_id.type','=','payable')]" help="Payable payments"/>
                    <separator/>
                    <filter icon="terp-dolar_ok!" string="Unreconciled" domain="[('reconcile_id','=',False)]" help="Unreconciled payments"/>
                    <field name="account_id"/>
                    <field name="partner_id"/>
                    <field name="invoice"/>
                    <field name="date_maturity"/>
                    <separator/>
                    <field name="amount_to_pay"/>
                    <field name="payment_type" widget="selection"/>
                    <field name="partner_bank_id"/>
                    <field name="received_check"/>
                    <group expand="0" string="Group By...">
                        <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
                        <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                        <separator/>
                        <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
                        <filter string="Effective date" icon="terp-go-month" domain="[]" context="{'group_by':'date_maturity'}"/>
                    </group>
            </search>
        </field>
    </record>

    <!-- Invoice Payments -->
    <record model="ir.actions.act_window" id="action_invoice_payments">
        <field name="name">Invoice payments</field>
        <field name="res_model">account.move.line</field>
        <field name="view_type">form</field>
        <field name="view_id" ref="view_payments_tree"/>
        <field name="search_view_id" ref="view_payments_filter"/>
        <field name="domain">[('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id', '=', False)]</field>
    </record>

    <menuitem name="Invoice payments" parent="account_payment.menu_main_payment" action="action_invoice_payments" id="menu_action_invoice_payments" sequence="4"/>
-
    <!-- Done Payments -->
    <record model="ir.actions.act_window" id="action_done_payments">
        <field name="name">Done payments</field>
        <field name="res_model">account.move.line</field>
        <field name="view_type">form</field>
        <field name="view_id" ref="view_payments_tree"/>
        <field name="search_view_id" ref="view_payments_filter"/>
        <field name="domain">[('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id', '!=', False)]</field>
    </record>

    <menuitem name="Done payments" parent="account_payment.menu_main_payment" action="action_done_payments" id="menu_action_done_payments" sequence="5"/>

</data>
</openerp>