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