[FIX] account_voucher:voucher currency-related issues
[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="type">search</field>
9             <field name="arch" type="xml">
10                 <search string="Search Vouchers">
11                     <group col='8' colspan='4'>
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                         <separator orientation="vertical"/>
15                         <filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
16                         <separator orientation="vertical"/>
17                         <field name="date"/>
18                         <field name="number"/>
19                         <field name="partner_id" string="Customer"/>
20                     </group>
21                     <newline/>
22                     <group col='8' colspan='4'>
23                         <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
24                         <field name="period_id" groups="base.group_extended"/>
25                     </group>
26                     <newline/>
27                     <group expand="0" string="Extended Filters..." col='8' colspan='4'>
28                         <field name="reference"/>
29                         <field name="name"/>
30                         <field name="narration"/>
31                         <field name="amount"/>
32                    </group>
33                    <newline/>
34                     <group expand="0" string="Group By..." colspan="4" col="10">
35                         <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
36                         <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
37                         <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
38                         <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
39                     </group>
40                 </search>
41             </field>
42         </record>
43
44
45         <record id="view_voucher_filter_vendor_pay" model="ir.ui.view">
46             <field name="name">account.voucher.purchase.pay.select</field>
47             <field name="model">account.voucher</field>
48             <field name="type">search</field>
49             <field name="arch" type="xml">
50                 <search string="Search Vouchers">
51                     <group col='8' colspan='4'>
52                         <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
53                         <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
54                         <separator orientation="vertical"/>
55                         <filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
56                         <separator orientation="vertical"/>
57                         <field name="date"/>
58                         <field name="number"/>
59                         <field name="partner_id" string="Supplier"/>
60                     </group>
61                     <newline/>
62                     <group col='8' colspan='4'>
63                         <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
64                         <field name="period_id" groups="base.group_extended"/>
65                     </group>
66                     <newline/>
67                     <group expand="0" string="Extended Filters..." col='8' colspan='4'>
68                         <field name="reference"/>
69                         <field name="name"/>
70                         <field name="narration"/>
71                         <field name="amount"/>
72                    </group>
73                    <newline/>
74                     <group expand="0" string="Group By..." colspan="4" col="10">
75                         <filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
76                         <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
77                         <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
78                         <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
79                     </group>
80                 </search>
81             </field>
82         </record>
83         <record model="ir.ui.view" id="view_low_priority_payment_form">
84             <field name="name">account.voucher.payment.low.priority.form</field>
85             <field name="model">account.voucher</field>
86             <field name="type">form</field>
87             <field name="priority">1</field>
88             <field name="arch" type="xml">
89                 <form string="Bill Payment">
90                     <group col="6" colspan="4">
91                         <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/>
92                         <field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
93                         <field name="journal_id"
94                             domain="[('type','in',['bank', 'cash'])]"
95                             widget="selection" select="1"
96                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
97                             string="Payment Method"/>
98                         <field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
99                         <field name="reference" select="1" string="Payment Ref"/>
100                         <field name="name" colspan="2"/>
101                         <field name="account_id"
102                             widget="selection"
103                             invisible="True"/>
104                         <field name="pre_line" invisible="1"/>
105                         <field name="type" invisible="True"/>
106                     </group>
107                     <notebook colspan="4">
108                         <page string="Payment Information">
109                             <field name="line_dr_ids" attrs="{'invisible': [('type', '=', 'receipt')]}" default_get="{'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)">
110                                 <tree string="Open Supplier Journal Entries" editable="bottom">
111                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
112                                         on_change="onchange_move_line_id(move_line_id)"
113                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
114                                         />
115                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]"/>
116                                     <field name="date_original" readonly="1"/>
117                                     <field name="date_due" readonly="1"/>
118                                     <field name="amount_original" readonly="1"/>
119                                     <field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
120                                     <field name="amount" sum="Payment"/>
121                                 </tree>
122                             </field>
123                             <field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('type', '=', 'payment')]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount)">
124                                 <tree string="Open Customer Journal Entries" editable="bottom">
125                                     <field name="move_line_id"/>
126                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
127                                     <field name="date_original"/>
128                                     <field name="amount_original"/>
129                                     <field name="amount" sum="Payment"/>
130                                 </tree>
131                             </field>
132                             <group col="2" colspan="3">
133                                 <separator string="Internal Notes" colspan="2"/>
134                                 <field name="narration" colspan="2" nolabel="1"/>
135                             </group>
136                             <group col="2" colspan="1">
137                                 <separator string="Other Information" colspan="2"/>
138                                 <field name="currency_id"/>
139                                 <field name="number"/>
140                             </group>
141                         </page>
142                     </notebook>
143                 </form>
144             </field>
145         </record>
146
147         <record model="ir.ui.view" id="view_vendor_payment_form">
148             <field name="name">account.voucher.payment.form</field>
149             <field name="model">account.voucher</field>
150             <field name="type">form</field>
151             <field name="arch" type="xml">
152                 <form string="Bill Payment">
153                     <group col="6" colspan="4">
154                         <field name="partner_id" domain="[('supplier','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/>
155                         <field name="amount" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
156                         <field name="journal_id"
157                             domain="[('type','in',['bank', 'cash'])]"
158                             invisible="context.get('line_type', False)"
159                             widget="selection" select="1"
160                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
161                             string="Payment Method"/>
162                         <field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
163                         <field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
164                         <field name="name" colspan="2" invisible="context.get('line_type', False)"/>
165                         <field name="account_id"
166                             widget="selection"
167                             invisible="True"/>
168                         <field name="pre_line" invisible="1"/>
169                         <field name="type" invisible="True"/>
170                     </group>
171                     <notebook colspan="4">
172                         <page string="Payment Information">
173                             <field name="line_dr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
174                                 <tree string="Supplier Invoices and Outstanding transactions" editable="bottom">
175                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
176                                         on_change="onchange_move_line_id(move_line_id)"
177                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
178                                         />
179                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]"/>
180                                     <field name="date_original" readonly="1"/>
181                                     <field name="date_due" readonly="1"/>
182                                     <field name="amount_original" readonly="1"/>
183                                     <field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
184                                     <field name="amount" sum="Payment"/>
185                                 </tree>
186                             </field>
187                             <field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}">
188                                 <tree string="Credits" editable="bottom">
189                                     <field name="move_line_id"/>
190                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
191                                     <field name="date_original"/>
192                                     <field name="amount_original"/>
193                                     <field name="amount" sum="Payment"/>
194                                 </tree>
195                             </field>
196                             <group col="2" colspan="3">
197                                 <separator string="Internal Notes" colspan="2"/>
198                                 <field name="narration" colspan="2" nolabel="1"/>
199                             </group>
200                             <group col="2" colspan="1">
201                                 <group col="2" colspan="1">
202                                     <separator string="Payment Options" colspan="2"/>
203                                     <field name="payment_option" required="1"/>
204                                     <field name="writeoff_amount"
205                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
206                                     <field name="writeoff_acc_id"
207                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
208                                            domain="[('type','=','other')]"/>
209                                     <field name="comment"
210                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
211                                     <field name="analytic_id"
212                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
213                                            groups="analytic.group_analytic_accounting"/>
214                                 </group>
215                                 <separator string="Other Information" colspan="2"/>
216                                 <group col="4" colspan="1">
217                                   <field name="currency_id"/>
218                                   <field name="number"/>
219                                 </group>
220                             </group>
221                         </page>
222                         <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
223                             <group col="6" colspan="4">
224                                 <field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
225                                 <field name="period_id"/>
226                                 <field name="audit"/>
227                             </group>
228                             <field name="move_ids" colspan="4" nolabel="1" readonly="1">
229                                <tree string="Journal Items">
230                                    <field name="move_id"/>
231                                    <field name="ref"/>
232                                    <field name="date"/>
233                                    <field name="statement_id"/>
234                                    <field name="partner_id"/>
235                                    <field name="account_id"/>
236                                    <field name="name"/>
237                                    <field name="debit"/>
238                                    <field name="credit"/>
239                                    <field name="state"/>
240                                    <field name="reconcile_id"/>
241                                    <field name="amount_currency"/>
242                                    <field name="currency_id"/>
243                                </tree>
244                             </field>
245                         </page>
246                     </notebook>
247                     <group col="10" colspan="4">
248                         <field name="state"/>
249                         <button name="cancel_voucher" string="Cancel" states="draft,proforma"  icon="gtk-cancel" invisible="context.get('line_type', False)"/>
250                         <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile this record ?"/>
251                         <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)"/>
252                         <button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward" invisible="context.get('line_type', False)"/>
253                     </group>
254                 </form>
255             </field>
256         </record>
257
258         <record id="action_vendor_payment" model="ir.actions.act_window">
259             <field name="name">Supplier Payment</field>
260             <field name="res_model">account.voucher</field>
261             <field name="view_type">form</field>
262             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>
263             <field name="context">{'type':'payment'}</field>
264             <field name="view_id" eval="False"/>
265             <field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
266             <field name="target">current</field>
267             <field name="help">The supplier payment form allows you to track the payment you do to your suppliers. When you select a supplier, the payment method and an amount for the payment, OpenERP will propose to reconcile your payment with the open supplier invoices or bills.</field>
268         </record>
269         <record id="action_vendor_payment_tree" model="ir.actions.act_window.view">
270             <field eval="1" name="sequence"/>
271             <field name="view_mode">tree</field>
272             <field name="act_window_id" ref="action_vendor_payment"/>
273         </record>
274         <record id="action_vendor_payment_form" model="ir.actions.act_window.view">
275             <field eval="2" name="sequence"/>
276             <field name="view_mode">form</field>
277             <field name="view_id" ref="view_vendor_payment_form"/>
278             <field name="act_window_id" ref="action_vendor_payment"/>
279         </record>
280
281
282         <menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
283             id="menu_action_vendor_payment"  parent="account.menu_finance_payables"/>
284
285         <record model="ir.ui.view" id="view_vendor_receipt_form">
286             <field name="name">account.voucher.receipt.form</field>
287             <field name="model">account.voucher</field>
288             <field name="type">form</field>
289             <field name="arch" type="xml">
290                 <form string="Customer Payment">
291                     <group col="6" colspan="4">
292                         <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)" string="Customer"/>
293                         <field name="amount"
294                             invisible="context.get('line_type', False)"
295                             string="Paid Amount"
296                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
297                         <field name="journal_id"
298                             domain="[('type','in',['bank', 'cash'])]"
299                             invisible="context.get('line_type', False)"
300                             widget="selection" select="1"
301                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
302                             string="Payment Method"/>
303                         <field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
304                         <field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
305                         <field name="name" colspan="2" invisible="context.get('line_type', False)"/>
306                         <field name="account_id"
307                             widget="selection"
308                             invisible="True"/>
309                         <field name="pre_line" invisible="1"/>
310                         <field name="type" invisible="True"/>
311                     </group>
312                     <notebook colspan="4">
313                         <page string="Payment Information">
314                             <field name="line_cr_ids" default_get="{'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)">
315                                 <tree string="Invoices and outstanding transactions" editable="bottom">
316                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
317                                         on_change="onchange_move_line_id(move_line_id)"
318                                         domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
319                                         />
320                                     <field name="account_id"  groups="base.group_extended" domain="[('type','=','receivable')]"/>
321                                     <field name="date_original" readonly="1"/>
322                                     <field name="date_due" readonly="1"/>
323                                     <field name="amount_original" readonly="1"/>
324                                     <field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
325                                     <field name="amount" sum="Payment"/>
326                                 </tree>
327                             </field>
328                             <field name="line_dr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount)">
329                                 <tree string="Credits" editable="bottom">
330                                     <field name="move_line_id"/>
331                                     <field name="account_id"  groups="base.group_extended" domain="[('type','=','receivable')]"/>
332                                     <field name="date_original"/>
333                                     <field name="amount_original"/>
334                                     <field name="amount" sum="Payment"/>
335                                 </tree>
336                             </field>
337                             <group col="2" colspan="3">
338                                 <separator string="Internal Notes" colspan="2"/>
339                                 <field name="narration" colspan="2" nolabel="1"/>
340                             </group>
341                             <group col="2" colspan="1">
342                                 <group col="2" colspan="1">
343                                     <separator string="Payment Options" colspan="2"/>
344                                     <field name="payment_option" required="1"/>
345                                     <field name="writeoff_amount"
346                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
347                                     <field name="writeoff_acc_id"
348                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
349                                            domain="[('type','=','other')]"/>
350                                     <field name="comment"
351                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
352                                     <field name="analytic_id"
353                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
354                                            groups="analytic.group_analytic_accounting"/>
355                                 </group>
356                                 <separator string="Other Information" colspan="2"/>
357                                 <group col="4" colspan="1">
358                                     <field name="currency_id"/>
359                                     <field name="number"/>
360                                 </group>
361                             </group>
362                         </page>
363                         <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
364                             <group col="6" colspan="4">
365                                 <field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
366                                 <field name="period_id"/>
367                                 <field name="audit"/>
368                             </group>
369                             <field name="move_ids" colspan="4" nolabel="1" readonly="1">
370                                <tree string="Journal Items">
371                                    <field name="move_id"/>
372                                    <field name="ref"/>
373                                    <field name="date"/>
374                                    <field name="statement_id"/>
375                                    <field name="partner_id"/>
376                                    <field name="account_id"/>
377                                    <field name="name"/>
378                                    <field name="debit"/>
379                                    <field name="credit"/>
380                                    <field name="state"/>
381                                    <field name="reconcile_id"/>
382                                    <field name="amount_currency"/>
383                                    <field name="currency_id"/>
384                                </tree>
385                             </field>
386                         </page>
387                     </notebook>
388                     <group col="10" colspan="4">
389                         <field name="state"/>
390                         <button name="cancel_voucher" string="Cancel" states="draft,proforma"  icon="gtk-cancel" invisible="context.get('line_type', False)"/>
391                         <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
392                         <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)"/>
393                         <button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward" invisible="context.get('line_type', False)"/>
394                     </group>
395                 </form>
396             </field>
397         </record>
398
399         <record id="action_vendor_receipt" model="ir.actions.act_window">
400             <field name="name">Customer Payment</field>
401             <field name="res_model">account.voucher</field>
402             <field name="view_type">form</field>
403             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
404             <field name="context">{'type':'receipt'}</field>
405             <field name="search_view_id" ref="view_voucher_filter_customer_pay"/>
406             <field name="view_id" eval="False"/>
407             <field name="target">current</field>
408             <field name="help">Sales payment allows you to register the payments you receive from your customers. In order to record a payment, you must enter the customer, the payment method (=the journal) and the payment amount. OpenERP will propose to you automatically the reconciliation of this payment with the open invoices or sales receipts.</field>
409         </record>
410         <record id="action_vendor_receipt_tree" model="ir.actions.act_window.view">
411             <field eval="1" name="sequence"/>
412             <field name="view_mode">tree</field>
413             <field name="act_window_id" ref="action_vendor_receipt"/>
414         </record>
415         <record id="action_vendor_receipt_form" model="ir.actions.act_window.view">
416             <field eval="2" name="sequence"/>
417             <field name="view_mode">form</field>
418             <field name="view_id" ref="view_vendor_receipt_form"/>
419             <field name="act_window_id" ref="action_vendor_receipt"/>
420         </record>
421
422         <menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
423             id="menu_action_vendor_receipt"  parent="account.menu_finance_receivables"/>
424     </data>
425 </openerp>