[IMP] account_voucher: write-off feature
[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)" context="{'invoice_currency':currency_id}" string="Vendor"/>
92                         <field name="journal_id"
93                             domain="[('type','in',['bank', 'cash'])]"
94                             widget="selection" select="1"
95                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"
96                             string="Payment Method"/>
97                         <field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
98                         <field name="reference" select="1" string="Payment Ref"/>
99                         <field name="name" colspan="4"/>
100                         <field name="account_id"
101                             widget="selection"
102                             invisible="True"/>
103                         <field name="pre_line" invisible="1"/>
104                         <field name="type" invisible="True"/>
105                     </group>
106                     <notebook colspan="4">
107                         <page string="Payment Information">
108                             <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)">
109                                 <tree string="Open Vendor Journal Entries" editable="bottom">
110                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
111                                         on_change="onchange_move_line_id(move_line_id)"
112                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
113                                         />
114                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]"/>
115                                     <field name="date_original" readonly="1"/>
116                                     <field name="date_due" readonly="1"/>
117                                     <field name="amount_original" readonly="1"/>
118                                     <field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
119                                     <field name="amount" sum="Payment"/>
120                                 </tree>
121                             </field>
122                             <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)">
123                                 <tree string="Open Customer Journal Entries" editable="bottom">
124                                     <field name="move_line_id"/>
125                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
126                                     <field name="date_original"/>
127                                     <field name="amount_original"/>
128                                     <field name="amount" sum="Payment"/>
129                                 </tree>
130                             </field>
131                             <group col="2" colspan="3">
132                                 <separator string="Internal Notes" colspan="2"/>
133                                 <field name="narration" colspan="2" nolabel="1"/>
134                             </group>
135                             <group col="2" colspan="1">
136                                 <separator string="Other Information" colspan="2"/>
137                                 <field name="date" select="1" on_change="onchange_date(date)"/>
138                                 <field name="currency_id" invisible="True"/>
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" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" context="{'invoice_currency':currency_id}" string="Vendor"/>
155                         <field name="journal_id"
156                             domain="[('type','in',['bank', 'cash'])]"
157                             widget="selection" select="1"
158                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"
159                             string="Payment Method"/>
160                         <field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
161                         <field name="reference" select="1" string="Payment Ref"/>
162                         <field name="name" colspan="4"/>
163                         <field name="account_id"
164                             widget="selection"
165                             invisible="True"/>
166                         <field name="pre_line" invisible="1"/>
167                         <field name="type" invisible="True"/>
168                     </group>
169                     <notebook colspan="4">
170                         <page string="Payment Information">
171                             <field name="line_dr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
172                                 <tree string="Vendor Invoices and Outstanding transactions" editable="bottom">
173                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
174                                         on_change="onchange_move_line_id(move_line_id)"
175                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
176                                         />
177                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]"/>
178                                     <field name="date_original" readonly="1"/>
179                                     <field name="date_due" readonly="1"/>
180                                     <field name="amount_original" readonly="1"/>
181                                     <field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
182                                     <field name="amount" sum="Payment"/>
183                                 </tree>
184                             </field>
185                             <field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}">
186                                 <tree string="Credits" editable="bottom">
187                                     <field name="move_line_id"/>
188                                     <field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
189                                     <field name="date_original"/>
190                                     <field name="amount_original"/>
191                                     <field name="amount" sum="Payment"/>
192                                 </tree>
193                             </field>
194                             <group col="2" colspan="3">
195                                 <separator string="Internal Notes" colspan="2"/>
196                                 <field name="narration" colspan="2" nolabel="1"/>
197                             </group>
198                             <group col="2" colspan="1">
199                                 <group col="2" colspan="1">
200                                     <separator string="Payment Options" colspan="2"/>
201                                     <field name="writeoff_amount"
202                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
203                                     <field name="payment_option" required="1"/>
204                                     <field name="writeoff_acc_id"
205                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
206                                            domain="[('type','=','other')]"/>
207                                     <field name="comment"
208                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
209                                     <field name="analytic_id"
210                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
211                                            groups="analytic.group_analytic_accounting"/>
212                                 </group>
213                                 <group col="4" colspan="1">
214                                   <field name="date" select="1" on_change="onchange_date(date)"/>
215                                   <field name="currency_id" invisible="True"/>
216                                   <field name="number"/>
217                                 </group>
218                             </group>
219                         </page>
220                         <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
221                             <group col="6" colspan="4">
222                                 <field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
223                                 <field name="period_id"/>
224                                 <field name="audit"/>
225                             </group>
226                             <field name="move_ids" colspan="4" nolabel="1" readonly="1">
227                                <tree string="Journal Items">
228                                    <field name="move_id"/>
229                                    <field name="ref"/>
230                                    <field name="date"/>
231                                    <field name="statement_id"/>
232                                    <field name="partner_id"/>
233                                    <field name="account_id"/>
234                                    <field name="name"/>
235                                    <field name="debit"/>
236                                    <field name="credit"/>
237                                    <field name="state"/>
238                                    <field name="reconcile_id"/>
239                                </tree>
240                             </field>
241                         </page>
242                     </notebook>
243                     <group col="10" colspan="4">
244                         <field name="state"/>
245                         <button name="cancel_voucher" string="Cancel" states="draft,proforma"  icon="gtk-cancel"/>
246                         <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
247                         <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
248                         <button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward"/>
249                     </group>
250                 </form>
251             </field>
252         </record>
253
254         <record id="action_vendor_payment" model="ir.actions.act_window">
255             <field name="name">Vendor Payment</field>
256             <field name="res_model">account.voucher</field>
257             <field name="view_type">form</field>
258             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>
259             <field name="context">{'type':'payment'}</field>
260             <field name="view_id" eval="False"/>
261             <field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
262             <field name="target">current</field>
263             <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>
264         </record>
265         <record id="action_vendor_payment_tree" model="ir.actions.act_window.view">
266             <field eval="1" name="sequence"/>
267             <field name="view_mode">tree</field>
268             <field name="act_window_id" ref="action_vendor_payment"/>
269         </record>
270         <record id="action_vendor_payment_form" model="ir.actions.act_window.view">
271             <field eval="2" name="sequence"/>
272             <field name="view_mode">form</field>
273             <field name="view_id" ref="view_vendor_payment_form"/>
274             <field name="act_window_id" ref="action_vendor_payment"/>
275         </record>
276
277
278         <menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
279             id="menu_action_vendor_payment"  parent="account.menu_finance_payables"/>
280
281         <record model="ir.ui.view" id="view_vendor_receipt_form">
282             <field name="name">account.voucher.receipt.form</field>
283             <field name="model">account.voucher</field>
284             <field name="type">form</field>
285             <field name="arch" type="xml">
286                 <form string="Customer Payment">
287                     <group col="6" colspan="4">
288                         <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" string="Customer"/>
289                         <field name="journal_id"
290                             domain="[('type','in',['bank', 'cash'])]"
291                             widget="selection" select="1"
292                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"
293                             string="Payment Method"/>
294                         <field name="amount"
295                             string="Paid Amount"
296                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
297                         <field name="reference" select="1" string="Payment Ref"/>
298                         <field name="name" colspan="4"/>
299                         <field name="account_id"
300                             widget="selection"
301                             invisible="True"/>
302                         <field name="pre_line" invisible="1"/>
303                         <field name="type" invisible="True"/>
304                     </group>
305                     <notebook colspan="4">
306                         <page string="Payment Information">
307                             <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)">
308                                 <tree string="Invoices and outstanding transactions" editable="bottom">
309                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
310                                         on_change="onchange_move_line_id(move_line_id)"
311                                         domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
312                                         />
313                                     <field name="account_id"  groups="base.group_extended" domain="[('type','=','receivable')]"/>
314                                     <field name="date_original" readonly="1"/>
315                                     <field name="date_due" readonly="1"/>
316                                     <field name="amount_original" readonly="1"/>
317                                     <field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
318                                     <field name="amount" sum="Payment"/>
319                                 </tree>
320                             </field>
321                             <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)">
322                                 <tree string="Credits" editable="bottom">
323                                     <field name="move_line_id"/>
324                                     <field name="account_id"  groups="base.group_extended" domain="[('type','=','receivable')]"/>
325                                     <field name="date_original"/>
326                                     <field name="amount_original"/>
327                                     <field name="amount" sum="Payment"/>
328                                 </tree>
329                             </field>
330                             <group col="2" colspan="3">
331                                 <separator string="Internal Notes" colspan="2"/>
332                                 <field name="narration" colspan="2" nolabel="1"/>
333                             </group>
334                             <group col="2" colspan="1">
335                                 <group col="2" colspan="1">
336                                     <separator string="Payment Options" colspan="2"/>
337                                     <field name="payment_option" required="1"/>
338                                     <field name="writeoff_amount"
339                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
340                                     <field name="writeoff_acc_id"
341                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
342                                            domain="[('type','=','other')]"/>
343                                     <field name="comment"
344                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
345                                     <field name="analytic_id"
346                                            attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
347                                            groups="analytic.group_analytic_accounting"/>
348                                 </group>
349                                 <separator string="Other Information" colspan="2"/>
350                                 <group col="4" colspan="1">
351                                     <field name="date" select="1" on_change="onchange_date(date)"/>
352                                     <field name="currency_id" invisible="True"/>
353                                     <field name="number"/>
354                                 </group>
355                             </group>
356                         </page>
357                         <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
358                             <group col="6" colspan="4">
359                                 <field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
360                                 <field name="period_id"/>
361                                 <field name="audit"/>
362                             </group>
363                             <field name="move_ids" colspan="4" nolabel="1" readonly="1">
364                                <tree string="Journal Items">
365                                    <field name="move_id"/>
366                                    <field name="ref"/>
367                                    <field name="date"/>
368                                    <field name="statement_id"/>
369                                    <field name="partner_id"/>
370                                    <field name="account_id"/>
371                                    <field name="name"/>
372                                    <field name="debit"/>
373                                    <field name="credit"/>
374                                    <field name="state"/>
375                                    <field name="reconcile_id"/>
376                                </tree>
377                             </field> 
378                         </page>
379                     </notebook>
380                     <group col="10" colspan="4">
381                         <field name="state"/>
382                         <button name="cancel_voucher" string="Cancel" states="draft,proforma"  icon="gtk-cancel"/>
383                         <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
384                         <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
385                         <button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward"/>
386                     </group>
387                 </form>
388             </field>
389         </record>
390
391         <record id="action_vendor_receipt" model="ir.actions.act_window">
392             <field name="name">Customer Payment</field>
393             <field name="res_model">account.voucher</field>
394             <field name="view_type">form</field>
395             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
396             <field name="context">{'type':'receipt'}</field>
397             <field name="search_view_id" ref="view_voucher_filter_customer_pay"/>
398             <field name="view_id" eval="False"/>
399             <field name="target">current</field>
400             <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>
401         </record>
402         <record id="action_vendor_receipt_tree" model="ir.actions.act_window.view">
403             <field eval="1" name="sequence"/>
404             <field name="view_mode">tree</field>
405             <field name="act_window_id" ref="action_vendor_receipt"/>
406         </record>
407         <record id="action_vendor_receipt_form" model="ir.actions.act_window.view">
408             <field eval="2" name="sequence"/>
409             <field name="view_mode">form</field>
410             <field name="view_id" ref="view_vendor_receipt_form"/>
411             <field name="act_window_id" ref="action_vendor_receipt"/>
412         </record>
413
414         <menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
415             id="menu_action_vendor_receipt"  parent="account.menu_finance_receivables"/>
416     </data>
417 </openerp>