c104a376b78c8622609634344f9538faeccd7789
[odoo/odoo.git] / addons / account_analytic_analysis / account_analytic_analysis_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4         <record model="ir.actions.act_window" id="action_sales_order">
5             <field name="name">Sales Orders</field>
6             <field name="res_model">sale.order</field>
7             <field name="src_model">account.analytic.account</field>
8             <field name="help" type="html">
9               <p class="oe_view_nocontent_create">
10                 Click to create a quotation that can be converted into a sales
11                 order.
12               </p><p>
13                 Use sale orders to track everything that should be invoiced
14                 at a fix price on a contract.
15               </p>
16             </field>
17         </record>
18
19         <!-- Inherited Analytic Account form for contracts -->
20         <record id="account_analytic_account_form_form" model="ir.ui.view">
21             <field name="name">account.analytic.account.invoice.form.inherit</field>
22             <field name="model">account.analytic.account</field>
23             <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
24             <field eval="40" name="priority"/>
25             <field name="arch" type="xml">
26                 <xpath expr='//div[@name="duration"]' position="after">
27                     <label for="quantity_max"/>
28                     <div>
29                         <field name="quantity_max"/>
30                         <div attrs="{'invisible': [('hours_quantity','=',0)]}" class="oe_grey">
31                             <field name="hours_quantity" class="oe_inline"/> Units Consumed
32                         </div>
33                         <div attrs="{'invisible': [('quantity_max','=',0)]}" class="oe_grey">
34                             <field name="remaining_hours" class="oe_inline"/> Units Remaining
35                         </div>
36                     </div>
37                 </xpath>
38                 <field name="partner_id" position="attributes">
39                     <attribute name="attrs">{'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]}</attribute>
40                 </field>
41                 <xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">
42                 </xpath>
43                 <xpath expr='//separator[@name="description"]' position='before'>
44                     <separator name="toinvoice" string="Invoicing"/>
45                     <table class="oe_form_analytic_account">
46                         <tr>
47                             <th class="oe_timesheet_grey" width="160px"></th>
48                             <th class="oe_timesheet_grey" width="25px"></th>
49                             <th class="oe_timesheet_grey" width="100px"><label string="Expected"/></th>
50                             <th class="oe_timesheet_grey" width="100px"><label string="Invoiced"/></th>
51                             <th class="oe_timesheet_grey" width="100px"><label string="Remaining"/></th>
52                             <th class="oe_timesheet_grey" width="100px"><label string="To Invoice"/></th>
53                             <th width="30px"></th>
54                             <th></th>
55                         </tr><tr>
56                             <td class="oe_timesheet_grey">
57                                 <label for="fix_price_invoices"/>
58                             </td><td class="oe_timesheet_grey">
59                                 <field name="fix_price_invoices" class="oe_inline"/>
60                             </td><td>
61                                 <field class="oe_inline" name="amount_max" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
62                             </td><td>
63                                 <field class="oe_inline" name="ca_invoiced" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
64                             </td><td>
65                                 <field class="oe_inline" name="remaining_ca" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
66                             </td><td>
67                                 <field class="oe_inline" name="fix_price_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
68                             </td><td attrs="{'invisible': [('fix_price_invoices','=',False)]}" class="oe_timesheet_action">
69                                 <span attrs="{'invisible': [('fix_price_to_invoice','=',0.0)]}" class="oe_grey">
70                                     <button name="open_sale_order_lines"
71                                         class="oe_link"
72                                         string="⇒ Invoice" type="object"
73                                         context="{'default_partner_id': [partner_id],'default_project_id': active_id,'search_default_uninvoiced': 1,'search_default_project_id': active_id,'search_default_partner_id': [partner_id]}"/>
74                                     or view
75                                 </span>
76
77                                 <span attrs="{'invisible': [('fix_price_to_invoice','&lt;&gt;',0.0 )]}" class="oe_grey">
78                                     No order to invoice, create
79                                 </span>
80                                 <button name="%(action_sales_order)d" string="Sales Orders"
81                                     type="action"
82                                     class="oe_link"
83                                     context="{'default_partner_id': [partner_id], 'search_default_project_id': [active_id],'default_project_id': [active_id]}"
84                                     />
85                             </td>
86                         </tr><tr>
87                             <td class="oe_timesheet_grey">
88                                 <label string="On Timesheets"/>
89                             </td><td class="oe_timesheet_grey">
90                             </td><td>
91                                 <field class="oe_inline" name="hours_qtt_est" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
92                             </td><td>
93                                 <field class="oe_inline" name="timesheet_ca_invoiced" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
94                             </td><td>
95                                 <field class="oe_inline" name="remaining_hours_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
96                             </td><td>
97                                 <field class="oe_inline" name="ca_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
98                             </td><td class="oe_timesheet_action" attrs="{'invisible': ['|',('invoice_on_timesheets','=',False),('type','=','template')]}">
99                                 <span attrs="{'invisible': [('ca_to_invoice','=',0.0)]}" class="oe_grey">
100                                     <button name="hr_to_invoice_timesheets"
101                                         type="object"
102                                         class="oe_link"
103                                         string="⇒ Invoice"/>
104                                     or view 
105                                 </span>
106                                 <span attrs="{'invisible': [('ca_to_invoice','&lt;&gt;',0.0)]}" class="oe_grey">
107                                     Nothing to invoice, create 
108                                 </span>
109
110                                 <button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d"
111                                     string="Timesheets" type="action"
112                                     class="oe_link"
113                                     context="{'default_account_id': active_id,'search_default_account_id': active_id}"/>
114                             </td>
115                         </tr><tr name='total'>
116                             <th class="oe_timesheet_grey">
117                                 <label string="Total"/>
118                             </th><td class="oe_timesheet_grey">
119                             </td><td class="oe_timesheet_grey">
120                                 <field name="est_total" class="oe_inline" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
121                             </td><td class="oe_timesheet_grey">
122                                 <field name="invoiced_total" class="oe_inline"/>
123                             </td><td class="oe_timesheet_grey">
124                                 <field name="remaining_total" class="oe_inline"/>
125                             </td><td class="oe_timesheet_grey">
126                                 <field name="toinvoice_total" class="oe_inline"/>
127                             </td><td>
128                             </td>
129                         </tr>
130                     </table>
131                     <group name='invoice_on_timesheets'>
132                         <p name='invoice_on_timesheets_label' class="oe_grey oe_edit_only" colspan="2" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}">
133                             When reinvoicing costs, Odoo uses the
134                             pricelist of the contract which uses the price
135                             defined on the product related (e.g timesheet 
136                             products are defined on each employee). 
137                         </p>
138                         <group>
139                             <field name="pricelist_id"
140                                 class="oe_inline"
141                                 attrs="{'required': [('invoice_on_timesheets', '=', True)]}"
142                                 domain="[('type', '=', 'sale')]"
143                                 groups="product.group_sale_pricelist"/>
144                             <field name="to_invoice"
145                                 class="oe_inline"
146                                 widget="selection"
147                                 attrs="{'required': [('invoice_on_timesheets', '=', True)], 'invisible': [('invoice_on_timesheets','=',False)]}"/>
148                         </group>
149                     </group>
150                     <separator string="Recurring Invoices" attrs="{'invisible': [('recurring_invoices','!=',True)]}"/>
151                     <div>
152                         <div attrs="{'invisible': [('type','!=', 'contract'), ('recurring_invoices', '=', False)]}">
153                             <field name="recurring_invoices" on_change="onchange_recurring_invoices(recurring_invoices, date_start)" class="oe_inline" />
154                             <label for="recurring_invoices" />
155                         </div>
156                         <button class="oe_link" name="recurring_create_invoice" attrs="{'invisible': [('recurring_invoices','!=',True)]}" string="⇒ create invoices" type="object" groups="base.group_no_one"/>
157                     </div>
158                     <group attrs="{'invisible': [('recurring_invoices','!=',True)]}">
159                         <label for="recurring_interval"/>
160                         <div>
161                             <field name="recurring_interval" class="oe_inline" attrs="{'required': [('recurring_invoices', '=', True)]}"/>
162                             <field name="recurring_rule_type" class="oe_inline" attrs="{'required': [('recurring_invoices', '=', True)]}"/>
163                         </div>
164                         <field name="recurring_next_date"/>
165                     </group>
166                     <label for="recurring_invoice_line_ids" attrs="{'invisible': [('recurring_invoices','=',False)]}"/>
167                     <div attrs="{'invisible': [('recurring_invoices','=',False)]}">
168                         <field name="recurring_invoice_line_ids">
169                             <tree string="Account Analytic Lines" editable="bottom">
170                                 <field name="product_id" on_change="product_id_change(product_id, uom_id, quantity, False, parent.partner_id, False, parent.pricelist_id, parent.company_id)"/>
171                                 <field name="name"/>
172                                 <field name="quantity"/>
173                                 <field name="uom_id"/>
174                                 <field name="price_unit"/>
175                                 <field name="price_subtotal"/>
176                             </tree>
177                         </field>
178                     </div>
179                  </xpath>
180             </field>
181         </record>
182
183         <!-- Inherited Analytic Account form for template required -->
184         <record id="view_account_analytic_account_template_required" model="ir.ui.view">
185             <field name="name">account.analytic.account.form.template.required</field>
186             <field name="model">account.analytic.account</field>
187             <field name="groups_id" eval="[(6, 0, [ref('group_template_required')])]"/>
188             <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
189             <field name="arch" type="xml">
190                 <field name="template_id" position="attributes">
191                     <attribute name="attrs">{'required': [('type','=','contract')], 'invisible': [('type','in',['view', 'normal','template'])]}</attribute>
192                 </field>
193             </field>
194         </record>
195
196         <!-- Inherited Analytic Account list for contracts -->
197         <record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view">
198             <field name="name">account.analytic.account.list.contract</field>
199             <field name="model">account.analytic.account</field>
200             <field name="inherit_id" ref="analytic.view_account_analytic_account_list"/>
201             <field name="arch" type="xml">
202                 <field name="date_start" position="before">
203                     <field name="last_invoice_date"/>
204                     <field name="toinvoice_total"/>
205                     <field name="remaining_hours"/>
206                     <field name="pricelist_id" invisible="1"/>
207                 </field>
208             </field>
209         </record>
210
211         <!-- Analytic Account search view for contract -->
212         <record id="view_account_analytic_account_overdue_search" model="ir.ui.view">
213             <field name="name">account.analytic.account.search</field>
214             <field name="model">account.analytic.account</field>
215             <field name="arch" type="xml">
216                 <search string="Contracts">
217                     <field name="name" filter_domain="['|', ('name','ilike',self),('code','ilike',self)]" string="Contract"/>
218                     <field name="date"/>
219                     <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
220                     <field name="manager_id"/>
221                     <field name="parent_id"/>
222                     <filter name="open" string="In Progress" domain="[('state','in',('open','draft'))]" help="Contracts in progress (open, draft)"/>
223                     <filter name="pending" string="To Renew" domain="[('state','=','pending')]" help="Pending contracts"/>
224                     <filter name="closed" string="Closed" domain="[('state','=','close')]" help="Closed contracts"/>
225                     <filter name="cancelled" string="Cancelled" domain="[('state','=','cancelled')]" help="Cancelled contracts"/>
226                     <separator/>
227                     <filter
228                         string="Expired or consumed"
229                         domain="[('state','in',('open','draft','pending')), '|', '&amp;', ('date', '!=', False), ('date', '&lt;=', time.strftime('%%Y-%%m-%%d')), ('is_overdue_quantity', '=', True)]"
230                         help="End date passed or prepaid unit consumed" />
231                     <filter
232                         string="Expiring soon"
233                         domain="[('date', '!=', False), ('date', '&lt;=', (context_today() + datetime.timedelta(30)).strftime('%%Y-%%m-%%d') )]"
234                         help="End date is in the next month" />
235                     <separator/>
236                     <filter string="Customer Contracts" help="Contracts assigned to a customer." name="has_partner" domain="[('partner_id', '!=', False)]"/>
237                     <filter string="Contracts not assigned" help="Contracts that are not assigned to an account manager." domain="[('manager_id', '=', False)]"/>
238                     <separator/>
239                     <group expand="0" string="Group By">
240                         <filter string="Status" domain="[]" context="{'group_by':'state'}"/>
241                         <filter string="Account Manager" domain="[]" context="{'group_by':'manager_id'}"/>
242                         <filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
243                         <filter string="Parent" domain="[]" context="{'group_by':'parent_id'}"/>
244                         <filter string="Template" domain="[]" context="{'group_by':'template_id'}"/>
245                         <filter string="Start Month" domain="[]" context="{'group_by' : 'date_start'}" />
246                         <filter string="End Month" domain="[]" context="{'group_by' : 'date'}" />
247                         <filter string="Pricelist" domain="[]" context="{'group_by' : 'pricelist_id'}" />
248                     </group>
249                 </search>
250             </field>
251         </record>
252
253         <!-- Action Sales/Sales/Contracts -->
254         <record id="action_account_analytic_overdue_all" model="ir.actions.act_window">
255             <field name="name">Contracts</field>
256             <field name="res_model">account.analytic.account</field>
257             <field name="view_type">form</field>
258             <field name="view_mode">tree,form</field>
259             <field name="context">{'default_type':'contract', 'search_default_open':1, 'search_default_pending':1, 'default_manager_id':uid}</field>
260             <field name="domain">[('type','=','contract')]</field>
261             <field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
262             <field name="help" type="html">
263                 <p class="oe_view_nocontent_create">
264                     Click to create a new contract.
265                 </p><p>
266                     Use contracts to follow tasks, issues, timesheets or invoicing based on
267                     work done, expenses and/or sales orders. Odoo will automatically manage
268                     the alerts for the renewal of the contracts to the right salesperson.
269                 </p>
270             </field>
271         </record>
272         <menuitem id="base.menu_sales" name="Sales" parent="base.menu_base_partner" sequence="1"/>
273         <menuitem action="action_account_analytic_overdue_all" id="menu_action_account_analytic_overdue_all" sequence="8" parent="base.menu_sales"/>
274
275         <!-- Action Sales/Invoicing/Time and Material to Invoice -->
276         <record id="action_hr_tree_invoiced_all" model="ir.actions.act_window">
277             <field name="name">Time &amp; Materials to Invoice</field>
278             <field name="res_model">account.analytic.line</field>
279             <field name="view_type">form</field>
280             <field name="view_mode">tree,form</field>
281             <field name="domain">[('invoice_id','=',False)]</field>
282             <field name="context">{'search_default_to_invoice': 1}</field>
283             <field name="search_view_id" ref="analytic.view_account_analytic_line_filter"/>
284             <field name="help" type="html">
285               <p>
286                 You will find here timesheets and purchases you did for
287                 contracts that can be reinvoiced to the customer.  If you want
288                 to record new activities to invoice, you should use the timesheet
289                 menu instead.
290               </p>
291             </field>
292         </record>
293         <menuitem id="base.menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="5"/>
294         <menuitem action="action_hr_tree_invoiced_all" id="menu_action_hr_tree_invoiced_all" parent="base.menu_invoiced" sequence="5"/>
295
296         <!-- Action Sales/Invoicing/Contract to renew -->
297         <record id="action_account_analytic_overdue" model="ir.actions.act_window">
298             <field name="name">Contracts to Renew</field>
299             <field name="res_model">account.analytic.account</field>
300             <field name="view_type">form</field>
301             <field name="view_mode">tree,form</field>
302             <field name="context">{'search_default_manager_id':uid, 'search_default_pending':1, 'search_default_renew':1}</field>
303             <field name="domain">[('type','=','contract')]</field>
304             <field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
305             <field name="help" type="html">
306               <p class="oe_view_nocontent_create">
307                 Click to define a new contract.
308               </p><p>
309                 You will find here the contracts to be renewed because the
310                 end date is passed or the working effort is higher than the
311                 maximum authorized one.
312               </p><p>
313                 Odoo automatically sets contracts to be renewed in a pending
314                 state. After the negociation, the salesman should close or renew
315                 pending contracts.
316               </p>
317             </field>
318         </record>
319         <menuitem action="action_account_analytic_overdue" id="menu_action_account_analytic_overdue" sequence="50" parent="base.menu_invoiced"/>
320
321         <!-- Action Sales/Configuration/Contract template -->
322         <record id="template_of_contract_action" model="ir.actions.act_window">
323             <field name="name">Contract Template</field>
324             <field name="type">ir.actions.act_window</field>
325             <field name="res_model">account.analytic.account</field>
326             <field name="view_type">form</field>
327             <field name="view_mode">tree,form</field>
328             <field name="domain">[('type','=','template')]</field>
329             <field name="context">{'search_default_type':'template','default_type' : 'template'}</field>
330             <field name="help" type="html">
331                 <p class="oe_view_nocontent_create">
332                     Click here to create a template of contract.
333                 </p><p>
334                     Templates are used to prefigure contract/project that 
335                     can be selected by the salespeople to quickly configure the
336                     terms and conditions of the contract.
337                 </p>
338             </field>
339         </record>
340
341         <menuitem
342             id= "base.menu_sales_config"
343             parent= "base.menu_base_config"
344             sequence= "1"
345             name= "Sales"
346         />
347
348         <menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_sales_config" sequence="3"/>
349         
350         <record id="account_analytic_analysis_form_form" model="ir.ui.view">
351             <field name="name">account.analytic.account.invoice.form.inherit</field>
352             <field name="model">account.analytic.account</field>
353             <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
354             <field eval="20" name="priority"/>
355             <field name="arch" type="xml">
356                 <xpath expr='//div[@name="buttons"]' position='inside'>
357                     <button class="oe_inline oe_stat_button" string="Time &amp; Materials to Invoice"
358                         name="%(action_hr_tree_invoiced_all)d"
359                         type="action"
360                         context="{'search_default_account_id': [active_id], 'default_account_id': active_id}"/>
361                 </xpath>
362             </field>
363         </record>
364
365     </data>
366 </openerp>