[MERGE] Merge with lp:openobject-adddons
[odoo/odoo.git] / addons / crm / crm_lead_view.xml
1 <?xml version="1.0"?>
2 <openerp>
3 <data>
4
5     <!-- Stage Search view -->
6     <record id="crm_lead_stage_search" model="ir.ui.view">
7         <field name="name">Stage - Search</field>
8         <field name="model">crm.case.stage</field>
9         <field name="type">search</field>
10         <field name="arch" type="xml">
11             <search string="Stage Search">
12                 <field name="name"/>
13             </search>
14         </field>
15     </record>
16
17     <!--Lead Stage Form view -->
18     <record id="crm_lead_stage_act" model="ir.actions.act_window">
19         <field name="name">Stages</field>
20         <field name="res_model">crm.case.stage</field>
21         <field name="view_type">form</field>
22         <field name="view_id" ref="crm.crm_case_stage_tree"/>
23         <field name="help">Add specific stages to leads and opportunities allowing your sales to better organise their sales pipeline. Stages will allow them to easily track how a specific lead or opportunity is positioned in the sales cycle.</field>
24     </record>
25
26      <menuitem action="crm_lead_stage_act" id="menu_crm_lead_stage_act" name="Stages"
27         groups="base.group_no_one" sequence="0"
28         parent="base.menu_crm_config_lead" />
29
30
31         <!-- Lead/Opportunity Categories Action -->
32
33         <record id="crm_lead_categ_action" model="ir.actions.act_window">
34             <field name="name">Categories</field>
35             <field name="res_model">crm.case.categ</field>
36             <field name="view_type">form</field>
37             <field name="view_id" ref="crm_case_categ_tree-view"/>
38             <field name="context" eval="{'object_id': ref('model_crm_lead')}"/>
39             <field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
40             <field name="help">Create specific categories that fit your company's activities to better classify and analyse your leads and opportunities. Such categories could for instance reflect your product structure or the different types of sales you do.</field>
41         </record>
42
43         <menuitem action="crm_lead_categ_action"
44             id="menu_crm_lead_categ" name="Categories"
45             parent="base.menu_crm_config_lead" sequence="1" groups="base.group_no_one"/>
46
47
48         <!-- CRM Lead Form View  -->
49         <record model="ir.ui.view" id="crm_case_form_view_leads">
50         <field name="name">CRM - Leads Form</field>
51         <field name="model">crm.lead</field>
52         <field name="type">form</field>
53         <field name="arch" type="xml">
54             <form string="Leads Form" layout="manual">
55                 <div class="oe_form_topbar">
56                     <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel" />
57                     <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" />
58                     <button name="case_mark_lost" string="Close" states="open,pending" type="object" icon="gtk-close" />
59                     <button name="case_pending" string="Pending" states="open" type="object" icon="gtk-media-pause" />
60                     <button name="case_escalate" string="Escalate" states="open,pending" type="object" icon="gtk-go-up" />
61                     <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" />
62                     <div class="oe_right">
63                         <field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
64                     </div>
65                 </div>
66                 <sheet layout="auto">
67                 <group colspan="4" col="7">
68                     <field name="name" required="1" string="Subject"/>
69                     <field name="priority"/>
70                     <field name="categ_id"
71                         widget="selection"
72                         domain="[('object_id.model','=','crm.lead')]"/>
73                     <button
74                          name="%(crm.action_crm_lead2opportunity_partner)d"
75                          string="Convert to Opportunity"
76                          help="Convert to Opportunity" icon="gtk-go-forward"
77                          type="action"
78                          />
79                     <newline />
80                     <field name="user_id" />
81                     <field name="section_id" widget="selection" />
82                     <field name="stage_id" domain="section_id and [('section_ids', '=', section_id)] or []" />
83                     <group col="2" colspan="1">
84                         <button name="stage_previous" string=""
85                             states="open,pending,draft" type="object"
86                             icon="gtk-go-back" context="{'stage_type': 'lead'}" />
87                         <button name="stage_next" string=""
88                             states="open,pending,draft" type="object"
89                             icon="gtk-go-forward" context="{'stage_type': 'lead'}" />
90                     </group>
91                     <field name="type" invisible="1"/>
92                 </group>
93                 <notebook colspan="4">
94                 <page string="Lead">
95                     <group colspan="4" col="2">
96                         <field name="partner_name" string="Company Name" />
97                     </group>
98                     <group colspan="2" col="4">
99                         <separator string="Contact" colspan="4" col="4"/>
100                         <field name="contact_name" colspan="4"/>
101                         <newline/>
102                         <field domain="[('domain', '=', 'contact')]" name="title" widget="selection"/>
103                         <field name="function" />
104                         <field name="street" colspan="4"/>
105                         <field name="street2" colspan="4"/>
106                         <field name="zip"/>
107                         <field name="city"/>
108                         <field name="country_id"/>
109                         <field name="state_id"/>
110                     </group>
111                     <group colspan="2" col="3">
112                         <separator string="Communication" colspan="4" col="3"/>
113                         <field name="email_from" widget="email"/>
114                         <button string="Mail"
115                             name="%(mail.action_email_compose_message_wizard)d"
116                             icon="terp-mail-message-new" type="action" colspan="1"/>
117                         <newline/>
118                         <field name="phone"/>
119                         <newline/>
120                         <field name="fax"/>
121                         <newline/>
122                         <field name="mobile"/>
123                         <newline/>
124                         <separator string="Links" colspan="4" col="3"/>
125                         <field name="partner_id" string="Customer"/>
126                         <button
127                             name="%(action_crm_lead2partner)d"
128                             icon="terp-partner" type="action"
129                             string="Create"
130                             attrs="{'invisible':[('partner_id','!=',False)]}"/>
131                     </group>
132                     <separator colspan="4" string="Notes"/>
133                     <field name="description" nolabel="1" colspan="4"/>
134                  </page>
135                  <page string="Extra Info">
136                     <group colspan="2" col="2">
137                         <separator string="Categorization" colspan="2" col="2"/>
138                         <field name="company_id"
139                             groups="base.group_multi_company"
140                             widget="selection" colspan="2" />
141                         <field name="type_id" select="1" widget="selection"/>
142                         <field name="channel_id" select="1" widget="selection"/>
143                         <field name="referred"/>
144                     </group>
145                     <group colspan="2" col="2">
146                         <separator string="Mailings" colspan="2" col="2"/>
147                         <field name="opt_in" on_change="on_change_opt_in(opt_in)"/>
148                         <field name="opt_out" on_change="on_change_opt_out(opt_out)"/>
149                     </group>
150                     <group colspan="2" col="2" groups="base.group_no_one">
151                         <separator string="Statistics" colspan="2" col="2"/>
152                         <field name="day_open"/>
153                         <field name="day_close"/>
154                     </group>
155                  </page>
156                 </notebook>
157                 </sheet>
158                 <div class="oe_form_sheet_width">
159                     <field name="message_ids" colspan="4" widget="ThreadView" nolabel="1"/>
160                 </div>
161             </form>
162         </field>
163     </record>
164
165     <!-- CRM Lead Tree View -->
166
167     <record model="ir.ui.view" id="crm_case_tree_view_leads">
168         <field name="name">Leads</field>
169         <field name="model">crm.lead</field>
170         <field name="type">tree</field>
171         <field name="arch" type="xml">
172             <tree string="Leads" fonts="bold:needaction_pending==True" colors="blue:state=='pending';grey:state in ('cancel', 'done')">
173                 <field name="needaction_pending" invisible="1"/>
174                 <field name="date_deadline" invisible="1"/>
175                 <field name="create_date" groups="base.group_no_one"/>
176                 <field name="name" string="Subject"/>
177                 <field name="contact_name"/>
178                 <field name="country_id" invisible="context.get('invisible_country', True)" />
179                 <field name="email_from"/>
180                 <field name="phone"/>
181
182                 <field name="categ_id" invisible="1"/>
183                 <field name="type_id" invisible="1"/>
184                 <field name="referred" invisible="1"/>
185                 <field name="channel_id" invisible="1"/>
186                 <field name="subjects" invisible="1"/>
187
188                 <field name="stage_id"/>
189                 <button name="stage_previous" string="Previous Stage"
190                     states="open,pending" type="object" icon="gtk-go-back" />
191                 <button name="stage_next" string="Next Stage"
192                     states="open,pending" type="object"
193                     icon="gtk-go-forward" />
194                 <field name="section_id" invisible="context.get('invisible_section', True)" />
195                 <field name="user_id" />
196                 <field name="state" />
197                 <button name="case_open" string="Open"
198                     states="draft,pending" type="object"
199                     icon="gtk-go-forward" />
200                 <button name="case_close" string="Close"
201                     states="open,draft,pending" type="object"
202                     icon="gtk-close" />
203                 <button name="%(crm.action_crm_lead2opportunity_partner)d"
204                     string="Convert to Opportunity"
205                     states="draft,open,pending" icon="gtk-index"
206                     type="action" />
207                 <button name="case_escalate" string="Escalate"
208                     states="open,draft,pending" type="object"
209                     icon="gtk-go-up" />
210             </tree>
211         </field>
212     </record>
213
214     <!-- CRM Lead Calendar View -->
215
216     <record model="ir.ui.view" id="crm_case_calendar_view_leads">
217         <field name="name">CRM - Leads Calendar</field>
218         <field name="model">crm.lead</field>
219         <field name="type">calendar</field>
220         <field name="priority" eval="2"/>
221         <field name="arch" type="xml">
222             <calendar string="Leads Generation"
223                 date_start="date_action" color="user_id">
224                 <field name="name" />
225                 <field name="partner_name" />
226             </calendar>
227         </field>
228     </record>
229
230     <!-- CRM Lead Kanban View  -->
231     <record model="ir.ui.view" id="crm_case_kanban_view_leads">
232         <field name="name">CRM - Leads Kanban</field>
233         <field name="model">crm.lead</field>
234         <field name="type">kanban</field>
235         <field name="arch" type="xml">
236             <kanban default_group_by="stage_id">
237                 <field name="state"/>
238                 <field name="color"/>
239                 <field name="priority"/>
240                 <field name="planned_revenue" sum="Expected Revenues"/>
241                 <field name="user_email"/>
242                 <field name="user_id"/>
243                 <field name="partner_address_email"/>
244                 <templates>
245                     <t t-name="lead_details">
246                         <ul class="oe_kanban_tooltip">
247                             <li t-if="record.phone.raw_value"><b>Phone:</b> <field name="phone"/></li>
248                             <li><b>Probability:</b> <field name="probability"/>%%</li>
249                             <li><b>Creation date:</b> <field name="create_date"/></li>
250                             <li t-if="record.date_deadline.raw_value"><b>Date Deadline:</b> <field name="date_deadline"/></li>
251                         </ul>
252                     </t>
253                     <t t-name="kanban-box">
254                         <t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="border">oe_kanban_color_red</t>
255                         <div t-attf-class="#{kanban_color(record.color.raw_value)} #{border || ''}">
256                             <div class="oe_kanban_box oe_kanban_color_border">
257                                 <table class="oe_kanban_table oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle">
258                                 <tr>
259                                     <td align="left" valign="middle" width="16">
260                                         <a t-if="record.priority.raw_value == 1" icon="star-on" type="object" name="set_normal_priority"/>
261                                         <a t-if="record.priority.raw_value != 1" icon="star-off" type="object" name="set_high_priority" style="opacity:0.6; filter:alpha(opacity=60);"/>
262                                     </td>
263                                     <td align="left" valign="middle" class="oe_kanban_title" tooltip="lead_details">
264                                         <field name="partner_id"/>
265                                         <t t-if="record.planned_revenue.raw_value">
266                                             - <t t-esc="Math.round(record.planned_revenue.value)"/>
267                                             <field name="company_currency"/>
268                                         </t>
269                                     </td>
270                                     <td valign="top" width="22">
271                                         <img t-att-src="kanban_image('res.users', 'avatar', record.user_id.raw_value[0])"  t-att-title="record.user_id.value"
272                                         width="22" height="22" class="oe_kanban_gravatar"/>
273                                     </td>
274                                 </tr>
275                                 </table>
276
277                                 <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger">
278                                     <div>
279                                         <b>
280                                             <a t-if="record.partner_address_email.raw_value" t-attf-href="mailto:#{record.partner_address_email.raw_value}">
281                                                 <field name="partner_address_name"/>
282                                             </a>
283                                             <field t-if="!record.partner_address_email.raw_value" name="partner_address_name"/>
284                                         </b>
285                                     </div>
286                                     <div>
287                                         <field name="name"/>
288                                     </div>
289                                     <div style="padding-left: 0.5em">
290                                         <i><field name="date_action"/><t t-if="record.date_action.raw_value"> : </t><field name="title_action"/></i>
291                                     </div>
292                                 </div>
293
294                                 <div class="oe_kanban_buttons_set oe_kanban_color_border oe_kanban_color_bglight oe_kanban_box_show_onclick">
295                                     <div class="oe_kanban_left">
296                                         <a string="Edit" icon="gtk-edit" type="edit"/>
297                                         <a string="Change Color" icon="color-picker" type="color" name="color"/>
298                                         <a string="Send New Email" name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action"/>
299                                         <a string="Log Call" name="%(opportunity2phonecall_act)d" icon="terp-call-start" type="action"/>
300                                         <a string="Schedule Meeting" name="action_makeMeeting" type="object" icon="stock_calendar"/>
301                                         <a string="Add Internal Note" name="%(crm.action_crm_add_note)d" context="{'model': 'crm.lead' }" icon="terp-document-new" type="action"/>
302                                     </div>
303                                     <div class="oe_kanban_right">
304                                         <a name="case_mark_lost" string="Mark Lost" states="open,pending" type="object" icon="kanban-stop" />
305                                         <a name="case_pending" string="Pending" states="draft,open" type="object" icon="kanban-pause" />
306                                         <a name="case_open" string="Open" states="pending" type="object" icon="gtk-media-play" />
307                                         <a name="case_mark_won" string="Mark Won" states="open,pending" type="object" icon="kanban-apply" />
308                                     </div>
309                                     <br class="oe_kanban_clear"/>
310                                 </div>
311                             </div>
312                         </div>
313                     </t>
314                 </templates>
315             </kanban>
316         </field>
317     </record>
318
319     <!-- CRM Lead Search View -->
320
321     <record id="view_crm_case_leads_filter" model="ir.ui.view">
322         <field name="name">CRM - Leads Search</field>
323         <field name="model">crm.lead</field>
324         <field name="type">search</field>
325         <field name="arch" type="xml">
326             <search string="Search Leads">
327                 <filter icon="terp-check"
328                     string="New"
329                     name="new" help="New Leads"
330                     domain="[('state','=','draft')]"/>
331                 <filter icon="terp-camera_test"
332                     string="Open"
333                     name="open"
334                     domain="[('state','=','open')]"/>
335                 <filter icon="terp-gtk-media-pause"
336                     string="Pending"
337                     name="pending"
338                     domain="[('state','=','pending')]"/>
339
340                 <separator orientation="vertical"/>
341                 <filter icon="terp-go-today" string="Today"
342                     domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')), ('create_date','&gt;=', time.strftime('%%Y-%%m-%%d 00:00:00'))]"
343                     help="Todays' Leads" />
344                 <filter icon="terp-go-week" string="7 Days"
345                     help="Leads creating during last 7 days"
346                     domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')),('create_date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d 00:00:00'))]"
347                 />
348                 <separator orientation="vertical"/>
349                 <field name="name" string="Lead / Customer"
350                     filter_domain="['|','|',('partner_name','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>
351                 <field name="user_id">
352                     <filter icon="terp-personal-"
353                         domain="[('user_id','=', False)]"
354                         help="Unassigned Leads" />
355                 </field>
356                 <field name="subjects"/>
357                 <field name="section_id" widget="selection"
358                     context="{'invisible_section': False}">
359                     <filter icon="terp-personal+"
360                         context="{'invisible_section': False}"
361                         domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
362                         help="My Sales Team(s)"/>
363                     <filter icon="terp-personal+"
364                         context="{'invisible_section': False}"
365                         domain="[]"
366                         help="Show Sales Team"/>
367                 </field>
368                 <separator orientation="vertical"/>
369                 <field name="country_id" context="{'invisible_country': False}">
370                     <filter icon="terp-personal+" context="{'invisible_country': False}" help="Show countries"/>
371                 </field>
372                 <newline/>
373                 <group expand="0" string="Group By...">
374                     <filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
375                     <filter string="Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
376                     <filter string="Referrer" icon="terp-personal" domain="[]" context="{'group_by':'referred'}"/>
377                     <separator orientation="vertical"/>
378                     <filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'categ_id'}"/>
379                     <filter string="Campaign" icon="terp-gtk-jump-to-rtl"
380                         domain="[]" context="{'group_by':'type_id'}" />
381                     <filter string="Channel" icon="terp-call-start"
382                         domain="[]" context="{'group_by':'channel_id'}" />
383                     <separator orientation="vertical"/>
384                     <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
385                     <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
386                     <separator orientation="vertical" groups="base.group_no_one"/>
387                     <filter string="Creation" help="Create date" icon="terp-go-month"
388                         domain="[]" context="{'group_by':'create_date'}" groups="base.group_no_one"/>
389                 </group>
390            </search>
391         </field>
392     </record>
393
394
395     <!-- Opportunities Form View -->
396     <record model="ir.ui.view" id="crm_case_form_view_oppor">
397         <field name="name">Opportunities</field>
398         <field name="model">crm.lead</field>
399         <field name="type">form</field>
400         <field name="priority">20</field>
401         <field name="arch" type="xml">
402             <form string="Opportunities" layout="manual">
403                 <div class="oe_form_topbar">
404                     <button name="case_cancel" string="Cancel" states="draft" type="object" icon="gtk-cancel" />
405                     <button name="case_mark_lost" string="Mark Lost" states="open,pending" type="object" icon="gtk-cancel" />
406                     <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" />
407                     <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" />
408                     <button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause" />
409                     <button name="case_escalate" string="Escalate" states="open,pending" type="object" icon="gtk-go-up" />
410                     <button name="case_mark_won" string="Mark Won" states="open,pending" type="object" icon="gtk-apply" />
411                     <div class="oe_right">
412                         <field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
413                     </div>
414                 </div>
415                 <sheet layout="auto">
416                 <group colspan="4" col="3">
417                     <field name="name" required="1" nolabel="1" class="oe_form_title" width="80%%"/>
418                     <button string="Schedule/Log Call"
419                         name="%(opportunity2phonecall_act)d" icon="terp-call-start"
420                         type="action"/>
421                     <button string="Schedule Meeting" icon="gtk-redo"
422                         name="action_makeMeeting"
423                         type="object"/>
424                 </group>
425                 <group colspan="4" col="4" class="oe_form_group_label_border" style="margin-top: 20px;">
426                     <field name="user_id"/>
427                     <field name="planned_revenue"/>
428
429                     <field name="date_action"/>
430                     <field name="date_deadline"/>
431
432                     <field name="title_action"/>
433                     <field name="probability"/>
434
435                     <field name="type" invisible="1"/>
436                 </group>
437                 <notebook colspan="4">
438                 <page string="Opportunity">
439                     <group col="4" colspan="2">
440                         <separator colspan="4" string="Contacts"/>
441                         <group colspan="2" col="3" class="oe_form_group_label_border">
442                             <field width="80%%" name="partner_id" select="1"
443                                 on_change="onchange_partner_id(partner_id, email_from)" string="Customer"/>
444                             <button name="%(action_crm_lead2partner)d"
445                                 icon="terp-partner" type="action"
446                                 string="Create"
447                                 attrs="{'invisible':[('partner_id','!=',False)]}"/>
448
449                             <field name="phone" colspan="3"/>
450
451                             <field width="80%%" name="email_from" string="Email"/>
452                             <button string="Mail"
453                                 name="%(mail.action_email_compose_message_wizard)d"
454                                 context="{'mail':'new', 'model': 'crm.lead'}"
455                                 icon="terp-mail-message-new" type="action" />
456                         </group>
457                     </group>
458                     <group col="2" colspan="2" class="oe_form_group_label_border">
459                         <separator colspan="2" string="Categorization"/>
460                         <field name="section_id" colspan="1" widget="selection"/>
461                         <field name="categ_id" select="1"
462                             string="Category" widget="selection"
463                             domain="[('object_id.model', '=', 'crm.lead')]" />
464
465                         <label string="Stage" for="stage_id" align="1.0"/>
466                         <group colspan="1" col="3">
467                             <field name="stage_id" nolabel="1"
468                                 on_change="onchange_stage_id(stage_id)"
469                                 domain="section_id and [('section_ids', '=', section_id)] or []" width="60%%"/>
470                             <button name="stage_previous"
471                                 states="draft,open,pending" type="object"
472                                 icon="gtk-go-back" string="" context="{'stage_type': 'opportunity'}"/>
473                             <button name="stage_next" states="draft,open,pending"
474                                 type="object" icon="gtk-go-forward" string="" context="{'stage_type': 'opportunity'}"/>
475                         </group>
476
477                         <field name="priority" string="Priority"/>
478                     </group>
479
480                     <separator colspan="4" string="Details"/>
481                     <field name="description" nolabel="1" colspan="4"/>
482                 </page>
483                 <page string="Lead">
484                     <separator string="Contact" colspan="4"/>
485                     <group colspan="4" col="4" class="oe_form_group_label_border">
486                         <field name="partner_name" string="Customer Name" colspan="4"/>
487                     </group>
488                     <group colspan="2" col="2" class="oe_form_group_label_border">
489                         <field domain="[('domain', '=', 'contact')]" name="title" widget="selection"/>
490                         <field name="fax"/>
491                         <field name="street"/>
492                         <field name="zip"/>
493                         <field name="country_id"/>
494                     </group>
495                     <group colspan="2" col="2" class="oe_form_group_label_border">
496                         <field name="function" />
497                         <field name="mobile"/>
498                         <field name="street2"/>
499                         <field name="city"/>
500                         <field name="state_id"/>
501                     </group>
502
503                     <group colspan="2" col="2" class="oe_form_group_label_border">
504                         <separator string="Categorization" colspan="2"/>
505                         <field name="type_id" widget="selection"/>
506                         <field name="channel_id" widget="selection"/>
507                     </group>
508                     <group colspan="2" col="2" class="oe_form_group_label_border">
509                         <separator string="Mailings" colspan="2"/>
510                         <field name="opt_in" on_change="on_change_opt_in(opt_in)"/>
511                         <field name="opt_out" on_change="on_change_opt_out(opt_out)"/>
512                     </group>
513                 </page>
514                 <page string="Extra Info">
515                     <group col="2" colspan="2" class="oe_form_group_label_border">
516                         <separator string="Misc" colspan="2"/>
517                         <field name="active"/>
518                         <field name="day_open" groups="base.group_no_one"/>
519                         <field name="day_close" groups="base.group_no_one"/>
520                         <field name="referred"/>
521                     </group>
522                     <group col="2" colspan="2" class="oe_form_group_label_border">
523                         <separator colspan="4" string="References"/>
524                         <field name="ref"/>
525                         <field name="ref2"/>
526                     </group>
527                 </page>
528                 </notebook>
529                 </sheet>
530                 <div class="oe_form_sheet_width">
531                     <field name="message_ids" colspan="4" widget="ThreadView" nolabel="1"/>
532                 </div>
533             </form>
534         </field>
535     </record>
536
537     <!-- Opportunities Tree View -->
538     <record model="ir.ui.view" id="crm_case_tree_view_oppor">
539         <field name="name">Opportunities Tree</field>
540         <field name="model">crm.lead</field>
541         <field name="type">tree</field>
542         <field name="arch" type="xml">
543             <tree string="Opportunities" fonts="bold:needaction_pending==True" 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)">
544                 <field name="needaction_pending" invisible="1"/>
545                 <field name="date_deadline" invisible="1"/>
546                 <field name="create_date" groups="base.group_no_one"/>
547                 <field name="name" string="Opportunity"/>
548                 <field name="partner_id" string="Customer"/>
549                 <field name="country_id" invisible="context.get('invisible_country', True)" />
550                 <field name="date_action"/>
551                 <field name="title_action" />
552                 <field name="channel_id" invisible="1"/>
553                 <field name="type_id" invisible="1"/>
554                 <field name="subjects" invisible="1"/>
555                 <field name="stage_id"/>
556                 <button name="stage_previous" string="Previous Stage" states="open,pending" type="object" icon="gtk-go-back" />
557                 <button name="stage_next" string="Next Stage" states="open,pending" type="object" icon="gtk-go-forward" />
558                 <field name="planned_revenue" sum="Expected Revenues"/>
559                 <field name="probability" widget="progressbar" avg="Avg. of Probability"/>
560                 <field name="section_id" invisible="context.get('invisible_section', True)" />
561                 <field name="user_id"/>
562                 <field name="priority" invisible="1"/>
563                 <field name="categ_id" invisible="1"/>
564                 <field name="state"/>
565                 <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" />
566                 <button name="case_pending" string="Pending" states="open,draft" type="object" icon="gtk-media-pause" />
567                 <button name="case_mark_lost" string="Lost" states="open,pending" type="object" icon="gtk-cancel" />
568                 <button name="case_mark_won" string="Won" states="open,pending" type="object" icon="gtk-apply" />
569             </tree>
570         </field>
571     </record>
572
573
574     <!-- Opportunities Search View -->
575     <record id="view_crm_case_opportunities_filter" model="ir.ui.view">
576         <field name="name">CRM - Opportunities Search</field>
577         <field name="model">crm.lead</field>
578         <field name="type">search</field>
579         <field name="arch" type="xml">
580             <search string="Search Opportunities">
581                 <filter icon="terp-check"
582                     string="New"  help="New Opportunities"
583                     name="new"
584                     domain="[('state','=','draft')]"/>
585                 <filter icon="terp-camera_test"
586                     string="Open"  help="Open Opportunities"
587                     name="open"
588                     domain="[('state','=','open')]"/>
589                 <filter icon="terp-gtk-media-pause"
590                     string="Pending"  help="Pending Opportunities"
591                     name="pending"
592                     domain="[('state','=','pending')]"/>
593                 <separator orientation="vertical"/>
594                 <field name="name" string="Opportunity / Customer"
595                     filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/>
596                 <field name="user_id">
597                     <filter icon="terp-personal-"
598                         domain="[('user_id','=', False)]"
599                         help="Unassigned Opportunities" />
600                 </field>
601                 <field name="section_id"
602                     context="{'invisible_section': False}"
603                     widget="selection">
604                     <filter icon="terp-personal+"
605                         domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
606                         context="{'invisible_section': False}"
607                         help="My Sales Team(s)" />
608                     <filter icon="terp-personal+"
609                         context="{'invisible_section': False}"
610                         domain="[]"
611                         help="Show Sales Team"/>
612                 </field>
613
614                 <newline/>
615                 <group expand="0" string="Group By..." colspan="16">
616                     <filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
617                     <filter string="Team" help="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
618                     <filter string="Customer" help="Partner" icon="terp-personal+" domain="[]" context="{'group_by':'partner_id'}"/>
619                     <separator orientation="vertical" />
620                     <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}" />
621                     <filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
622                     <filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'categ_id'}" />
623                     <filter string="Campaign" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'type_id'}"/>
624                     <filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}" />
625                     <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
626                     <separator orientation="vertical" />
627                     <filter string="Creation" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" groups="base.group_no_one"/>
628                     <filter string="Exp.Closing" icon="terp-go-month" help="Expected Closing" domain="[]" context="{'group_by':'date_deadline'}" />
629                 </group>
630             </search>
631         </field>
632     </record>
633
634     <!-- crm.lead Opportunities Graph View -->
635     <record model="ir.ui.view" id="crm_case_graph_view_opportunity">
636         <field name="name">CRM - Opportunity Graph</field>
637         <field name="model">crm.lead</field>
638         <field name="type">graph</field>
639         <field name="arch" type="xml">
640             <graph string="Opportunity by Categories" type="bar" orientation="horizontal">
641                 <field name="categ_id"/>
642                 <field name="planned_revenue" operator="+"/>
643                 <field name="state" group="True"/>
644             </graph>
645         </field>
646     </record>
647
648 </data>
649 </openerp>