[BUG-FIX] lp:689284
[odoo/odoo.git] / addons / crm / crm_opportunity_view.xml
1 <?xml version="1.0"?>
2 <openerp>
3     <data>
4     
5     <record id="crm_opportunity_stage_act" model="ir.actions.act_window">
6         <field name="name">Stages</field>
7         <field name="res_model">crm.case.stage</field>
8         <field name="view_type">form</field>
9         <field name="view_id" ref="crm.crm_case_stage_tree"/>
10         <field name="domain">[('type', '=', 'opportunity')]</field>
11         <field name="context">{'type':'opportunity'}</field>
12         <field name="help">Create specific stages that will help your sales better organise their sales pipeline by maintaining them to their sales opportunities. It will allow them to easily track how is positioned a specific opportunity in the sales cycle.</field>
13     </record>
14
15      <menuitem action="crm_opportunity_stage_act" id="menu_crm_opportunity_stage_act" name="Stages"
16         groups="base.group_extended" sequence="0"
17         parent="base.menu_crm_config_opportunity" />
18         
19         <!-- Opportunities Form View -->
20             <record model="ir.ui.view" id="crm_case_form_view_oppor">
21                 <field name="name">Opportunities</field>
22                 <field name="model">crm.lead</field>
23                 <field name="type">form</field>
24                 <field name="priority">10</field>
25                 <field name="arch" type="xml">
26                     <form string="Opportunities">
27                         <group colspan="4" col="7">
28                             <field name="name"  required="1" string="Opportunity"/>
29                             <label string="Stage:" align="1.0"/>
30                             <group colspan="1" col="4">
31                                 <field name="stage_id" nolabel="1"
32                                     on_change="onchange_stage_id(stage_id)"
33                                     domain="[('type','=','opportunity'),('section_ids', '=', section_id)]"/>
34                                 <button name="stage_previous"
35                                     states="draft,open,pending" type="object"
36                                     icon="gtk-go-back" string="" />
37                                 <button name="stage_next" states="draft,open,pending"
38                                     type="object" icon="gtk-go-forward" string="" context="{'stage_type': 'opportunity'}"/>
39                             </group>
40                             <field name="user_id"/>
41
42                             <button string="Schedule/Log Call"
43                             name="%(opportunity2phonecall_act)d" icon="terp-call-start" type="action" groups="base.group_extended"/>
44
45                             <field name="planned_revenue"/>
46                             <field name="probability"/>
47                             <field name="date_deadline"/>
48
49                             <button name="action_makeMeeting" type="object"
50                             string="Schedule Meeting" icon="gtk-redo" />
51                             <newline/>
52                             <field name="date_action"/>
53                             <field name="title_action"/>
54                             <field name="priority" string="Priority"/>
55                             <newline/>
56                             <field name="type" invisible="1"/>
57                         </group>
58                         <notebook colspan="4">
59                         <page string="Opportunity">
60                             <group col="4" colspan="2">
61                                 <separator colspan="4" string="Contacts"/>
62                                 <group colspan="2">
63                                     <field name="partner_id" select="1"
64                                         on_change="onchange_partner_id(partner_id, email_from)" string="Customer"
65                                         colspan="2" />
66                                     <button name="%(action_crm_lead2partner)d"
67                                         icon="terp-partner" type="action"
68                                         string="Create"
69                                         attrs="{'invisible':[('partner_id','!=',False)]}"/>
70                                 </group>
71                                 <field name="partner_address_id"
72                                     string="Contact"
73                                     on_change="onchange_partner_address_id(partner_address_id, email_from)"
74                                     colspan="1" />
75                                 <field name="email_from" string="Email" />
76                                 <field name="phone"/>
77                             </group>
78                             <group col="2" colspan="2">
79                                 <separator colspan="2" string="Categorization"/>
80                                 <field name="section_id" colspan="1" widget="selection"/>
81                                 <field name="categ_id" select="1"
82                                 string="Category" widget="selection"
83                                 domain="[('object_id.model', '=', 'crm.lead')]" />
84                             </group>
85
86                             <separator colspan="4" string="Details"/>
87                             <field name="description" nolabel="1" colspan="4"/>
88
89                             <separator colspan="4"/>
90                             <group col="10" colspan="4">
91                                 <field name="state"/>
92                                 <button name="case_cancel" string="Cancel"
93                                     states="draft" type="object"
94                                     icon="gtk-cancel" />
95                                 <button name="case_mark_lost" string="Mark Lost"
96                                     states="open,pending" type="object"
97                                     icon="gtk-cancel" />
98                                 <button name="case_reset" string="Reset to Draft"
99                                     states="done,cancel" type="object"
100                                     icon="gtk-convert" />
101                                 <button name="case_open" string="Open"
102                                     states="draft,pending" type="object"
103                                     icon="gtk-go-forward" />
104                                 <button name="case_pending" string="Pending"
105                                     states="draft,open" type="object"
106                                     icon="gtk-media-pause" />
107                                 <button name="case_escalate" string="Escalate"
108                                     states="open,pending" type="object"
109                                     groups="base.group_extended"
110                                     icon="gtk-go-up" />
111                                 <button name="case_close" string="Mark Won"
112                                     states="open,pending" type="object"
113                                     icon="gtk-apply" />
114                             </group>
115                         </page>
116                         <page string="Lead">
117                             <group colspan="2" col="4">
118                                 <separator string="Contact" colspan="4" col="4"/>
119                                 <field name="partner_name" string="Customer Name" colspan="4"/>
120                                 <newline/>
121                                 <field domain="[('domain', '=', 'contact')]" name="title" widget="selection"/>
122                                 <field name="function" />
123                                 <field name="street" colspan="4"/>
124                                 <field name="street2" colspan="4"/>
125                                 <field name="zip"/>
126                                 <field name="city"/>
127                                 <field name="country_id"/>
128                                 <field name="state_id"/>
129                             </group>
130                             <group colspan="2" col="2">
131                                 <separator string="Communication" colspan="2"/>
132                                 <field name="fax"/>
133                                 <field name="mobile"/>
134                             </group>
135                             <group colspan="2" col="2">
136                                 <separator string="Categorization" colspan="2"/>
137                                 <field name="type_id" widget="selection" groups="base.group_extended"/>
138                                 <field name="channel_id" widget="selection"/>
139                             </group>
140                             <group colspan="2" col="2">
141                                 <separator string="Mailings" colspan="2"/>
142                                 <field name="optin"/>
143                                 <field name="optout"/>
144                             </group>
145                         </page>
146
147                         <page string="History" groups="base.group_extended">
148                             <group colspan="4">
149                                 <field colspan="4" name="email_cc" string="Global CC" widget="char" size="512"/>
150                             </group>
151                             <field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
152                                 <tree string="History">
153                                     <field name="display_text" string="History Information"/>
154                                     <field name="history" invisible="1"/>
155                                     <button
156                                         string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
157                                         name="%(crm.action_crm_send_mail)d"
158                                         context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
159                                         icon="terp-mail-replied" type="action" />
160                                 </tree>
161                                 <form string="History">
162                                     <group col="4" colspan="4">
163                                         <field name="email_from"/>
164                                         <field name="date"/>
165                                         <field name="email_to" size="512"/>
166                                         <field name="email_cc" size="512"/>
167                                         <field name="name" colspan="4"/>
168                                         <field name="history" invisible="1"/>
169                                     </group>
170                                     <notebook colspan="4">
171                                         <page string="Details">
172                                             <group attrs="{'invisible': [('history', '!=', True)]}">
173                                                 <field name="description" colspan="4" nolabel="1" height="250"/>
174                                                 <button colspan="4"
175                                                     string="Reply"
176                                                     name="%(crm.action_crm_send_mail)d"
177                                                     context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
178                                                     icon="terp-mail-replied" type="action" />
179                                             </group>
180                                             <group attrs="{'invisible': [('history', '=', True)]}">
181                                                 <field name="display_text" colspan="4" nolabel="1"  height="250"/>
182                                             </group>
183                                         </page>
184                                         <page string="Attachments">
185                                             <field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
186                                         </page>
187                                     </notebook>
188                                 </form>
189                             </field>
190                             <button string="Add Internal Note"
191                                 name="%(crm.action_crm_add_note)d"
192                                 context="{'model': 'crm.lead' }"
193                                 icon="terp-document-new" type="action" />
194                             <button string="Send New Email"
195                                 name="%(crm.action_crm_send_mail)d"
196                                 context="{'mail':'new', 'model': 'crm.lead'}"
197                                 icon="terp-mail-message-new" type="action" />
198                         </page>
199                         <page string="Extra Info" groups="base.group_extended">
200                             <group col="2" colspan="2">
201                                 <separator string="Dates" colspan="2"/>
202                                 <field name="create_date"/>
203                                 <field name="write_date"/>
204                                 <field name="date_closed"/>
205                                 <field name="date_open"/>
206                             </group>
207                             <group col="2" colspan="2">
208                                 <separator string="Misc" colspan="2"/>
209                                 <field name="active"/>
210                                 <field name="day_open"/>
211                                 <field name="day_close"/>
212                                 <field name="referred"/>
213                             </group>
214                             <separator colspan="4" string="References"/>
215                             <field name="ref"/>
216                             <field name="ref2"/>
217                         </page>
218                         </notebook>
219                     </form>
220                 </field>
221             </record>
222
223         <!-- Opportunities Tree View -->
224
225             <record model="ir.ui.view" id="crm_case_tree_view_oppor">
226                 <field name="name">Opportunities Tree</field>
227                 <field name="model">crm.lead</field>
228                 <field name="type">tree</field>
229                 <field name="arch" type="xml">
230                     <tree string="Opportunities" colors="blue:state=='pending' and not(date_deadline and (date_deadline &lt; current_date));gray:state in ('cancel', 'done');red:date_deadline and (date_deadline &lt; current_date)">
231                         <field name="date_deadline" invisible="1"/>
232                         <field name="create_date"/>
233                         <field name="name" string="Opportunity"/>
234                         <field name="partner_id" string="Customer"/>
235                         <field name="country_id" invisible="context.get('invisible_country', True)" />
236                         <field name="date_action"/>
237                         <field name="title_action" />
238                         <field name="stage_id"/>
239                         <field name="channel_id" invisible="1"/>
240                         <field name="type_id" invisible="1"/>
241                         <button name="stage_previous" string="Previous Stage"
242                             states="open,pending" type="object" icon="gtk-go-back" />
243                         <button name="stage_next" string="Next Stage"
244                             states="open,pending" type="object"
245                             icon="gtk-go-forward" />
246                         <field name="planned_revenue" sum="Expected Revenues"/>
247                         <field name="probability" widget="progressbar" avg="Avg. of Probability"/>
248                         <field name="section_id"
249                             invisible="context.get('invisible_section', True)" />
250                         <field name="user_id"/>
251                         <field name="priority" invisible="1"/>
252                         <field name="categ_id" invisible="1"/>
253                         <field name="state"/>
254                         <button name="case_open" string="Open"
255                             states="draft,pending" type="object"
256                             icon="gtk-go-forward" />
257                         <button name="case_pending" string="Pending"
258                             states="open,draft" type="object"
259                             icon="gtk-media-pause" />
260                         <button name="case_close" string="Won"
261                             states="open,draft,pending" type="object"
262                             icon="gtk-apply" />
263                     </tree>
264                 </field>
265             </record>
266
267         <!-- Opportunities Graph View -->
268
269             <record model="ir.ui.view" id="crm_case_graph_view_opportunity">
270                 <field name="name">CRM - Opportunity Graph</field>
271                 <field name="model">crm.lead</field>
272                 <field name="type">graph</field>
273                 <field name="arch" type="xml">
274                     <graph string="Opportunity by Categories" type="bar" orientation="horizontal">
275                         <field name="categ_id"/>
276                         <field name="planned_revenue" operator="+"/>
277                         <field name="state" group="True"/>
278                     </graph>
279                 </field>
280             </record>
281
282         <!-- Opportunities Search View -->
283
284             <record id="view_crm_case_opportunities_filter" model="ir.ui.view">
285                 <field name="name">CRM - Opportunities Search</field>
286                 <field name="model">crm.lead</field>
287                 <field name="type">search</field>
288                 <field name="arch" type="xml">
289                     <search string="Search Opportunities">
290                         <filter icon="terp-check"
291                             string="Current"  help="Draft and Open Opportunities"
292                             name="current"
293                             domain="[('state','in',('draft','open'))]"/>
294                         <filter icon="terp-camera_test"
295                             string="Open"  help="Open Opportunities"
296                             domain="[('state','=','open')]"/>
297                         <filter icon="terp-gtk-media-pause"
298                             string="Pending"  help="Pending Opportunities"
299                             domain="[('state','=','pending')]"/>
300                         <separator orientation="vertical"/>
301                         <field name="name" string="Opportunity"/>
302                         <field name="partner_id" string="Customer"/>
303                         <field name="user_id">
304                             <filter icon="terp-personal-"
305                                 domain="[('user_id','=', False)]"
306                                 help="Unassigned Opportunities" />
307                         </field>
308                         <field name="section_id"
309                             context="{'invisible_section': False}"
310                             widget="selection">
311                             <filter icon="terp-personal+" groups="base.group_extended"
312                                 domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
313                                 context="{'invisible_section': False}"
314                                 help="My Sales Team(s)" />
315                             <filter icon="terp-personal+" groups="base.group_extended"
316                                 context="{'invisible_section': False}"
317                                 domain="[]"
318                                 help="Show Sales Team"/>
319                         </field>
320                         <newline/>
321                         <group  expand="0" string="Extended Filters..." groups="base.group_extended">
322                               <field name="stage_id" widget="selection" domain="[('type', '=', 'opportunity')]"/>
323                               <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
324                               <separator orientation="vertical"/>
325                               <field name="country_id" context="{'invisible_country': False}">
326                                   <filter icon="terp-personal+" context="{'invisible_country': False}" help="Show countries"/>
327                               </field>
328                               <separator orientation="vertical"/>
329                               <field name="email_from"/>
330                               <separator orientation="vertical"/>
331                               <field name="company_id" widget="selection" groups="base.group_multi_company"/>
332                               <newline/>
333                               <field name="create_date" string="Creation Date"/>
334                               <field name="date_closed"/>
335                         </group>
336                         <newline/>
337                         <group expand="0" string="Group By..." colspan="16">
338                             <filter string="Salesman" icon="terp-personal"
339                                 domain="[]" context="{'group_by':'user_id'}" />
340                             <filter string="Team" help="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
341                             <separator orientation="vertical" />
342                             <filter string="Stage" icon="terp-stage" domain="[]"
343                                 context="{'group_by':'stage_id'}" />
344                             <filter string="Priority" icon="terp-rating-rated" domain="[]"
345                                 context="{'group_by':'priority'}" />
346                             <filter string="Category" icon="terp-stock_symbol-selection"
347                                 domain="[]" context="{'group_by':'categ_id'}" />
348                             <filter string="Campaign" icon="terp-gtk-jump-to-rtl"
349                                 domain="[]" context="{'group_by':'type_id'}" groups="base.group_extended"/>
350                             <filter string="Channel" icon="terp-call-start"
351                                 domain="[]" context="{'group_by':'channel_id'}" />
352                             <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
353                             <separator orientation="vertical" />
354                             <filter string="Creation" icon="terp-go-month"
355                                 domain="[]" context="{'group_by':'create_date'}" />
356                             <filter string="Exp.Closing"
357                                 icon="terp-go-month"
358                                 help="Expected Closing" domain="[]"
359                                 context="{'group_by':'date_deadline'}" />
360                         </group>
361                     </search>
362                 </field>
363             </record>
364
365
366         <!-- Opportunities Graph View -->
367
368             <record model="ir.ui.view" id="crm_case_graph_view_opportunity">
369                 <field name="name">CRM - Opportunity Graph</field>
370                 <field name="model">crm.lead</field>
371                 <field name="type">graph</field>
372                 <field name="arch" type="xml">
373                     <graph string="Opportunity by Categories" type="bar" orientation="horizontal">
374                         <field name="categ_id"/>
375                         <field name="planned_revenue" operator="+"/>
376                         <field name="state" group="True"/>
377                     </graph>
378                 </field>
379             </record>
380
381 </data>
382 </openerp>