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