[IMP] account_voucher: Implement writoff while validating vouchers
[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">
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}">
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                                 <separator string="Other Information" colspan="2"/>
200                                 <field name="date" select="1" on_change="onchange_date(date)"/>
201                                 <field name="currency_id" invisible="True"/>
202                                 <field name="number"/>
203                             </group>
204                         </page>
205                         <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
206                             <group col="6" colspan="4">
207                                 <field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
208                                 <field name="period_id"/>
209                                 <field name="audit"/>
210                             </group>
211                             <separator string="Journal Items" colspan="4"/>
212                             <field name="move_ids" colspan="4" nolabel="1" readonly="1"/>
213                         </page>
214                     </notebook>
215                     <group col="10" colspan="4">
216                         <field name="state"/>
217                         <button name="cancel_voucher" string="Cancel" states="draft,proforma"  icon="gtk-cancel"/>
218                         <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
219                         <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
220                         <button name="do_check" type="object" string="Validate" states="draft" icon="gtk-go-forward"/>
221                     </group>
222                 </form>
223             </field>
224         </record>
225
226         <record id="action_vendor_payment" model="ir.actions.act_window">
227             <field name="name">Vendor Payment</field>
228             <field name="res_model">account.voucher</field>
229             <field name="view_type">form</field>
230             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>
231             <field name="context">{'type':'payment'}</field>
232             <field name="view_id" eval="False"/>
233             <field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
234             <field name="target">current</field>
235             <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>
236         </record>
237         <record id="action_vendor_payment_tree" model="ir.actions.act_window.view">
238             <field eval="1" name="sequence"/>
239             <field name="view_mode">tree</field>
240             <field name="act_window_id" ref="action_vendor_payment"/>
241         </record>
242         <record id="action_vendor_payment_form" model="ir.actions.act_window.view">
243             <field eval="2" name="sequence"/>
244             <field name="view_mode">form</field>
245             <field name="view_id" ref="view_vendor_payment_form"/>
246             <field name="act_window_id" ref="action_vendor_payment"/>
247         </record>
248
249
250         <menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
251             id="menu_action_vendor_payment"  parent="account.menu_finance_payables"/>
252
253         <record model="ir.ui.view" id="view_vendor_receipt_form">
254             <field name="name">account.voucher.receipt.form</field>
255             <field name="model">account.voucher</field>
256             <field name="type">form</field>
257             <field name="arch" type="xml">
258                 <form string="Customer Payment">
259                     <group col="6" colspan="4">
260                         <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" string="Customer"/>
261                         <field name="journal_id"
262                             domain="[('type','in',['bank', 'cash'])]"
263                             widget="selection" select="1"
264                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"
265                             string="Payment Method"/>
266                         <field name="amount"
267                             string="Paid Amount"
268                             on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
269                         <field name="reference" select="1" string="Payment Ref"/>
270                         <field name="name" colspan="4"/>
271                         <field name="account_id"
272                             widget="selection"
273                             invisible="True"/>
274                         <field name="pre_line" invisible="1"/>
275                         <field name="type" invisible="True"/>
276                     </group>
277                     <notebook colspan="4">
278                         <page string="Payment Information">
279                             <field name="line_cr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
280                                 <tree string="Invoices and outstanding transactions" editable="bottom">
281                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
282                                         on_change="onchange_move_line_id(move_line_id)"
283                                         domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
284                                         />
285                                     <field name="account_id"  groups="base.group_extended" domain="[('type','=','receivable')]"/>
286                                     <field name="date_original" readonly="1"/>
287                                     <field name="date_due" readonly="1"/>
288                                     <field name="amount_original" readonly="1"/>
289                                     <field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
290                                     <field name="amount" sum="Payment"/>
291                                 </tree>
292                             </field>
293                             <field name="line_dr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}">
294                                 <tree string="Credits" editable="bottom">
295                                     <field name="move_line_id"/>
296                                     <field name="account_id"  groups="base.group_extended" domain="[('type','=','receivable')]"/>
297                                     <field name="date_original"/>
298                                     <field name="amount_original"/>
299                                     <field name="amount" sum="Payment"/>
300                                 </tree>
301                             </field>
302                             <group col="2" colspan="3">
303                                 <separator string="Internal Notes" colspan="2"/>
304                                 <field name="narration" colspan="2" nolabel="1"/>
305                             </group>
306                             <group col="2" colspan="1">
307                                 <separator string="Other Information" colspan="2"/>
308                                 <field name="date" select="1" on_change="onchange_date(date)"/>
309                                 <field name="currency_id" invisible="True"/>
310                                 <field name="number"/>
311                             </group>
312                         </page>
313                         <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
314                             <group col="6" colspan="4">
315                                 <field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
316                                 <field name="period_id"/>
317                                 <field name="audit"/>
318                             </group>
319                             <separator string="Journal Items" colspan="4"/>
320                             <field name="move_ids" colspan="4" nolabel="1" readonly="1"/>
321                         </page>
322                     </notebook>
323                     <group col="10" colspan="4">
324                         <field name="state"/>
325                         <button name="cancel_voucher" string="Cancel" states="draft,proforma"  icon="gtk-cancel"/>
326                         <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
327                         <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
328                         <button name="do_check" type="object" string="Validate" states="draft" icon="gtk-go-forward"/>
329                     </group>
330                 </form>
331             </field>
332         </record>
333
334         <record id="action_vendor_receipt" model="ir.actions.act_window">
335             <field name="name">Customer Payment</field>
336             <field name="res_model">account.voucher</field>
337             <field name="view_type">form</field>
338             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
339             <field name="context">{'type':'receipt'}</field>
340             <field name="search_view_id" ref="view_voucher_filter_customer_pay"/>
341             <field name="view_id" eval="False"/>
342             <field name="target">current</field>
343             <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>
344         </record>
345         <record id="action_vendor_receipt_tree" model="ir.actions.act_window.view">
346             <field eval="1" name="sequence"/>
347             <field name="view_mode">tree</field>
348             <field name="act_window_id" ref="action_vendor_receipt"/>
349         </record>
350         <record id="action_vendor_receipt_form" model="ir.actions.act_window.view">
351             <field eval="2" name="sequence"/>
352             <field name="view_mode">form</field>
353             <field name="view_id" ref="view_vendor_receipt_form"/>
354             <field name="act_window_id" ref="action_vendor_receipt"/>
355         </record>
356
357         <menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
358             id="menu_action_vendor_receipt"  parent="account.menu_finance_receivables"/>
359     </data>
360 </openerp>