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