[IMP] improve the supplier payment and write check view.
[odoo/odoo.git] / addons / account_check_writing / account_voucher_view.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <openerp>
3     <data>
4
5
6    <!--   <field name="inherit_id" ref="account_voucher.view_vendor_payment_form" />
7             <field name="arch" type="xml">
8                 <h1 position="replace">
9                                 <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"/>
10                 </h1>
11                 <field name="journal_id" position="after">
12                     <newline/>
13                     <field name="allow_check" invisible="1"/>
14                     <field name="amount_in_word" attrs="{'invisible':[('allow_check','!=',1)]}" nolabel="1" colspan="6"/>
15                     <newline/>
16                 </field>
17                 <field name="number" position="replace">
18                     <field name="number" attrs="{'readonly':[('allow_check','!=',1)]}" />
19                 </field>
20                 <button name="proforma_voucher" position="after">
21                     <button name="print_check" icon="gtk-print" string="Print Check" type="object" attrs="{'invisible':['|',('allow_check','!=',1),('state','!=','posted') ]}"/>
22                 </button>
23             </field> -->
24
25
26         <!-- Supplier voucher view -->
27         
28         <record model="ir.ui.view" id="view_vendor_payment_check_form">
29             <field name="name">account.voucher.payment.check.form</field>
30             <field name="model">account.voucher</field>
31             <field name="type">form</field>
32             <field name="arch" type="xml">
33                 <form version="7.0">
34                 <header>
35                     <button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)"/>
36                     <button name="print_check" icon="gtk-print" string="Print Check" type="object" attrs="{'invisible':['|',('allow_check','!=',1),('state','!=','posted') ]}"/>
37                     <button name="cancel_voucher" string="Cancel" states="draft,proforma"  invisible="context.get('line_type', False)"/>
38                     <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 ?"/>
39                     <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="context.get('line_type', False)"/>
40                     <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
41                 </header>
42                 <sheet string="Bill Payment">
43                     <group col="4">
44                         <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"/>
45                         <field name="journal_id"
46                             domain="[('type','in',['bank', 'cash'])]"
47                             invisible="context.get('line_type', False)"
48                             widget="selection"
49                             on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"
50                             string="Payment Method"/>
51                             <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)"/> 
52                             <field name="amount_in_word" attrs="{'invisible':[('allow_check','!=',1)]}" nolabel="1" colspan="6"/>
53                         <field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
54                         <field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="003/10"/>
55                         <field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="Invoice SAJ/0042"/>    
56                         <field name="allow_check" invisible="1"/>
57                         <field name="company_id" widget="selection" groups="base.group_multi_company"/>
58                         <field name="account_id"
59                             widget="selection"
60                             invisible="True"/>
61                         <field name="pre_line" invisible="1"/>
62                         <field name="type" invisible="True"/>
63                         <field name="currency_id" invisible="1" colspan="4"/>
64                     </group>
65                     <notebook>
66                         <page string="Payment Information">
67                             <field name="line_dr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}">
68                                 <tree string="Supplier Invoices and Outstanding transactions" editable="bottom" colors="gray:amount==0">
69                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
70                                         on_change="onchange_move_line_id(move_line_id)"
71                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
72                                         required="1"
73                                         />
74                                     <field name="account_id" groups="base.group_no_one" domain="[('type','=','payable')]"/>
75                                     <field name="date_original" readonly="1"/>
76                                     <field name="date_due" readonly="1"/>
77                                     <field name="amount_original" readonly="1"/>
78                                     <field name="amount_unreconciled" readonly="1"/>
79                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
80                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
81                                 </tree>
82                             </field>
83                             <field name="line_cr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}">
84                                 <tree string="Credits" editable="bottom" colors="gray:amount==0">
85                                     <field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
86                                         on_change="onchange_move_line_id(move_line_id)"
87                                         domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
88                                         required="1"
89                                         />
90                                     <field name="account_id" groups="base.group_no_one" domain="[('type','=','payable')]"/>
91                                     <field name="date_original" readonly="1"/>
92                                     <field name="date_due" readonly="1"/>
93                                     <field name="amount_original" readonly="1"/>
94                                     <field name="amount_unreconciled" readonly="1"/>
95                                     <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
96                                     <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
97                                 </tree>
98                             </field>
99                             <group class="oe_subtotal_footer">
100                                                 <field name="amount_total" class="oe_subtotal_footer_separator"/>
101                                         </group>
102                             <group>
103                                 <group string="Internal Notes">
104                                     <field name="narration" colspan="2" nolabel="1"/>
105                                 </group>
106                                 <group>
107                                     <group col="4" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
108                                         <separator string="Currency Options" colspan="4"/>
109                                         <field name="is_multi_currency" invisible="1"/>
110                                         <field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" colspan="3"/>
111                                         <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)"/>
112                                         <field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
113                                     </group>
114                                     <group col="2">
115                                         <separator string="Payment Options" colspan="2"/>
116                                         <field name="writeoff_amount"/>
117                                         <field name="payment_option" required="1"/>
118                                         <field name="writeoff_acc_id"
119                                                attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
120                                                domain="[('type','=','other')]"/>
121                                         <field name="comment"
122                                                attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
123                                         <field name="analytic_id"
124                                                groups="analytic.group_analytic_accounting"/>
125                                     </group>
126                                 </group>
127                             </group>
128                         </page>
129                         <page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
130                             <group col="4">
131                                 <field name="period_id"/>
132                                 <field name="audit"/>
133                                 <field name="number" attrs="{'readonly':[('allow_check','!=',1)]}" />
134                             </group>
135                             <field name="move_ids" readonly="1">
136                                <tree string="Journal Items">
137                                    <field name="move_id"/>
138                                    <field name="ref"/>
139                                    <field name="date"/>
140                                    <field name="statement_id"/>
141                                    <field name="partner_id"/>
142                                    <field name="account_id"/>
143                                    <field name="name"/>
144                                    <field name="debit"/>
145                                    <field name="credit"/>
146                                    <field name="state"/>
147                                    <field name="reconcile_id"/>
148                                    <field name="amount_currency"/>
149                                    <field name="currency_id"/>
150                                </tree>
151                             </field>
152                         </page>
153                     </notebook>
154                     </sheet>
155                 </form>
156             </field>
157        
158         </record>
159
160         <record id="action_write_check" model="ir.actions.act_window">
161             <field name="name">Write Checks</field>
162             <field name="res_model">account.voucher</field>
163             <field name="view_type">form</field>
164             <field name="view_mode">form,tree</field>
165             <field name="domain">[('journal_id.type', '=', 'bank'), ('type','=','payment'), ('journal_id.allow_check_writing','=',True)]</field>
166             <field name="context">{'type':'payment','write_check':True}</field>
167             <field name="search_view_id" ref="account_voucher.view_voucher_filter"/>
168             <field name="target">current</field>
169             <field name="help">The check payment form allows you to track the payment you do to your suppliers specially by check. 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.You can print the check</field>
170         </record>
171
172         <record id="action_write_check_form" model="ir.actions.act_window.view">
173             <field eval="2" name="sequence"/>
174             <field name="view_mode">form</field>
175             <field name="view_id" ref="view_vendor_payment_check_form"/>
176             <field name="act_window_id" ref="action_write_check"/>
177         </record>
178
179         <record id="action_write_check_tree" model="ir.actions.act_window.view">
180             <field eval="1" name="sequence"/>
181             <field name="view_mode">tree</field>
182             <field name="act_window_id" ref="action_write_check"/>
183         </record>
184
185         <menuitem action="action_write_check" icon="STOCK_JUSTIFY_FILL" sequence="12"
186             id="menu_action_write_check"  parent="account.menu_finance_payables"/>
187     </data>
188 </openerp>