[FIX] Invoice Payment
[odoo/odoo.git] / addons / account_voucher / voucher_payment_receipt_view.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <openerp>
3     <data>
4
5         <record id="view_voucher_filter_customer_pay" model="ir.ui.view">
6             <field name="name">account.voucher.customer.pay.select</field>
7             <field name="model">account.voucher</field>
8             <field name="arch" type="xml">
9                 <search string="Search Vouchers">
10                     <field name="number" string="Voucher"/>
11                     <field name="date"/>
12                     <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
13                     <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
14                     <field name="partner_id" string="Customer"/>
15                     <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
16                     <field name="period_id"/>
17                     <group expand="0" string="Group By...">
18                         <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
19                         <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
20                         <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
21                         <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
22                     </group>
23                 </search>
24             </field>
25         </record>
26
27
28         <record id="view_voucher_filter_vendor_pay" model="ir.ui.view">
29             <field name="name">account.voucher.purchase.pay.select</field>
30             <field name="model">account.voucher</field>
31             <field name="arch" type="xml">
32                 <search string="Search Vouchers">
33                     <field name="number" string="Voucher"/>
34                     <field name="date"/>
35                     <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
36                     <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
37                     <field name="partner_id" string="Supplier"/>
38                     <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
39                     <field name="period_id"/>
40                     <group expand="0" string="Group By...">
41                         <filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
42                         <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
43                         <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
44                         <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
45                     </group>
46                 </search>
47             </field>
48         </record>
49         <record model="ir.ui.view" id="view_low_priority_payment_form">
50             <field name="name">account.voucher.payment.low.priority.form</field>
51             <field name="model">account.voucher</field>
52             <field name="priority">1</field>
53             <field name="arch" type="xml">
54                 <form string="Bill Payment" version="7.0">
55                     <group col="6">
56                         <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Supplier" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1, 'invoice_currency': currency_id}"/>
57                         <field name="amount" on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
58                         <field name="journal_id"
59                             domain="[('type','in',['bank', 'cash'])]"
60                             widget="selection"
61                             on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"
62                             string="Payment Method"/>
63                         <field name="date" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
64                         <field name="reference" string="Payment Ref"/>
65                         <field name="name" colspan="2"/>
66                         <field name="account_id"
67                             widget="selection"
68                             invisible="True"/>
69                         <field name="pre_line" invisible="1"/>
70                         <field name="type" invisible="True"/>
71                     </group>
72                     <notebook>
73                         <page string="Payment Information">
74                                 <label for="line_dr_ids" attrs="{'invisible': [('type', '=', 'receipt')]}"/>
75                             <field name="line_dr_ids" attrs="{'invisible': [('type', '=', 'receipt')]}" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
76                                 <tree string="Open Supplier Journal Entries" editable="bottom" colors="gray:amount==0">
77                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
78                                         on_change="onchange_move_line_id(move_line_id)"
79                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"/>
80                                     <field name="account_id" domain="[('type','=','payable')]"/>
81                                     <field name="date_original" readonly="1"/>
82                                     <field name="date_due" readonly="1"/>
83                                     <field name="amount_original" readonly="1"/>
84                                     <field name="amount_unreconciled" readonly="1"/>
85                                     <field name="amount" sum="Total Allocation"/>
86                                 </tree>
87                             </field>
88                             <label for="line_cr_ids" attrs="{'invisible': [('type', '=', 'payment')]}"/>
89                             <field name="line_cr_ids" attrs="{'invisible': [('type', '=', 'payment')]}" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
90                                 <tree string="Open Customer Journal Entries" editable="bottom" colors="gray:amount==0">
91                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
92                                         on_change="onchange_move_line_id(move_line_id)"
93                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"/>
94                                     <field name="account_id" domain="[('type','=','payable')]"/>
95                                     <field name="date_original" readonly="1"/>
96                                     <field name="date_due" readonly="1"/>
97                                     <field name="amount_original" readonly="1"/>
98                                     <field name="amount_unreconciled" readonly="1"/>
99                                     <field name="amount" sum="Total Allocation"/>
100                                 </tree>
101                             </field>
102                             <group>
103                                 <group string="Internal Notes">
104                                     <field name="narration" nolabel="1" colspan="2"/>
105                                 </group>
106                                 <group string="Other Information" col="4">
107                                     <field name="currency_id" colspan="4" groups="base.group_multi_currency"/>
108                                     <field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" colspan="3"/>
109                                     <field name="payment_rate_currency_id" colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)" groups="base.group_multi_currency"/>
110                                     <field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
111                                     <field name="number" colspan="4"/>
112                                 </group>
113                             </group>
114                         </page>
115                     </notebook>
116                 </form>
117             </field>
118         </record>
119
120         <record model="ir.ui.view" id="view_vendor_payment_form">
121             <field name="name">account.voucher.payment.form</field>
122             <field name="model">account.voucher</field>
123             <field name="arch" type="xml">
124                 <form string="Voucher Payment" version="7.0">
125                 <header>
126                     <button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)" class="oe_highlight"/>
127                     <button name="cancel_voucher" string="Cancel" states="draft,proforma"  invisible="context.get('line_type', False)"/>
128                     <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile and cancel this record ?"/>
129                     <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="context.get('line_type', False)"/>
130                     <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
131                 </header>
132                 <sheet>
133                     <field name="account_id" invisible="True"/>
134                     <field name="pre_line" invisible="1"/>
135                     <field name="type" invisible="True"/>
136                     <group>
137                         <group>
138                             <field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"  string="Supplier"/>
139                             <label for="amount" string="Amount"/>
140                             <div>
141                                 <field name="amount" invisible="context.get('line_type', False)" on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)" class="oe_inline"/>
142                                 <field name="currency_id" class="oe_inline"/>
143                             </div>
144                             <field name="journal_id"
145                                 domain="[('type','in',['bank', 'cash'])]"
146                                 invisible="context.get('line_type', False)"
147                                 widget="selection"
148                                 on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"
149                                 string="Payment Method"/>
150                         </group>
151                         <group>
152                             <field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
153                             <field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="e.g. 003/10"/>
154                             <field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="e.g. Invoice SAJ/0042"/>
155                             <field name="company_id" widget="selection" groups="base.group_multi_company"/>
156                         </group>
157                     </group>
158                     <notebook>
159                         <page string="Payment Information">
160                                 <label for="line_dr_ids"/>
161                             <field name="line_dr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}">
162                                 <tree string="Supplier Invoices and Outstanding transactions" editable="bottom" colors="gray:amount==0">
163                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
164                                         on_change="onchange_move_line_id(move_line_id)"
165                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
166                                         required="1"/>
167                                     <field name="account_id" groups="base.group_no_one" domain="[('type','=','payable')]"/>
168                                     <field name="date_original" readonly="1"/>
169                                     <field name="date_due" readonly="1"/>
170                                     <field name="amount_original" readonly="1"/>
171                                     <field name="amount_unreconciled" readonly="1" groups="account.group_account_user"/>
172                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/>
173                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
174                                 </tree>
175                             </field>
176                             <label for="line_cr_ids" attrs="{'invisible': [('pre_line','=',False)]}"/>
177                             <field name="line_cr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}">
178                                 <tree string="Credits" editable="bottom" colors="gray:amount==0">
179                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
180                                         on_change="onchange_move_line_id(move_line_id)"
181                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
182                                         required="1"/>
183                                     <field name="account_id" groups="base.group_no_one" domain="[('type','=','payable')]"/>
184                                     <field name="date_original" readonly="1"/>
185                                     <field name="date_due" readonly="1"/>
186                                     <field name="amount_original" readonly="1"/>
187                                     <field name="amount_unreconciled" readonly="1" groups="account.group_account_user"/>
188                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/>
189                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
190                                 </tree>
191                             </field>
192                             <group>
193                                 <group string="Internal Notes">
194                                     <field name="narration" colspan="2" nolabel="1"/>
195                                 </group>
196                                 <group>
197                                     <group col="4" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
198                                         <separator string="Currency Options" colspan="4"/>
199                                         <field name="is_multi_currency" invisible="1"/>
200                                         <field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" colspan="3"/>
201                                         <field name="payment_rate_currency_id" colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)" groups="base.group_multi_currency"/>
202                                         <field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
203                                     </group>
204                                     <group col="2">
205                                         <separator string="Payment Options" colspan="2"/>
206                                         <field name="writeoff_amount"/>
207                                         <field name="payment_option" required="1"/>
208                                         <field name="writeoff_acc_id"
209                                                attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
210                                                domain="[('type','=','other')]"/>
211                                         <field name="comment"
212                                                attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
213                                         <field name="analytic_id"
214                                                groups="analytic.group_analytic_accounting"/>
215                                     </group>
216                                 </group>
217                             </group>
218                         </page>
219                         <page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
220                             <group col="4">
221                                 <field name="period_id"/>
222                                 <field name="audit"/>
223                                 <field name="number"/>
224                             </group>
225                             <field name="move_ids" readonly="1">
226                                <tree string="Journal Items">
227                                    <field name="move_id"/>
228                                    <field name="ref"/>
229                                    <field name="date"/>
230                                    <field name="statement_id"/>
231                                    <field name="partner_id"/>
232                                    <field name="account_id"/>
233                                    <field name="name"/>
234                                    <field name="debit"/>
235                                    <field name="credit"/>
236                                    <field name="state"/>
237                                    <field name="reconcile_id"/>
238                                    <field name="amount_currency" groups="base.group_multi_currency"/>
239                                    <field name="currency_id" groups="base.group_multi_currency"/>
240                                </tree>
241                             </field>
242                         </page>
243                     </notebook>
244                     </sheet>
245                     <div class="oe_chatter">
246                         <field name="message_ids" widget="mail_thread"/>
247                         <field name="message_follower_ids" widget="mail_followers"/>
248                     </div>
249                 </form>
250             </field>
251         </record>
252
253         <record id="action_vendor_payment" model="ir.actions.act_window">
254             <field name="name">Supplier Payment</field>
255             <field name="res_model">account.voucher</field>
256             <field name="view_type">form</field>
257             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>
258             <field name="context">{'type':'payment'}</field>
259             <field name="view_id" eval="False"/>
260             <field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
261             <field name="target">current</field>
262             <field name="help" type="html">
263               <p class="oe_view_nocontent_create">
264                 Click to create a new supplier payment.
265               </p><p>
266                 OpenERP helps you easily track payments you do and remining
267                 balance to pay to your supplier.
268               </p>
269             </field>
270         </record>
271         <record id="action_vendor_payment_tree" model="ir.actions.act_window.view">
272             <field eval="1" name="sequence"/>
273             <field name="view_mode">tree</field>
274             <field name="act_window_id" ref="action_vendor_payment"/>
275         </record>
276         <record id="action_vendor_payment_form" model="ir.actions.act_window.view">
277             <field eval="2" name="sequence"/>
278             <field name="view_mode">form</field>
279             <field name="view_id" ref="view_vendor_payment_form"/>
280             <field name="act_window_id" ref="action_vendor_payment"/>
281         </record>
282
283
284         <menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
285             id="menu_action_vendor_payment"  parent="account.menu_finance_payables"/>
286
287         <record model="ir.ui.view" id="view_vendor_receipt_dialog_form">
288             <field name="name">account.voucher.receipt.dialog.form</field>
289             <field name="model">account.voucher</field>
290             <field name="priority">30</field>
291             <field name="arch" type="xml">
292                 <form string="Payment" version="7.0">
293                     <group>
294                         <group>
295                             <field name="state" invisible="1"/>
296                             <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
297                             <label for="amount" string="Paid Amount"/>
298                             <div>
299                                 <field name="amount" class="oe_inline"
300                                     invisible="context.get('line_type', False)"
301                                     on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
302                                 <field name="currency_id" class="oe_inline"/>
303                             </div>
304                             <field name="journal_id"
305                                 domain="[('type','in',['bank', 'cash'])]"
306                                 invisible="context.get('line_type', False)"
307                                 widget="selection"
308                                 on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"
309                                 string="Payment Method"/>
310                         </group>
311                         <group>
312                             <field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
313                             <field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="e.g. 003/10"/>
314                             <field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="e.g. Invoice SAJ/0042"/>
315                             <field name="company_id" widget="selection" groups="base.group_multi_company"/>
316
317                             <field name="account_id"
318                                 widget="selection"
319                                 invisible="True"/>
320                             <field name="pre_line" invisible="1"/>
321                             <field name="type" invisible="True"/>
322                         </group>
323                     </group>
324                     <notebook invisible="1">
325                         <page string="Payment Information" groups="base.group_user">
326                                 <label for="line_cr_ids"/>
327                             <field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
328                                 <tree string="Invoices and outstanding transactions" editable="bottom" colors="gray:amount==0">
329                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
330                                         on_change="onchange_move_line_id(move_line_id)"
331                                         domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
332                                         required="1"
333                                         groups="account.group_account_user"/>
334                                     <field name="account_id"  groups="base.group_no_one" domain="[('type','=','receivable')]"/>
335                                     <field name="date_original" readonly="1"/>
336                                     <field name="date_due" readonly="1"/>
337                                     <field name="amount_original" readonly="1"/>
338                                     <field name="amount_unreconciled" readonly="1" groups="account.group_account_user"/>
339                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/>
340                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/>
341                                 </tree>
342                             </field>
343                             <label for="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}"/>
344                             <field name="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
345                                 <tree string="Credits" editable="bottom" colors="gray:amount==0">
346                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
347                                         on_change="onchange_move_line_id(move_line_id)"
348                                         domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
349                                         required="1"/>
350                                     <field name="account_id"  groups="base.group_no_one" domain="[('type','=','receivable')]"/>
351                                     <field name="date_original" readonly="1"/>
352                                     <field name="date_due" readonly="1"/>
353                                     <field name="amount_original" readonly="1"/>
354                                     <field name="amount_unreconciled" readonly="1"/>
355                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
356                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/>
357                                 </tree>
358                             </field>
359                             <group col="3">
360                                 <group>
361                                     <field name="narration" colspan="2" nolabel="1"/>
362                                 </group>
363                                 <group col="4" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
364                                     <field name="is_multi_currency" invisible="1"/>
365                                     <field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" colspan="3"/>
366                                     <field name="payment_rate_currency_id" colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)" groups="base.group_multi_currency"/>
367                                     <field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
368                                 </group>
369                                 <group>
370                                     <field name="writeoff_amount"/>
371                                     <field name="payment_option" required="1"/>
372                                     <field name="writeoff_acc_id"
373                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
374                                            domain="[('type','=','other')]"/>
375                                     <field name="comment"
376                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
377                                     <field name="analytic_id"
378                                            groups="analytic.group_analytic_accounting"/>
379                                 </group>
380                             </group>
381                         </page>
382                     </notebook>
383                     <footer>
384                         <button name="button_proforma_voucher" string="Pay" class="oe_highlight" type="object"/> or
385                         <button string="Cancel" class="oe_link" special="cancel"/>
386                     </footer>
387                 </form>
388             </field>
389         </record>
390
391
392         <record model="ir.ui.view" id="view_vendor_receipt_form">
393             <field name="name">account.voucher.receipt.form</field>
394             <field name="model">account.voucher</field>
395             <field name="arch" type="xml">
396                 <form string="Receipt" version="7.0">
397                 <header>
398                     <button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)" class="oe_highlight"/>
399                     <button name="cancel_voucher" string="Cancel" states="draft,proforma"  invisible="context.get('line_type', False)"/>
400                     <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile and cancel this record ?"/>
401                     <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="context.get('line_type', False)"/>
402                     <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
403                 </header>
404                 <sheet>
405                     <h1 attrs="{'invisible': [('number','=',False)]}"><field name="number"/></h1>
406                     <group>
407                         <group>
408                             <field name="partner_id" domain="[('customer','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
409                             <label for="amount" string="Paid Amount"/>
410                             <div>
411                                 <field name="amount" class="oe_inline"
412                                     invisible="context.get('line_type', False)"
413                                     on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
414                                 <field name="currency_id" class="oe_inline"/>
415                             </div>
416
417                             <field name="journal_id"
418                                 domain="[('type','in',['bank', 'cash'])]"
419                                 invisible="context.get('line_type', False)"
420                                 widget="selection"
421                                 on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"
422                                 string="Payment Method"/>
423                         </group>
424                         <group>
425                             <field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
426                             <field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="e.g. 003/10"/>
427                             <field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="e.g. Invoice SAJ/0042"/>
428                             <field name="company_id" widget="selection" groups="base.group_multi_company"/>
429
430                             <field name="account_id"
431                                 widget="selection"
432                                 invisible="True"/>
433                             <field name="pre_line" invisible="1"/>
434                             <field name="type" invisible="True"/>
435                         </group>
436                     </group>
437
438                     <notebook>
439                         <page string="Payment Information" groups="base.group_user">
440                                 <label for="line_cr_ids"/>
441                             <field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
442                                 <tree string="Invoices and outstanding transactions" editable="bottom" colors="gray:amount==0">
443                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
444                                         on_change="onchange_move_line_id(move_line_id)"
445                                         domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
446                                         required="1"
447                                         groups="account.group_account_user"/>
448                                     <field name="account_id"  groups="base.group_no_one" domain="[('type','=','receivable')]"/>
449                                     <field name="date_original" readonly="1"/>
450                                     <field name="date_due" readonly="1"/>
451                                     <field name="amount_original" readonly="1"/>
452                                     <field name="amount_unreconciled" readonly="1" groups="account.group_account_user"/>
453                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/>
454                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/>
455                                 </tree>
456                             </field>
457                             <label for="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}"/>
458                             <field name="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
459                                 <tree string="Credits" editable="bottom" colors="gray:amount==0">
460                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
461                                         on_change="onchange_move_line_id(move_line_id)"
462                                         domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
463                                         required="1"/>
464                                     <field name="account_id"  groups="base.group_no_one" domain="[('type','=','receivable')]"/>
465                                     <field name="date_original" readonly="1"/>
466                                     <field name="date_due" readonly="1"/>
467                                     <field name="amount_original" readonly="1"/>
468                                     <field name="amount_unreconciled" readonly="1"/>
469                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
470                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/>
471                                 </tree>
472                             </field>
473                             <group col="3">
474                                 <group>
475                                     <field name="narration" colspan="2" nolabel="1"/>
476                                 </group>
477                                 <group col="4" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
478                                     <field name="is_multi_currency" invisible="1"/>
479                                     <field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" colspan="3"/>
480                                     <field name="payment_rate_currency_id" colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)" groups="base.group_multi_currency"/>
481                                     <field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
482                                 </group>
483                                 <group>
484                                     <field name="writeoff_amount"/>
485                                     <field name="payment_option" required="1"/>
486                                     <field name="writeoff_acc_id"
487                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
488                                            domain="[('type','=','other')]"/>
489                                     <field name="comment"
490                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
491                                     <field name="analytic_id"
492                                            groups="analytic.group_analytic_accounting"/>
493                                 </group>
494                             </group>
495                         </page>
496                         <page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
497                             <group col="4">
498                                 <field name="period_id"/>
499                                 <field name="audit"/>
500                             </group>
501                             <field name="move_ids" readonly="1">
502                                 <tree string="Journal Items">
503                                     <field name="move_id"/>
504                                     <field name="ref"/>
505                                     <field name="date"/>
506                                     <field name="statement_id"/>
507                                     <field name="partner_id"/>
508                                     <field name="account_id"/>
509                                     <field name="name"/>
510                                     <field name="debit"/>
511                                     <field name="credit"/>
512                                     <field name="state"/>
513                                     <field name="reconcile_id"/>
514                                     <field name="amount_currency"/>
515                                     <field name="currency_id" groups="base.group_multi_currency"/>
516                                 </tree>
517                             </field>
518                         </page>
519                     </notebook>
520                     </sheet>
521                     <div class="oe_chatter">
522                         <field name="message_ids" widget="mail_thread"/>
523                         <field name="message_follower_ids" widget="mail_followers"/>
524                     </div>
525                 </form>
526             </field>
527         </record>
528
529         <record id="action_vendor_receipt" model="ir.actions.act_window">
530             <field name="name">Customer Payment</field>
531             <field name="res_model">account.voucher</field>
532             <field name="view_type">form</field>
533             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
534             <field name="context">{'type':'receipt'}</field>
535             <field name="search_view_id" ref="view_voucher_filter_customer_pay"/>
536             <field name="view_id" eval="False"/>
537             <field name="target">current</field>
538             <field name="help" type="html">
539               <p class="oe_view_nocontent_create">
540                 Click to register a new payment. 
541               </p><p>
542                 Enter the customer and the payment method and then, either
543                 create manually a payment record or OpenERP will propose to you
544                 automatically the reconciliation of this payment with the open
545                 invoices or sales receipts.
546               </p>
547             </field>
548         </record>
549         <record id="action_vendor_receipt_tree" model="ir.actions.act_window.view">
550             <field eval="1" name="sequence"/>
551             <field name="view_mode">tree</field>
552             <field name="act_window_id" ref="action_vendor_receipt"/>
553         </record>
554         <record id="action_vendor_receipt_form" model="ir.actions.act_window.view">
555             <field eval="2" name="sequence"/>
556             <field name="view_mode">form</field>
557             <field name="view_id" ref="view_vendor_receipt_form"/>
558             <field name="act_window_id" ref="action_vendor_receipt"/>
559         </record>
560
561         <menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
562             id="menu_action_vendor_receipt"  parent="account.menu_finance_receivables"/>
563
564     </data>
565 </openerp>