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