[IMP] better form views, new guidelines
[odoo/odoo.git] / addons / account_voucher / voucher_sales_purchase_view.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <openerp>
3     <data>
4         <record id="view_voucher_filter_vendor" model="ir.ui.view">
5             <field name="name">account.voucher.purchase.select</field>
6             <field name="model">account.voucher</field>
7             <field name="type">search</field>
8             <field name="arch" type="xml">
9                 <search string="Search Vouchers">
10                     <group>
11                         <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
12                         <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
13                         <separator orientation="vertical"/>
14                         <filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted')]" help="To Review"/>
15                         <separator orientation="vertical"/>
16                         <field name="date"/>
17                         <field name="number"/>
18                         <field name="partner_id" string="Supplier"/>
19                     </group>
20                     <newline/>
21                     <group>
22                         <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
23                         <field name="period_id"/>
24                     </group>
25                    <newline/>
26                     <group expand="0" string="Group By...">
27                         <filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
28                         <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
29                         <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
30                         <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
31                     </group>
32                 </search>
33             </field>
34         </record>
35
36         <record id="view_voucher_filter_sale" model="ir.ui.view">
37             <field name="name">account.voucher.sale.select</field>
38             <field name="model">account.voucher</field>
39             <field name="type">search</field>
40             <field name="arch" type="xml">
41                 <search string="Search Vouchers">
42                     <group>
43                         <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
44                         <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
45                         <separator orientation="vertical"/>
46                         <filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted')]" help="To Review"/>
47                         <separator orientation="vertical"/>
48                         <field name="date"/>
49                         <field name="number"/>
50                         <field name="partner_id" string="Customer"/>
51                     </group>
52                     <newline/>
53                     <group>
54                         <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
55                         <field name="period_id"/>
56                     </group>
57                    <newline/>
58                     <group expand="0" string="Group By...">
59                         <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
60                         <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
61                         <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
62                         <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
63                     </group>
64                 </search>
65             </field>
66         </record>
67
68         <record id="act_pay_voucher" model="ir.actions.act_window">
69             <field name="name">Customer Payment</field>
70             <field name="res_model">account.voucher</field>
71             <field name="view_type">form</field>
72             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt'), ('partner_id','=',partner_id)]</field>
73             <field name="context">{'type':'receipt', 'partner_id': partner_id, 'default_reference':reference}</field>
74             <field name="view_id" ref="view_vendor_receipt_form"/>
75             <field name="target">current</field>
76         </record>
77
78         <record model="ir.ui.view" id="view_sale_receipt_form">
79             <field name="name">account.voucher.sale.form</field>
80             <field name="model">account.voucher</field>
81             <field name="type">form</field>
82             <field name="arch" type="xml">
83                 <form version="7.0">
84                 <header>
85                     <button name="proforma_voucher" string="Validate" states="draft"/>
86                     <button name="%(act_pay_voucher)d" context="{'narration':narration, 'title':'Customer Payment', 'type':'receipt', 'partner_id':partner_id, 'reference':reference, 'amount':amount}" type="action" string="Pay" attrs="{'invisible':['|',('pay_now','=','pay_now'),'|',('state','=','draft'), ('paid','=',True)]}"/>
87                     <button name="cancel_voucher" string="Cancel" states="draft,proforma" />
88                     <button name="cancel_voucher" string="Cancel" type="object" states="posted" confirm="Are you sure to confirm this record ?"/>
89                     <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft"/>
90                     <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
91                 </header>
92                 <sheet string="Sales Receipt" layout="auto">
93                     <group col="6">
94                         <field name="partner_id" domain="[('customer','=',True)]" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
95                         <field name="date" on_change="onchange_date(date, currency_id, currency_id, amount, company_id, context)"/>
96                         <field name="journal_id" domain="[('type','in',['sale','sale_refund'])]" widget="selection" on_change="onchange_journal(journal_id, line_cr_ids, tax_id, partner_id, date, amount, type, company_id, context)"/>
97                         <field name="number"/>
98                         <field name="name" colspan="2"/>
99                         <field name="company_id" widget="selection" groups="base.group_multi_company"/>
100                         <field name="type" invisible="True"/>
101                         <field name="currency_id"/>
102                     </group>
103                     <notebook>
104                         <page string="Sales Information">
105                             <field name="line_cr_ids" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}">
106                                 <tree string="Sales Lines" editable="bottom">
107                                     <field name="account_id" domain="[('user_type.report_type','=','income'),('type','!=','view')]" widget="selection"/>
108                                     <field name="name"/>
109                                     <field name="amount" sum="Total"/>
110                                     <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
111                                 </tree>
112                             </field>
113                             <group col="3">
114                                 <group string="Internal Notes" col="1">
115                                     <field name="narration"/>
116                                 </group>
117                                 <group col="2">
118                                     <separator string="Payment Options" colspan="2"/>
119                                     <field name="pay_now" on_change="onchange_payment(pay_now, journal_id, partner_id)" required="1"/>
120                                     <field name="account_id"
121                                          attrs="{'invisible':[('pay_now','!=','pay_now')]}"
122                                           domain="[('type','=','liquidity')]"/>
123                                          <!-- should select income accounts only. Or use the journal for this ? -->
124                                     <field name="reference"
125                                          attrs="{'invisible':[('pay_now','!=','pay_now')]}"
126                                     />
127                                     <field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
128                                     <field name="paid" invisible="1"/>
129                                 </group>
130                                 <group col="4">
131                                     <separator string="Total" colspan="4"/>
132                                     <field name="tax_id" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('sale','all')), ('parent_id', '=', False)]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
133                                     <label string="" colspan="1"/><field name="amount" string="Total"/>
134                                 </group>
135                             </group>
136                         </page>
137                         <page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
138                             <group col="4">
139                                 <field name="period_id"/>
140                                 <field name="audit"/>
141                             </group>
142                             <field name="move_ids" readonly="1">
143                                <tree string="Journal Items">
144                                    <field name="move_id"/>
145                                    <field name="ref"/>
146                                    <field name="date"/>
147                                    <field name="statement_id"/>
148                                    <field name="partner_id"/>
149                                    <field name="account_id"/>
150                                    <field name="name"/>
151                                    <field name="debit"/>
152                                    <field name="credit"/>
153                                    <field name="state"/>
154                                    <field name="reconcile_id"/>
155                                </tree>
156                             </field>
157                         </page>
158                     </notebook>
159                     </sheet>
160                 </form>
161             </field>
162         </record>
163
164         <!-- Sales Voucher -->
165         <record id="action_sale_receipt" model="ir.actions.act_window">
166             <field name="name">Sales Receipt</field>
167             <field name="res_model">account.voucher</field>
168             <field name="view_type">form</field>
169             <field name="domain">[('journal_id.type','in',['sale','sale_refund']), ('type','=','sale')]</field>
170             <field name="context">{'default_type': 'sale', 'type': 'sale'}</field>
171             <field name="view_id" eval="False"/>
172             <field name="search_view_id" ref="view_voucher_filter_sale"/>
173             <field name="target">current</field>
174             <field name="help">When you sell products to a customer, you can give him a sales receipt or an invoice. When the sales receipt is confirmed, it creates journal items automatically and you can record the customer payment related to this sales receipt.</field>
175         </record>
176         <record id="action_sale_receipt_tree" model="ir.actions.act_window.view">
177             <field eval="1" name="sequence"/>
178             <field name="view_mode">tree</field>
179             <field name="act_window_id" ref="action_sale_receipt"/>
180         </record>
181         <record id="action_sale_receipt_form" model="ir.actions.act_window.view">
182             <field eval="2" name="sequence"/>
183             <field name="view_mode">form</field>
184             <field name="view_id" ref="view_sale_receipt_form"/>
185             <field name="act_window_id" ref="action_sale_receipt"/>
186         </record>
187
188         <menuitem id="menu_action_sale_receipt" icon="STOCK_JUSTIFY_FILL"
189             action="action_sale_receipt"
190             parent="account.menu_finance_receivables"
191             sequence="10"/>
192
193         <!--  Purchase Vouchers -->
194         <record id="act_pay_bills" model="ir.actions.act_window">
195             <field name="name">Bill Payment</field>
196             <field name="res_model">account.voucher</field>
197             <field name="view_type">form</field>
198             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment'), ('partner_id','=',partner_id)]</field>
199             <field name="context">{'default_type':'payment', 'type':'payment', 'default_partner_id': partner_id, 'partner_id': partner_id, 'default_reference':reference}</field>
200             <field name="view_id" ref="view_vendor_payment_form"/>
201             <field name="target">current</field>
202         </record>
203         <record model="ir.ui.view" id="view_purchase_receipt_form">
204             <field name="name">account.voucher.purchase.form</field>
205             <field name="model">account.voucher</field>
206             <field name="type">form</field>
207             <field name="arch" type="xml">
208                 <form version="7.0">
209                 <header>
210                     <button name="proforma_voucher" string="Validate" states="draft"/>
211                     <button name="%(act_pay_bills)d" context="{'narration':narration, 'title':'Bill Payment', 'type':'payment', 'partner_id': partner_id, 'reference':reference}" type="action" string="Pay Bill" attrs="{'invisible':['|',('pay_now','=','pay_now'),'|',('state','=','draft'), ('paid','=',True)]}"/>
212                     <button name="cancel_voucher" string="Cancel" states="draft,proforma" />
213                     <button name="cancel_voucher" string="Cancel" type="object" states="posted" confirm="Are you sure to confirm this record ?"/>
214                     <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft"/>
215                     <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
216                 </header>
217                 <sheet string="Supplier Voucher">
218                     <field name="pay_now" invisible="1"/>
219                     <group col="6">
220                         <field name="partner_id" domain="[('supplier','=',True)]" required="1" string="Supplier" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" />
221                         <field name="date" string="Bill Date" on_change="onchange_date(date, currency_id, currency_id, amount, company_id, context)"/>
222                         <field name="journal_id" domain="[('type','in',['purchase','purchase_refund'])]" widget="selection" on_change="onchange_journal(journal_id, line_dr_ids, tax_id, partner_id, date, amount, type, company_id, context)"/>
223                         <field name="number"/>
224                         <field name="name" colspan="2"/>
225                         <field name="reference"/>
226                         <field name="company_id" widget="selection" groups="base.group_multi_company"/>
227                         <field name="account_id" domain="[('type','=','other')]"  invisible="True"/>
228                         <field name="type" invisible="True"/>
229                         <field name="currency_id"/>
230                     </group>
231                     <notebook colspan="4">
232                         <page string="Bill Information">
233                             <field name="line_dr_ids" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" context="{'journal_id':journal_id,'partner_id':partner_id}">
234                                 <tree string="Expense Lines" editable="bottom">
235                                     <field name="account_id" widget="selection" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]"/>
236                                     <field name="name"/>
237                                     <field name="amount"/>
238                                     <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
239                                 </tree>
240                             </field>
241                             <group col="3">
242                                 <group col="1" string="Internal Notes">
243                                     <field name="narration"/>
244                                 </group>
245                                 <group col="2">
246                                     <separator string="Payment Terms" colspan="2"/>
247                                     <field name="date_due"/>
248                                     <field name="paid" invisible="1"/>
249                                 </group>
250                                 <group col="4">
251                                     <separator string="Total" colspan="4"/>
252                                     <field name="tax_id" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('purchase','all')), ('parent_id', '=', False)]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
253                                     <label string="" colspan="1"/><field name="amount" string="Total"/>
254                                 </group>
255                             </group>
256                         </page>
257                         <page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
258                             <group col="4">
259                                 <field name="period_id"/>
260                                 <field name="audit"/>
261                             </group>
262                             <field name="move_ids" readonly="1">
263                                <tree string="Journal Items">
264                                    <field name="move_id"/>
265                                    <field name="ref"/>
266                                    <field name="date"/>
267                                    <field name="statement_id"/>
268                                    <field name="partner_id"/>
269                                    <field name="account_id"/>
270                                    <field name="name"/>
271                                    <field name="debit"/>
272                                    <field name="credit"/>
273                                    <field name="state"/>
274                                    <field name="reconcile_id"/>
275                                </tree>
276                             </field>
277                         </page>
278                     </notebook>
279                     </sheet>
280                 </form>
281             </field>
282         </record>
283         <record id="action_purchase_receipt" model="ir.actions.act_window">
284             <field name="name">Purchase Receipt</field>
285             <field name="res_model">account.voucher</field>
286             <field name="view_type">form</field>
287             <field name="domain">[('journal_id.type','in',['purchase','purchase_refund']), ('type','=','purchase')]</field>
288             <field name="context">{'default_type': 'purchase', 'type': 'purchase'}</field>
289             <field name="view_id" eval="False"/>
290             <field name="search_view_id" eval="view_voucher_filter_vendor"/>
291             <field name="target">current</field>
292         </record>
293         <record id="action_purchase_receipt_tree" model="ir.actions.act_window.view">
294             <field eval="1" name="sequence"/>
295             <field name="view_mode">tree</field>
296             <field name="act_window_id" ref="action_purchase_receipt"/>
297         </record>
298         <record id="action_purchase_receipt_form" model="ir.actions.act_window.view">
299             <field eval="2" name="sequence"/>
300             <field name="view_mode">form</field>
301             <field name="view_id" ref="view_purchase_receipt_form"/>
302             <field name="act_window_id" ref="action_purchase_receipt"/>
303         </record>
304
305         <menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
306             action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
307
308     </data>
309 </openerp>