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