[FIX] account_voucher: convertion rate of purchase receipt
[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="company_id" widget="selection" groups="base.group_multi_company"/>
77                             <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}'/>
78                             <field name="account_id"
79                                   domain="[('type','in', ['liquidity', 'receivable'])]"/>
80                             <field name="pay_now" on_change="onchange_payment(pay_now, journal_id, partner_id)" required="1"/>
81                             <field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
82                             <field name="reference"
83                                  attrs="{'invisible':[('pay_now','!=','pay_now')]}"/>
84                         </group>
85                         <group>
86                             <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"/>
87                             <field name="date" on_change="onchange_date(date, currency_id, currency_id, amount, company_id, context)"/>
88                             <field name="name"/>
89                             <field name="paid" invisible="1"/>
90                             <field name="paid_amount_in_company_currency" invisible="1"/>
91                             <field name="currency_id" invisible="1"/>
92                         </group>
93                     </group>
94                     <notebook>
95                         <page string="Sales Information">
96                             <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}">
97                                 <tree string="Sales Lines" editable="bottom">
98                                     <field name="account_id" domain="[('user_type.report_type','=','income'),('type','!=','view')]" widget="selection"/>
99                                     <field name="name"/>
100                                     <field name="amount" sum="Total"/>
101                                     <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
102                                 </tree>
103                             </field>
104                                         <group>
105                                 <field name="narration" placeholder="Internal Notes" nolabel="1"/>
106                                 <group class="oe_subtotal_footer oe_right">
107                                     <field name="tax_id" 
108                                         on_change="onchange_price(line_cr_ids, tax_id, partner_id)"
109                                         widget="selection" nolabel="1"
110                                         placeholder="Tax"
111                                         domain="[('type_tax_use','in',('sale','all')), ('parent_id', '=', False)]"/>
112                                     <field name="tax_amount" nolabel="1"/>
113                                     <div class="oe_subtotal_footer_separator">
114                                         <label for="amount"/>
115                                         <button type="object" class="oe_link oe_edit_only"
116                                             name="compute_tax" string="(update)"
117                                             attrs="{'invisible': [('state','!=','draft')]}"/>
118                                                 </div>
119                                     <field name="amount" class="oe_subtotal_footer_separator" nolabel="1"/>
120                                 </group>                                    
121                                         </group>
122                         </page>
123                         <page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
124                             <group col="4">
125                                 <field name="period_id"/>
126                                 <field name="audit"/>
127                             </group>
128                             <field name="move_ids" readonly="1">
129                                <tree string="Journal Items">
130                                    <field name="move_id"/>
131                                    <field name="ref"/>
132                                    <field name="date"/>
133                                    <field name="statement_id"/>
134                                    <field name="partner_id"/>
135                                    <field name="account_id"/>
136                                    <field name="name"/>
137                                    <field name="debit"/>
138                                    <field name="credit"/>
139                                    <field name="state"/>
140                                    <field name="reconcile_id"/>
141                                </tree>
142                             </field>
143                         </page>
144                     </notebook>
145                     <group col="4" invisible="1">
146                                     <field name="is_multi_currency" invisible="1"/>
147                                     <field name="currency_help_label" invisible="1"/>
148                                     <field name="payment_rate" invisible="1"/>
149                                     <field name="payment_rate_currency_id"  invisible="1"/>
150                                     <field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
151                     </group>
152                     </sheet>
153                     <div class="oe_chatter">
154                         <field name="message_follower_ids" widget="mail_followers"/>
155                         <field name="message_ids" widget="mail_thread"/>
156                     </div>
157                 </form>
158             </field>
159         </record>
160
161         <!-- Sales Voucher -->
162         <record id="action_sale_receipt" model="ir.actions.act_window">
163             <field name="name">Sales Receipts</field>
164             <field name="res_model">account.voucher</field>
165             <field name="view_type">form</field>
166             <field name="domain">[('journal_id.type','in',['sale','sale_refund']), ('type','=','sale')]</field>
167             <field name="context">{'default_type': 'sale', 'type': 'sale'}</field>
168             <field name="view_id" eval="False"/>
169             <field name="search_view_id" ref="view_voucher_filter_sale"/>
170             <field name="target">current</field>
171             <field name="help" type="html">
172               <p class="oe_view_nocontent_create">
173                 Click to create a sale receipt.
174               </p><p>
175                 When the sale receipt is confirmed, you can record the customer
176                 payment related to this sales receipt.
177               </p>
178             </field>
179         </record>
180         <record id="action_sale_receipt_tree" model="ir.actions.act_window.view">
181             <field eval="1" name="sequence"/>
182             <field name="view_mode">tree</field>
183             <field name="act_window_id" ref="action_sale_receipt"/>
184         </record>
185         <record id="action_sale_receipt_form" model="ir.actions.act_window.view">
186             <field eval="2" name="sequence"/>
187             <field name="view_mode">form</field>
188             <field name="view_id" ref="view_sale_receipt_form"/>
189             <field name="act_window_id" ref="action_sale_receipt"/>
190         </record>
191
192         <menuitem id="menu_action_sale_receipt" icon="STOCK_JUSTIFY_FILL"
193             action="action_sale_receipt"
194             parent="account.menu_finance_receivables"
195             sequence="10"/>
196
197         <!--  Purchase Vouchers -->
198         <record id="act_pay_bills" model="ir.actions.act_window">
199             <field name="name">Bill Payment</field>
200             <field name="res_model">account.voucher</field>
201             <field name="view_type">form</field>
202             <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment'), ('partner_id','=',partner_id)]</field>
203             <field name="context">{'default_type':'payment', 'type':'payment', 'default_partner_id': partner_id, 'partner_id': partner_id, 'default_reference':reference}</field>
204             <field name="view_id" ref="view_vendor_payment_form"/>
205             <field name="target">current</field>
206         </record>
207         <record model="ir.ui.view" id="view_purchase_receipt_form">
208             <field name="name">account.voucher.purchase.form</field>
209             <field name="model">account.voucher</field>
210             <field name="arch" type="xml">
211                 <form string="Purchase Voucher" version="7.0">
212                 <header>
213                     <button name="proforma_voucher" string="Validate" states="draft" class="oe_highlight"/>
214                     <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"/>
215                     <button name="cancel_voucher" string="Cancel Voucher" states="draft,proforma" />
216                     <button name="cancel_voucher" string="Cancel Voucher" type="object" states="posted" confirm="Are you sure you want to cancel this receipt?"/>
217                     <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft"/>
218                     <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
219                 </header>
220                 <sheet string="Supplier Voucher">
221                     <h1><label for="number" string="Purchase Receipt"/> <field name="number" class="oe_inline" readonly="1"/></h1>
222
223                     <field name="pay_now" invisible="1"/>
224                     <field name="type" invisible="True"/>
225                     <field name="payment_rate_currency_id" invisible="1"/>
226                     <group>
227                         <group>
228                             <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}" />
229                             <field name="account_id" domain="[('type', 'in', ['liquidity', 'payable'])]"/>
230                             <field name="name" colspan="2"/>
231                             <field name="reference"/>
232                             <field name="company_id" widget="selection" groups="base.group_multi_company"/>
233                         </group>
234                         <group>
235                             <field name="date" string="Bill Date" on_change="onchange_date(date, currency_id, currency_id, amount, company_id, context)"/>
236                             <field name="date_due"/>
237                             <field name="paid" invisible="1"/>
238                             <field name="currency_id" invisible="1"/>
239                             <field name="journal_id"
240                                 domain="[('type','in',['purchase','purchase_refund'])]"
241                                 widget="selection"
242                                 on_change="onchange_journal(journal_id, line_dr_ids, tax_id, partner_id, date, amount, type, company_id, context)"
243                                 groups="account.group_account_user"/>
244                             <field name="paid_amount_in_company_currency" invisible="1"/>
245                             <field name="currency_help_label" invisible="1"/>
246                         </group>
247                     </group>
248                     <notebook>
249                         <page string="Bill Information">
250                             <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}">
251                                 <tree string="Expense Lines" editable="bottom">
252                                     <field name="account_id" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]"/>
253                                     <field name="name"/>
254                                     <field name="amount"/>
255                                     <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
256                                 </tree>
257                             </field>
258                             <group>
259                                 <field name="narration" placeholder="Internal Notes" nolabel="1"/>
260                                 <group class="oe_subtotal_footer oe_right">
261                                     <!--
262                                     <div>
263                                         <label for="tax_id" />
264                                         <button type="object" 
265                                             icon="terp-stock_format-scientific" 
266                                             name="compute_tax"
267                                             attrs="{'invisible': [('state','!=','draft')]}"/>
268                                     </div>
269                                     -->
270                                     <field name="tax_id" 
271                                         on_change="onchange_price(line_dr_ids, tax_id, partner_id)"
272                                         widget="selection" nolabel="1"
273                                         placeholder="Tax"
274
275                                         domain="[('type_tax_use','in',('purchase','all')), ('parent_id', '=', False)]"
276                                         />
277                                     <field name="tax_amount" nolabel="1"/>
278                                     <div class="oe_subtotal_footer_separator">
279                                         <label for="amount"/>
280                                         <button type="object" class="oe_link oe_edit_only"
281                                             name="compute_tax" string="(update)"
282                                             attrs="{'invisible': [('state','!=','draft')]}"/>
283                                     </div>
284                                     <field name="amount" class="oe_subtotal_footer_separator" nolabel="1"/>
285                                 </group>
286                             </group>
287                         </page>
288                         <page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
289                             <group col="4">
290                                 <field name="period_id"/>
291                                 <field name="audit"/>
292                             </group>
293                             <field name="move_ids" readonly="1">
294                                <tree string="Journal Items">
295                                    <field name="move_id"/>
296                                    <field name="ref"/>
297                                    <field name="date"/>
298                                    <field name="statement_id"/>
299                                    <field name="partner_id"/>
300                                    <field name="account_id"/>
301                                    <field name="name"/>
302                                    <field name="debit"/>
303                                    <field name="credit"/>
304                                    <field name="state"/>
305                                    <field name="reconcile_id"/>
306                                </tree>
307                             </field>
308                         </page>
309                     </notebook>
310                     </sheet>
311                     <div class="oe_chatter">
312                         <field name="message_follower_ids" widget="mail_followers"/>
313                         <field name="message_ids" widget="mail_thread"/>
314                     </div>
315                 </form>
316             </field>
317         </record>
318         <record id="action_purchase_receipt" model="ir.actions.act_window">
319             <field name="name">Purchase Receipts</field>
320             <field name="res_model">account.voucher</field>
321             <field name="view_type">form</field>
322             <field name="domain">[('journal_id.type','in',['purchase','purchase_refund']), ('type','=','purchase')]</field>
323             <field name="context">{'default_type': 'purchase', 'type': 'purchase'}</field>
324             <field name="view_id" eval="False"/>
325             <field name="search_view_id" eval="view_voucher_filter_vendor"/>
326             <field name="target">current</field>
327             <field name="help" type="html">
328               <p class="oe_view_nocontent_create">
329                 Click to register a purchase receipt. 
330               </p><p>
331                 When the purchase receipt is confirmed, you can record the
332                 supplier payment related to this purchase receipt.
333               </p>
334             </field>
335         </record>
336         <record id="action_purchase_receipt_tree" model="ir.actions.act_window.view">
337             <field eval="1" name="sequence"/>
338             <field name="view_mode">tree</field>
339             <field name="act_window_id" ref="action_purchase_receipt"/>
340         </record>
341         <record id="action_purchase_receipt_form" model="ir.actions.act_window.view">
342             <field eval="2" name="sequence"/>
343             <field name="view_mode">form</field>
344             <field name="view_id" ref="view_purchase_receipt_form"/>
345             <field name="act_window_id" ref="action_purchase_receipt"/>
346         </record>
347
348         <menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
349             action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
350
351     </data>
352 </openerp>