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