[IMP] mark a bunch of templates as pages, mark all new pages as pages on creation
[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" version="7.0">
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 for="invoice_on_timesheets"/>
89                             </td><td class="oe_timesheet_grey">
90                                 <field name="invoice_on_timesheets" on_change="onchange_invoice_on_timesheets(invoice_on_timesheets)"/>
91                             </td><td>
92                                 <field class="oe_inline" name="hours_qtt_est" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
93                             </td><td>
94                                 <field class="oe_inline" name="timesheet_ca_invoiced" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
95                             </td><td>
96                                 <field class="oe_inline" name="remaining_hours_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
97                             </td><td>
98                                 <field class="oe_inline" name="ca_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
99                             </td><td class="oe_timesheet_action" attrs="{'invisible': ['|',('invoice_on_timesheets','=',False),('type','=','template')]}">
100                                 <span attrs="{'invisible': [('ca_to_invoice','=',0.0)]}" class="oe_grey">
101                                     <button name="hr_to_invoice_timesheets"
102                                         type="object"
103                                         class="oe_link"
104                                         string="⇒ Invoice"/>
105                                     or view 
106                                 </span>
107                                 <span attrs="{'invisible': [('ca_to_invoice','&lt;&gt;',0.0)]}" class="oe_grey">
108                                     Nothing to invoice, create 
109                                 </span>
110
111                                 <button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d"
112                                     string="Timesheets" type="action"
113                                     class="oe_link"
114                                     context="{'default_account_id': active_id,'search_default_account_id': active_id}"/>
115                             </td>
116                         </tr><tr name='total'>
117                             <th class="oe_timesheet_grey">
118                                 <label string="Total"/>
119                             </th><td class="oe_timesheet_grey">
120                             </td><td class="oe_timesheet_grey">
121                                 <field name="est_total" class="oe_inline" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
122                             </td><td class="oe_timesheet_grey">
123                                 <field name="invoiced_total" class="oe_inline"/>
124                             </td><td class="oe_timesheet_grey">
125                                 <field name="remaining_total" class="oe_inline"/>
126                             </td><td class="oe_timesheet_grey">
127                                 <field name="toinvoice_total" class="oe_inline"/>
128                             </td><td>
129                             </td>
130                         </tr>
131                     </table>
132                     <group name='invoice_on_timesheets'>
133                         <p name='invoice_on_timesheets_label' class="oe_grey oe_edit_only" colspan="2" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}">
134                             When reinvoicing costs, OpenERP uses the
135                             pricelist of the contract which uses the price
136                             defined on the product related (e.g timesheet 
137                             products are defined on each employee). 
138                         </p>
139                         <group>
140                             <field name="pricelist_id"
141                                 class="oe_inline"
142                                 attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
143                             <field name="to_invoice"
144                                 class="oe_inline"
145                                 widget="selection"
146                                 attrs="{'required': [('invoice_on_timesheets', '=', True)], 'invisible': [('invoice_on_timesheets','=',False)]}"/>
147                         </group>
148                     </group>
149                     <separator string="Recurring Invoices" attrs="{'invisible': [('recurring_invoices','!=',True)]}"/>
150                     <div>
151                         <field name="recurring_invoices" on_change="onchange_recurring_invoices(recurring_invoices, date_start)" class="oe_inline"/>
152                         <label for="recurring_invoices" />
153                         <button class="oe_link" name="recurring_create_invoice" attrs="{'invisible': [('recurring_invoices','!=',True)]}" string="⇒ create invoices" type="object" groups="base.group_no_one"/>
154                     </div>
155                     <group attrs="{'invisible': [('recurring_invoices','!=',True)]}">
156                         <label for="recurring_interval"/>
157                         <div>
158                             <field name="recurring_interval" class="oe_inline" attrs="{'required': [('recurring_invoices', '=', True)]}"/>
159                             <field name="recurring_rule_type" class="oe_inline" attrs="{'required': [('recurring_invoices', '=', True)]}"/>
160                         </div>
161                         <field name="recurring_next_date"/>
162                     </group>
163                     <label for="recurring_invoice_line_ids" attrs="{'invisible': [('recurring_invoices','=',False)]}"/>
164                     <div attrs="{'invisible': [('recurring_invoices','=',False)]}">
165                         <field name="recurring_invoice_line_ids">
166                             <tree string="Account Analytic Lines" editable="bottom">
167                                 <field name="product_id" on_change="product_id_change(product_id, uom_id, quantity, name, parent.partner_id, price_unit, parent.pricelist_id, parent.company_id)"/>
168                                 <field name="name"/>
169                                 <field name="quantity"/>
170                                 <field name="uom_id"/>
171                                 <field name="price_unit"/>
172                                 <field name="price_subtotal"/>
173                             </tree>
174                         </field>
175                     </div>
176                  </xpath>
177             </field>
178         </record>
179
180         <!-- Inherited Analytic Account form for template required -->
181         <record id="view_account_analytic_account_template_required" model="ir.ui.view">
182             <field name="name">account.analytic.account.form.template.required</field>
183             <field name="model">account.analytic.account</field>
184             <field name="groups_id" eval="[(6, 0, [ref('group_template_required')])]"/>
185             <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
186             <field name="arch" type="xml">
187                 <field name="template_id" position="attributes">
188                     <attribute name="attrs">{'required': [('type','=','contract')], 'invisible': [('type','in',['view', 'normal','template'])]}</attribute>
189                 </field>
190             </field>
191         </record>
192
193         <!-- Inherited Analytic Account list for contracts -->
194         <record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view">
195             <field name="name">account.analytic.account.list.contract</field>
196             <field name="model">account.analytic.account</field>
197             <field name="inherit_id" ref="account.view_account_analytic_account_list"/>
198             <field name="arch" type="xml">
199                 <field name="date_start" position="before">
200                     <field name="last_invoice_date"/>
201                     <field name="toinvoice_total"/>
202                     <field name="remaining_hours"/>
203                     <field name="pricelist_id" invisible="1"/>
204                 </field>
205             </field>
206         </record>
207
208         <!-- Analytic Account search view for contract -->
209         <record id="view_account_analytic_account_overdue_search" model="ir.ui.view">
210             <field name="name">account.analytic.account.search</field>
211             <field name="model">account.analytic.account</field>
212             <field name="arch" type="xml">
213                 <search string="Contracts">
214                     <field name="name" filter_domain="['|', ('name','ilike',self),('code','ilike',self)]" string="Contract"/>
215                     <field name="date"/>
216                     <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
217                     <field name="manager_id"/>
218                     <field name="parent_id"/>
219                     <filter name="open" string="In Progress" domain="[('state','in',('open','draft'))]" help="Contracts in progress (open, draft)"/>
220                     <filter name="pending" string="To Renew" domain="[('state','=','pending')]" help="Pending contracts"/>
221                     <filter name="closed" string="Closed" domain="[('state','=','close')]" help="Closed contracts"/>
222                     <filter name="cancelled" string="Cancelled" domain="[('state','=','cancel')]" help="Cancelled contracts"/>
223                     <separator/>
224                     <filter
225                         string="Expired or consumed"
226                         domain="[('state','in',('open','draft','pending')), '|', '&amp;', ('date', '!=', False), ('date', '&lt;=', time.strftime('%%Y-%%m-%%d')), ('is_overdue_quantity', '=', True)]"
227                         help="End date passed or prepaid unit consumed" />
228                     <filter
229                         string="Expiring soon"
230                         domain="[('date', '!=', False), ('date', '&lt;=', (context_today() + datetime.timedelta(30)).strftime('%%Y-%%m-%%d') )]"
231                         help="End date is in the next month" />
232                     <separator/>
233                     <filter string="Customer Contracts" help="Contracts assigned to a customer." name="has_partner" domain="[('partner_id', '!=', False)]"/>
234                     <filter string="Contracts not assigned" help="Contracts that are not assigned to an account manager." domain="[('manager_id', '=', False)]"/>
235                     <separator/>
236                     <group expand="0" string="Group By...">
237                         <filter string="Status" domain="[]" context="{'group_by':'state'}"/>
238                         <filter string="Account Manager" domain="[]" context="{'group_by':'manager_id'}"/>
239                         <filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
240                         <filter string="Parent" domain="[]" context="{'group_by':'parent_id'}"/>
241                         <filter string="Template" domain="[]" context="{'group_by':'template_id'}"/>
242                         <filter string="Start Date" domain="[]" context="{'group_by' : 'date_start'}" />
243                         <filter string="End Date" domain="[]" context="{'group_by' : 'date'}" />
244                         <filter string="Pricelist" domain="[]" context="{'group_by' : 'pricelist_id'}" />
245                     </group>
246                 </search>
247             </field>
248         </record>
249
250         <!-- Action Sales/Sales/Contracts -->
251         <record id="action_account_analytic_overdue_all" model="ir.actions.act_window">
252             <field name="name">Contracts</field>
253             <field name="res_model">account.analytic.account</field>
254             <field name="view_type">form</field>
255             <field name="view_mode">tree,form</field>
256             <field name="context">{'default_type':'contract', 'search_default_open':1, 'search_default_pending':1, 'default_manager_id':uid}</field>
257             <field name="domain">[('type','=','contract')]</field>
258             <field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
259             <field name="help" type="html">
260                 <p class="oe_view_nocontent_create">
261                     Click to create a new contract.
262                 </p><p>
263                     Use contracts to follow tasks, issues, timesheets or invoicing based on
264                     work done, expenses and/or sales orders. OpenERP will automatically manage
265                     the alerts for the renewal of the contracts to the right salesperson.
266                 </p>
267             </field>
268         </record>
269         <menuitem id="base.menu_sales" name="Sales" parent="base.menu_base_partner" sequence="1"/>
270         <menuitem action="action_account_analytic_overdue_all" id="menu_action_account_analytic_overdue_all" sequence="8" parent="base.menu_sales"/>
271
272         <!-- Action Sales/Invoicing/Time and Material to Invoice -->
273         <record id="action_hr_tree_invoiced_all" model="ir.actions.act_window">
274             <field name="name">Time &amp; Materials to Invoice</field>
275             <field name="res_model">account.analytic.line</field>
276             <field name="view_type">form</field>
277             <field name="view_mode">tree,form</field>
278             <field name="domain">[('invoice_id','=',False)]</field>
279             <field name="context">{'search_default_to_invoice': 1}</field>
280             <field name="search_view_id" ref="account.view_account_analytic_line_filter"/>
281             <field name="help" type="html">
282               <p>
283                 You will find here timesheets and purchases you did for
284                 contracts that can be reinvoiced to the customer.  If you want
285                 to record new activities to invoice, you should use the timesheet
286                 menu instead.
287               </p>
288             </field>
289         </record>
290         <menuitem id="base.menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="5"/>
291         <menuitem action="action_hr_tree_invoiced_all" id="menu_action_hr_tree_invoiced_all" parent="base.menu_invoiced" sequence="5"/>
292
293         <!-- Action Sales/Invoicing/Contract to renew -->
294         <record id="action_account_analytic_overdue" model="ir.actions.act_window">
295             <field name="name">Contracts to Renew</field>
296             <field name="res_model">account.analytic.account</field>
297             <field name="view_type">form</field>
298             <field name="view_mode">tree,form</field>
299             <field name="context">{'search_default_manager_id':uid, 'search_default_pending':1, 'search_default_renew':1}</field>
300             <field name="domain">[('type','=','contract')]</field>
301             <field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
302             <field name="help" type="html">
303               <p class="oe_view_nocontent_create">
304                 Click to define a new contract.
305               </p><p>
306                 You will find here the contracts to be renewed because the
307                 end date is passed or the working effort is higher than the
308                 maximum authorized one.
309               </p><p>
310                 OpenERP automatically sets contracts to be renewed in a pending
311                 state. After the negociation, the salesman should close or renew
312                 pending contracts.
313               </p>
314             </field>
315         </record>
316         <menuitem action="action_account_analytic_overdue" id="menu_action_account_analytic_overdue" sequence="50" parent="base.menu_invoiced"/>
317
318         <!-- Action Sales/Configuration/Contract template -->
319         <record id="template_of_contract_action" model="ir.actions.act_window">
320             <field name="name">Contract Template</field>
321             <field name="type">ir.actions.act_window</field>
322             <field name="res_model">account.analytic.account</field>
323             <field name="view_type">form</field>
324             <field name="view_mode">tree,form</field>
325             <field name="domain">[('type','=','template')]</field>
326             <field name="context">{'search_default_type':'template','default_type' : 'template'}</field>
327             <field name="help" type="html">
328                 <p class="oe_view_nocontent_create">
329                     Click here to create a template of contract.
330                 </p><p>
331                     Templates are used to prefigure contract/project that 
332                     can be selected by the salespeople to quickly configure the
333                     terms and conditions of the contract.
334                 </p>
335             </field>
336         </record>
337         <menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config"/>
338
339     </data>
340 </openerp>