[MERGE] Sync with trunk
[odoo/odoo.git] / addons / crm / crm_lead_view.xml
1 <?xml version="1.0"?>
2 <openerp>
3     <data>
4
5         <!--
6             CRM CASE STAGE
7         -->
8
9         <!-- Stage Search view -->
10         <record id="crm_lead_stage_search" model="ir.ui.view">
11             <field name="name">Stage - Search</field>
12             <field name="model">crm.case.stage</field>
13             <field name="arch" type="xml">
14                 <search string="Stage Search">
15                     <field name="name" string="Stage Name"/>
16                     <field name="state"/>
17                     <field name="type"/>
18                 </search>
19             </field>
20         </record>
21
22         <!-- Stage Form view -->
23         <record id="crm_lead_stage_act" model="ir.actions.act_window">
24             <field name="name">Stages</field>
25             <field name="res_model">crm.case.stage</field>
26             <field name="view_type">form</field>
27             <field name="view_id" ref="crm.crm_case_stage_tree"/>
28             <field name="help" type="html">
29               <p class="oe_view_nocontent_create">
30                 Click to set a new stage in your lead/opportunity pipeline.
31               </p><p>
32                 Stages will allow salespersons to easily track how a specific
33                 lead or opportunity is positioned in the sales cycle.
34               </p>
35             </field>
36         </record>
37
38         <menuitem action="crm_lead_stage_act" id="menu_crm_lead_stage_act" name="Stages" sequence="0" parent="base.menu_crm_config_lead" groups="base.group_no_one"/>
39
40         <!--
41             LEADS/OPPORTUNITIES CATEGORIES
42         -->
43
44         <!-- Categories Form View -->
45         <record id="crm_lead_categ_action" model="ir.actions.act_window">
46             <field name="name">Sales Tags</field>
47             <field name="res_model">crm.case.categ</field>
48             <field name="view_type">form</field>
49             <field name="view_id" ref="crm_case_categ_tree-view"/>
50             <field name="context" eval="{'object_id': ref('model_crm_lead')}"/>
51             <field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
52             <field name="help" type="html">
53               <p class="oe_view_nocontent_create">
54                 Click to define a new sales tag.
55               </p><p>
56                 Create specific tags that fit your company's activities
57                 to better classify and analyse your leads and opportunities.
58                 Such categories could for instance reflect your product
59                 structure or the different types of sales you do.
60               </p>
61             </field>
62         </record>
63
64         <menuitem action="crm_lead_categ_action"
65             id="menu_crm_lead_categ" name="Sales Tags"
66             parent="base.menu_crm_config_lead" sequence="1" groups="base.group_no_one"/>
67
68         <!--
69             LEADS
70         -->
71         <act_window
72                 id="act_crm_opportunity_crm_phonecall_new"
73                 name="Phone calls"
74                 groups="base.group_sale_salesman"
75                 res_model="crm.phonecall"
76                 view_mode="tree,calendar,form"
77                 context="{'default_duration': 1.0 ,'default_opportunity_id': active_id}"
78                 view_type="form"/>
79
80         <act_window
81                 id="act_crm_opportunity_crm_meeting_new"
82                 name="Meetings"
83                 res_model="crm.meeting"
84                 view_mode="tree,form,calendar"
85                 context="{'default_duration': 4.0, 'default_opportunity_id': active_id}"
86                 view_type="form"/>
87
88
89         <!-- CRM Lead Form View  -->
90         <record model="ir.ui.view" id="crm_case_form_view_leads">
91         <field name="name">CRM - Leads Form</field>
92         <field name="model">crm.lead</field>
93         <field name="arch" type="xml">
94             <form string="Leads Form" version="7.0">
95                 <header>
96                     <button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action"
97                             states="draft,open,pending" help="Convert to Opportunity" class="oe_highlight"/>
98                     <field name="stage_id" widget="statusbar" clickable="True"
99                             domain="['&amp;', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"
100                             on_change="onchange_stage_id(stage_id)"/>
101                 </header>
102                 <sheet>
103                     <div class="oe_right oe_button_box" name="buttons">
104                         <button string="Schedule/Log Call" 
105                                 name="%(opportunity2phonecall_act)d"
106                                 type="action"/>
107                     </div>
108                     <div class="oe_title">
109                         <label for="name" class="oe_edit_only"/>
110                         <h1><field name="name" placeholder="Describe the lead..."/></h1>
111                     </div>
112                     <group>
113                         <group>
114                             <field name="partner_name" string="Company Name"/>
115                             <!-- Preload all the partner's information -->
116                             <field name="partner_id" string="Customer"
117                                 on_change="on_change_partner_id(partner_id)"
118                                 options='{"create_name_field": "name"}'
119                                 context="{'default_name': contact_name, 'default_street': street, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_function': function, 'default_phone': phone, 'default_mobile': mobile, 'default_fax': fax, 'default_email': email_from, 'default_user_id': user_id, 'default_section_id': section_id}"/>
120                             <label for="street" string="Address"/>
121                             <div>
122                                 <field name="street" placeholder="Street..."/>
123                                 <field name="street2"/>
124                                 <div class="address_format">
125                                     <field name="city" placeholder="City" style="width: 40%%"/>
126                                     <field name="state_id" on_change="onchange_state(state_id)" options='{"no_open": True}' placeholder="State" style="width: 24%%"/>
127                                     <field name="zip" placeholder="ZIP" style="width: 34%%"/>
128                                 </div>
129                                 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>
130                             </div>
131                         </group>
132                         <group>
133                             <label for="contact_name"/>
134                             <div>
135                                 <field name="contact_name" class="oe_inline"/><span attrs="{'invisible': [('title', '=', '')]}">, </span>
136                                 <field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" class="oe_inline" options='{"no_open": True}'/>
137                             </div>
138                             <field name="email_from" widget="email"/>
139                             <field name="function"/>
140                             <field name="phone"/>
141                             <field name="mobile"/>
142                             <field name="fax"/>
143                             <!--
144                             This should be integrated in Open Chatter
145                             <button string="Mail"
146                                 name="%(mail.action_email_compose_message_wizard)d"
147                                 icon="terp-mail-message-new" type="action" colspan="1"/>
148                             -->
149                         </group>
150                         <group>
151                             <field name="user_id" on_change="on_change_user(user_id, context)"
152                                 context="{'default_groups_ref': ['base.group_user', 'base.group_sale_salesman_all_leads'] }"/>
153                             <label for="section_id" groups="base.group_multi_salesteams"/>
154                             <div groups="base.group_multi_salesteams">
155                                 <field name="section_id"/>
156                                 <button name="case_escalate" string="Escalate"
157                                         type="object" class="oe_link"
158                                         attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/>
159                             </div>
160                             <field name="type" invisible="1"/>
161                         </group>
162                         <group>
163                             <field name="priority"/>
164                             <field name="categ_ids"
165                                 widget="many2many_tags"
166                                 domain="[('object_id.model','=','crm.lead')]"
167                                 context="{'object_name': 'crm.lead'}"
168                             />
169                         </group>
170                     </group>
171                     <notebook colspan="4">
172                     <page string="Internal Notes">
173                         <field name="description"/>
174                     </page>
175                     <page string="Extra Info">
176                         <group>
177                             <group string="Categorization" groups="base.group_multi_company,base.group_no_one" name="categorization">
178                                 <field name="company_id"
179                                     groups="base.group_multi_company"
180                                     widget="selection" colspan="2"/>
181                                 <field name="state" groups="base.group_no_one"/>
182                             </group>
183                             <group string="Mailings">
184                                 <field name="opt_out"/>
185                                 <field name="message_bounce"/>
186                             </group>
187                             <group string="Misc">
188                                 <field name="active"/>
189                                 <field name="referred"/>
190                             </group>
191                         </group>
192                     </page>
193                     </notebook>
194                 </sheet>
195                 <div class="oe_chatter">
196                     <field name="message_follower_ids" widget="mail_followers"/>
197                     <field name="message_ids" widget="mail_thread"/>
198                 </div>
199             </form>
200         </field>
201         </record>
202
203         <!-- CRM Lead Graph View -->
204         <record model="ir.ui.view" id="crm_case_graph_view_leads">
205             <field name="name">Opportunities</field>
206             <field name="model">crm.lead</field>
207             <field name="arch" type="xml">
208                 <graph string="Opportunities" type="bar">
209                     <field name="stage_id"/>
210                     <field name="planned_revenue" operator="+"/>
211                 </graph>
212             </field>
213         </record>
214
215         <!-- CRM Lead Tree View -->
216         <record model="ir.ui.view" id="crm_case_tree_view_leads">
217             <field name="name">Leads</field>
218             <field name="model">crm.lead</field>
219             <field name="arch" type="xml">
220                 <tree string="Leads" fonts="bold:message_unread==True" colors="grey:state in ('cancel', 'done')">
221                     <field name="date_deadline" invisible="1"/>
222                     <field name="create_date"/>
223                     <field name="name"/>
224                     <field name="contact_name"/>
225                     <field name="country_id" invisible="context.get('invisible_country', True)"/>
226                     <field name="email_from"/>
227                     <field name="phone"/>
228                     <field name="stage_id"/>
229                     <field name="user_id" invisible="1"/>
230                     <field name="partner_id" invisible="1"/>
231                     <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/>
232                     <field name="state" invisible="1"/>
233                     <field name="type_id" invisible="1"/>
234                     <field name="referred" invisible="1"/>
235                     <field name="channel_id" invisible="1"/>
236                     <field name="message_unread" invisible="1"/>
237                 </tree>
238             </field>
239         </record>
240
241
242         <!-- CRM Lead Calendar View -->
243         <record model="ir.ui.view" id="crm_case_calendar_view_leads">
244             <field name="name">CRM - Leads Calendar</field>
245             <field name="model">crm.lead</field>
246             <field name="priority" eval="2"/>
247             <field name="arch" type="xml">
248                 <calendar string="Leads Generation"
249                     date_start="date_action" color="user_id">
250                     <field name="name"/>
251                     <field name="partner_name"/>
252                 </calendar>
253             </field>
254         </record>
255
256         <!-- CRM Lead Kanban View  -->
257         <record model="ir.ui.view" id="crm_case_kanban_view_leads">
258             <field name="name">CRM - Leads Kanban</field>
259             <field name="model">crm.lead</field>
260             <field name="arch" type="xml">
261                 <kanban default_group_by="stage_id">
262                     <field name="state" groups="base.group_no_one"/>
263                     <field name="stage_id"/>
264                     <field name="color"/>
265                     <field name="priority"/>
266                     <field name="planned_revenue" sum="Expected Revenues"/>
267                     <field name="user_email"/>
268                     <field name="user_id"/>
269                     <field name="partner_address_email"/>
270                     <field name="message_summary"/>
271                     <field name="message_unread"/>
272                     <templates>
273                         <field name="date_deadline"/>
274                         <t t-name="kanban-box">
275                             <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
276                                 <div class="oe_dropdown_toggle oe_dropdown_kanban">
277                                     <span class="oe_e">í</span>
278                                     <ul class="oe_dropdown_menu">
279                                         <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
280                                         <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
281                                         <li><a name="%(mail.action_email_compose_message_wizard)d" type="action">Send Email</a></li>
282                                         <li><a name="%(opportunity2phonecall_act)d" type="action">Schedule/Log Call</a></li>
283                                         <li><a name="action_makeMeeting" type="object">Schedule Meeting</a></li>
284                                         <li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
285                                     </ul>
286                                 </div>
287                                 <div class="oe_kanban_content">
288                                     <div>
289                                         <b><field name="name"/></b>
290                                         <t t-if="record.planned_revenue.raw_value">
291                                             - <b><t t-esc="record.planned_revenue.value"/>
292                                             <field name="company_currency"/></b>
293                                         </t>
294                                     </div>
295                                     <div>
296                                         <field name="partner_id"/>
297                                     </div>
298                                     <div style="padding-left: 0.5em">
299                                         <t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
300                                         <span t-attf-class="#{red || ''}"><field name="date_action"/></span>
301                                         <t t-if="record.date_action.raw_value"> : </t>
302                                         <field name="title_action"/>
303                                     </div>
304                                     <div class="oe_kanban_bottom_right">
305                                         <a t-if="record.priority.raw_value == 1" type="object" name="set_normal_priority" class="oe_e oe_star_on">7</a>
306                                         <a t-if="record.priority.raw_value != 1" type="object" name="set_high_priority" class="oe_e oe_star_off">7</a>
307                                         <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar" t-if="record.user_id.value"/>
308                                     </div>
309                                     <div class="oe_kanban_footer_left">
310                                         <t t-raw="record.message_summary.raw_value"/>
311                                     </div>
312                                 </div>
313                                 <div class="oe_clear"></div>
314                             </div>
315                         </t>
316                     </templates>
317                 </kanban>
318             </field>
319         </record>
320
321         <!-- CRM Lead Search View -->
322         <record id="view_crm_case_leads_filter" model="ir.ui.view">
323             <field name="name">CRM - Leads Search</field>
324             <field name="model">crm.lead</field>
325             <field name="arch" type="xml">
326                 <search string="Search Leads">
327                     <field name="name" string="Lead / Customer" filter_domain="['|','|',('partner_name','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>
328                     <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]"/>
329                     <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/>
330                     <field name="user_id"/>
331                     <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
332                     <field name="create_date"/>
333                     <field name="country_id" context="{'invisible_country': False}"/>
334                     <separator/>
335                     <filter string="Open" name="open" domain="[('state','!=','cancel')]" help="Open Leads"/>
336                     <filter string="Dead" name="dead" domain="[('state','=','cancel')]"/>
337                     <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/>
338                     <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/>
339                     <filter string="Assigned to Me"
340                             domain="[('user_id','=',uid)]" context="{'invisible_section': False}"
341                             help="Leads that are assigned to me"/>
342                     <filter string="Assigned to My Team(s)"
343                             domain="[('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}"
344                             help="Leads that are assigned to any sales teams I am member of" groups="base.group_multi_salesteams"/>
345                     <separator />
346                     <filter string="Available for mass mailing"
347                             name='not_opt_out' domain="[('opt_out', '=', False)]"
348                             help="Leads that did not ask not to be included in mass mailing campaigns"/>
349                     <separator />
350                     <group expand="0" string="Group By...">
351                         <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/>
352                         <filter string="Team" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/>
353                         <filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
354                         <filter string="Customer" help="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
355                         <filter string="Country" domain="[]" context="{'group_by':'country_id'}"/>
356                         <filter string="Referrer" domain="[]" context="{'group_by':'referred'}"/>
357                         <filter string="Campaign" domain="[]" context="{'group_by':'type_id'}"/>
358                         <filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
359                         <filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
360                     </group>
361                     <group string="Display">
362                         <filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/>
363                         <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/>
364                     </group>
365                 </search>
366             </field>
367         </record>
368
369
370         <!--
371             OPPORTUNITY
372         -->
373
374         <!-- Opportunities Form View -->
375         <record model="ir.ui.view" id="crm_case_form_view_oppor">
376             <field name="name">Opportunities</field>
377             <field name="model">crm.lead</field>
378             <field name="priority">20</field>
379             <field name="arch" type="xml">
380                 <form string="Opportunities" version="7.0">
381                     <header>
382                         <button name="case_mark_won" string="Mark Won" type="object"
383                                 states="draft,open,pending" class="oe_highlight"/>
384                         <button name="case_mark_lost" string="Mark Lost" type="object"
385                                 states="draft,open" class="oe_highlight"/>
386                         <field name="stage_id" widget="statusbar" clickable="True"/>
387                     </header>
388                     <sheet>
389                         <div class="oe_right oe_button_box">
390                             <button string="Schedule/Log Call"
391                                 name="%(opportunity2phonecall_act)d"
392                                 type="action"/>
393                             <button string="Meeting"
394                                 name="action_makeMeeting"
395                                 type="object"
396                                 context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
397                         </div>
398                         <div class="oe_title">
399                             <label for="name" class="oe_edit_only"/>
400                             <h1><field name="name"/></h1>
401                             <label for="planned_revenue" class="oe_edit_only"/>
402                             <h2>
403                                 <field name="company_currency" invisible="1"/>
404                                 <field name="planned_revenue" class="oe_inline" widget='monetary' options="{'currency_field': 'company_currency'}"/>
405                                 <span class="oe_grey"> at </span>
406                                 <field name="probability" class="oe_inline" widget="integer"/>%%
407                             </h2>
408                         </div>
409                         <group>
410                             <group>
411                                 <field name="partner_id"
412                                     on_change="on_change_partner_id(partner_id)"
413                                     string="Customer"
414                                     context="{'default_name': partner_name, 'default_email': email_from, 'default_phone': phone}"/>
415                                 <field name="email_from" string="Email"/>
416                                 <field name="phone"/>
417                             </group>
418
419                             <group>
420                                 <label for="title_action"/>
421                                 <div>
422                                     <field name="date_action" nolabel="1"/> <label string="-" attrs="{'invisible': ['|', ('date_action', '=', False), ('title_action', '=', False)]}"/>
423                                     <field name="title_action" class="oe_inline" nolabel="1" placeholder="e.g. Call for proposal"/>
424                                 </div>
425                                 <field name="date_deadline"/>
426                                 <field name="priority"/>
427                             </group>
428
429                             <group>
430                                 <field name="user_id" on_change="on_change_user(user_id, context)" context="{'default_groups_ref': ['base.group_user', 'base.group_sale_salesman_all_leads']}"/>
431                                 <label for="section_id" groups="base.group_multi_salesteams"/>
432                                 <div groups="base.group_multi_salesteams">
433                                     <field name="section_id" widget="selection"/>
434                                     <button name="case_escalate" string="Escalate" type="object" class="oe_link" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/>
435                                 </div>
436                             </group>
437                             <group>
438                                 <field name="categ_ids"
439                                     string="Categories" widget="many2many_tags"
440                                     context="{'object_name': 'crm.lead'}"
441                                     domain="[('object_id.model', '=', 'crm.lead')]"/>
442
443                             </group>
444                         </group>
445
446                         <notebook colspan="4">
447                         <page string="Internal Notes">
448                             <field name="description"/>
449                         </page>
450                         <page string="Lead">
451                             <group>
452                                 <group>
453                                     <field name="partner_name"/>
454                                     <label for="street" string="Address"/>
455                                     <div>
456                                         <field name="street" placeholder="Street..."/>
457                                         <field name="street2"/>
458                                         <div class="address_format">
459                                             <field name="city" placeholder="City" style="width: 40%%"/>
460                                             <field name="state_id" options='{"no_open": True}' on_change="onchange_state(state_id)" placeholder="State" style="width: 24%%"/>
461                                             <field name="zip" placeholder="ZIP" style="width: 34%%"/>
462                                         </div>
463                                         <field name="country_id" placeholder="Country" options='{"no_open": True}'/>
464                                     </div>
465                                 </group>
466
467                                 <group>
468                                     <label for="contact_name"/>
469                                     <div>
470                                         <field name="contact_name" class="oe_inline"/>
471                                         <field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" options='{"no_open": True}' class="oe_inline"/>
472                                     </div>
473                                     <field name="function"/>
474                                     <field name="mobile"/>
475                                     <field name="fax"/>
476                                 </group>
477                                 <group string="Mailings" name="mailings">
478                                     <field name="opt_out"/>
479                                 </group>
480                                 <group string="Misc">
481                                     <field name="active"/>
482                                     <field name="day_open" groups="base.group_no_one"/>
483                                     <field name="day_close" groups="base.group_no_one"/>
484                                     <field name="referred"/>
485                                     <field name="state" invisible="1"/>
486                                     <field name="type" invisible="1"/>
487                                 </group>
488                                 <group string="References">
489                                     <field name="ref"/>
490                                     <field name="ref2"/>
491                                 </group>
492                             </group>
493                         </page>
494                         <page string="Fund Raising" groups="crm.group_fund_raising">
495                             <group>
496                                 <field name="payment_mode" widget="selection"/>
497                                 <field name="planned_cost"/>
498                             </group>
499                         </page>
500                         </notebook>
501                     </sheet>
502                     <div class="oe_chatter">
503                         <field name="message_follower_ids" widget="mail_followers"/>
504                         <field name="message_ids" widget="mail_thread"/>
505                     </div>
506                 </form>
507             </field>
508         </record>
509
510         <!-- Opportunities Tree View -->
511         <record model="ir.ui.view" id="crm_case_tree_view_oppor">
512             <field name="name">Opportunities Tree</field>
513             <field name="model">crm.lead</field>
514             <field name="arch" type="xml">
515                 <tree string="Opportunities" fonts="bold:message_unread==True" colors="gray:state in ('cancel', 'done');red:date_deadline and (date_deadline &lt; current_date)">
516                     <field name="date_deadline" invisible="1"/>
517                     <field name="create_date"/>
518                     <field name="name" string="Opportunity"/>
519                     <field name="partner_id" string="Customer"/>
520                     <field name="country_id" invisible="context.get('invisible_country', True)"/>
521                     <field name="date_action"/>
522                     <field name="title_action"/>
523                     <field name="channel_id" invisible="1"/>
524                     <field name="type_id" invisible="1"/>
525                     <field name="stage_id"/>
526                     <field name="planned_revenue" sum="Expected Revenues"/>
527                     <field name="probability" avg="Avg. of Probability"/>
528                     <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/>
529                     <field name="user_id"/>
530                     <field name="referred" invisible="1"/>
531                     <field name="priority" invisible="1"/>
532                     <field name="message_unread" invisible="1"/>
533                     <field name="state" invisible="1"/>
534                 </tree>
535             </field>
536         </record>
537
538
539         <!-- Opportunities Search View -->
540         <record id="view_crm_case_opportunities_filter" model="ir.ui.view">
541             <field name="name">CRM - Opportunities Search</field>
542             <field name="model">crm.lead</field>
543             <field name="arch" type="xml">
544                 <search string="Search Opportunities">
545                     <field name="name" string="Opportunity" filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/>
546                     <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>
547                     <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/>
548                     <field name="user_id"/>
549                     <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
550                     <separator/>
551                     <filter string="New" name="new" domain="[('state','=','draft')]" help="New Opportunities"/>
552                     <filter string="In Progress" name="open" domain="[('state','=','open')]" help="Open Opportunities"/>
553                     <filter string="Won" name="won" domain="[('state','=','done')]"/>
554                     <filter string="Lost" name="lost" domain="[('state','=','cancel')]"/>
555                     <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/>
556                     <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/>
557                     <filter string="My Opportunities" name="assigned_to_me"
558                             domain="[('user_id','=',uid)]" context="{'invisible_section': False}"
559                             help="Opportunities that are assigned to me"/>
560                     <filter string="Assigned to My Team(s)"
561                             domain="[('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}"
562                             help="Opportunities that are assigned to any sales teams I am member of"/>
563                     <separator/>
564                     <group expand="0" string="Group By..." colspan="16">
565                         <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/>
566                         <filter string="Team" domain="[]" context="{'group_by':'section_id'}"/>
567                         <filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
568                         <filter string="Customer" help="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
569                         <filter string="Country" domain="[]" context="{'group_by':'country_id'}"/>
570                         <filter string="Priority" domain="[]" context="{'group_by':'priority'}"/>
571                         <filter string="Expected Closing" domain="[]" context="{'group_by':'date_deadline'}"/>
572                         <filter string="Referrer" domain="[]" context="{'group_by':'referred'}"/>
573                         <filter string="Campaign" domain="[]" context="{'group_by':'type_id'}"/>
574                         <filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
575                         <filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
576                     </group>
577                     <group string="Display">
578                         <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/>
579                         <filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/>
580                     </group>
581                 </search>
582             </field>
583         </record>
584
585         <!--
586             MASS MAILING
587         -->
588         <act_window name="Lead/Opportunity Mass Mail"
589                 res_model="mail.compose.message"
590                 src_model="crm.lead"
591                 view_mode="form"
592                 multi="True"
593                 target="new"
594                 key2="client_action_multi"
595                 id="crm.action_lead_mass_mail"
596                 context="{
597                             'default_composition_mode': 'mass_mail',
598                             'default_email_to':'{$object.email or \'\'}',
599                             'default_use_template': True,
600                             'default_template_id': ref('crm.email_template_opportunity_mail'),
601                         }"
602                 groups="base.group_sale_salesman"
603                 />
604
605         <!--Update of email_template defined in crm_lead_data, to add ref_ir_act_window
606             allowing to have a well formed email template (context action considered as set). -->
607         <record id="email_template_opportunity_mail" model="email.template">
608             <field name="ref_ir_act_window" ref="crm.action_lead_mass_mail"/>
609         </record>
610
611         <record id="action_mark_as_lost" model="ir.actions.server">
612             <field name="name">Mark As Lost</field>
613             <field name="model_id" ref="model_crm_lead"/>
614             <field name="state">code</field>
615             <field name="code">
616                 if context.get('active_model') == 'crm.lead' and context.get('active_ids'):
617                     self.case_mark_lost(cr, uid, context['active_ids'], context=context)
618             </field>
619             <field name="groups_id" eval="[(4,ref('base.group_sale_salesman'))]"/>
620         </record>
621
622         <record id="ir_mark_as_lost" model="ir.values">
623             <field eval="'client_action_multi'" name="key2"/>
624             <field eval="'crm.lead'" name="model"/>
625             <field name="name">Mark As Lost</field>
626             <field eval="'ir.actions.server,%d'%action_mark_as_lost" name="value"/>
627         </record>
628
629     </data>
630 </openerp>