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