[REF] Rename model crm.meeting into calendar.event
[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"/>
16                     <field name="type"/>
17                     <field name="sequence"/>
18                     <field name="probability"/>
19                 </search>
20             </field>
21         </record>
22
23         <!-- Stage Form view -->
24         <record id="crm_lead_stage_act" model="ir.actions.act_window">
25             <field name="name">Stages</field>
26             <field name="res_model">crm.case.stage</field>
27             <field name="view_type">form</field>
28             <field name="view_id" ref="crm.crm_case_stage_tree"/>
29             <field name="help" type="html">
30               <p class="oe_view_nocontent_create">
31                 Click to set a new stage in your lead/opportunity pipeline.
32               </p><p>
33                 Stages will allow salespersons to easily track how a specific
34                 lead or opportunity is positioned in the sales cycle.
35               </p>
36             </field>
37         </record>
38
39         <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"/>
40
41         <!--
42             LEADS/OPPORTUNITIES CATEGORIES
43         -->
44
45         <!-- Categories Form View -->
46         <record id="crm_lead_categ_action" model="ir.actions.act_window">
47             <field name="name">Sales Tags</field>
48             <field name="res_model">crm.case.categ</field>
49             <field name="view_type">form</field>
50             <field name="view_id" ref="crm_case_categ_tree-view"/>
51             <field name="context" eval="{'object_id': ref('model_crm_lead')}"/>
52             <field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
53             <field name="help" type="html">
54               <p class="oe_view_nocontent_create">
55                 Click to define a new sales tag.
56               </p><p>
57                 Create specific tags that fit your company's activities
58                 to better classify and analyse your leads and opportunities.
59                 Such categories could for instance reflect your product
60                 structure or the different types of sales you do.
61               </p>
62             </field>
63         </record>
64
65         <menuitem action="crm_lead_categ_action"
66             id="menu_crm_lead_categ" name="Sales Tags"
67             parent="base.menu_crm_config_lead" sequence="1" groups="base.group_no_one"/>
68
69         <!--
70             LEADS
71         -->
72         <act_window
73                 id="act_crm_opportunity_crm_phonecall_new"
74                 name="Phone calls"
75                 groups="base.group_sale_salesman"
76                 res_model="crm.phonecall"
77                 view_mode="tree,calendar,form"
78                 context="{'default_duration': 1.0 ,'default_opportunity_id': active_id}"
79                 view_type="form"/>
80
81         <act_window
82                 id="act_crm_opportunity_calendar_event_new"
83                 name="Meetings"
84                 res_model="calendar.event"
85                 view_mode="tree,form,calendar"
86                 context="{'default_duration': 4.0, 'default_opportunity_id': active_id}"
87                 view_type="form"/>
88
89
90         <!-- CRM Lead Form View  -->
91         <record model="ir.ui.view" id="crm_case_form_view_leads">
92         <field name="name">CRM - Leads Form</field>
93         <field name="model">crm.lead</field>
94         <field name="arch" type="xml">
95             <form string="Leads Form" version="7.0">
96                 <header>
97                     <button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action"
98                             attrs="{'invisible': [('probability', '=', 100)]}"
99                             help="Convert to Opportunity" class="oe_highlight"/>
100                     <field name="stage_id" widget="statusbar" clickable="True"
101                             domain="['&amp;', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"
102                             options="{'fold_field': 'fold'}"
103                             on_change="onchange_stage_id(stage_id)"/>
104                 </header>
105                 <sheet>
106                     <div class="oe_right oe_button_box" name="buttons">
107                         <button string="Schedule/Log Call" 
108                                 name="%(opportunity2phonecall_act)d"
109                                 type="action"/>
110                     </div>
111                     <div class="oe_title">
112                         <label for="name" class="oe_edit_only"/>
113                         <h1><field name="name" placeholder="Describe the lead..."/></h1>
114                     </div>
115                     <group>
116                         <group>
117                             <field name="partner_name" string="Company Name"/>
118                             <!-- Preload all the partner's information -->
119                             <field name="partner_id" string="Customer"
120                                 on_change="on_change_partner_id(partner_id)"
121                                 options='{"create_name_field": "name"}'
122                                 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}"/>
123                             <label for="street" string="Address"/>
124                             <div>
125                                 <field name="street" placeholder="Street..."/>
126                                 <field name="street2"/>
127                                 <div class="address_format">
128                                     <field name="city" placeholder="City" style="width: 40%%"/>
129                                     <field name="state_id" on_change="onchange_state(state_id)" options='{"no_open": True}' placeholder="State" style="width: 24%%"/>
130                                     <field name="zip" placeholder="ZIP" style="width: 34%%"/>
131                                 </div>
132                                 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>
133                             </div>
134                         </group>
135                         <group>
136                             <label for="contact_name"/>
137                             <div>
138                                 <field name="contact_name" class="oe_inline"/><span attrs="{'invisible': [('title', '=', '')]}">, </span>
139                                 <field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" class="oe_inline" options='{"no_open": True}'/>
140                             </div>
141                             <field name="email_from" widget="email"/>
142                             <field name="function"/>
143                             <field name="phone"/>
144                             <field name="mobile"/>
145                             <field name="fax"/>
146                         </group>
147                         <group>
148                             <field name="user_id" on_change="on_change_user(user_id, context)"
149                                 context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads'] }"/>
150                             <label for="section_id" groups="base.group_multi_salesteams"/>
151                             <div groups="base.group_multi_salesteams">
152                                 <field name="section_id"/>
153                                 <button name="case_escalate" string="Escalate"
154                                         type="object" class="oe_link"
155                                         attrs="{'invisible': ['|', ('section_id','=',False), ('probability', '=', 100)]}"/>
156                             </div>
157                             <field name="type" invisible="1"/>
158                         </group>
159                         <group>
160                             <field name="priority"/>
161                             <field name="categ_ids"
162                                 widget="many2many_tags"
163                                 domain="[('object_id.model','=','crm.lead')]"
164                                 context="{'object_name': 'crm.lead'}"
165                             />
166                         </group>
167                     </group>
168                     <notebook colspan="4">
169                     <page string="Internal Notes">
170                         <field name="description"/>
171                     </page>
172                     <page string="Extra Info">
173                         <group>
174                             <group string="Categorization" groups="base.group_multi_company,base.group_no_one" name="categorization">
175                                 <field name="company_id"
176                                     groups="base.group_multi_company"
177                                     widget="selection"/>
178                             </group>
179                             <group string="Mailings">
180                                 <field name="opt_out"/>
181                                 <field name="message_bounce"/>
182                             </group>
183                             <group string="Misc">
184                                 <field name="probability" groups="base.group_no_one"/>
185                                 <field name="active"/>
186                                 <field name="referred"/>
187                             </group>
188                             <group>
189                                 <field name="date_open" groups="base.group_no_one"/>
190                                 <field name="date_closed" groups="base.group_no_one"/>
191                             </group>
192                         </group>
193                     </page>
194                     </notebook>
195                 </sheet>
196                 <div class="oe_chatter">
197                     <field name="message_follower_ids" widget="mail_followers"/>
198                     <field name="message_ids" widget="mail_thread"/>
199                 </div>
200             </form>
201         </field>
202         </record>
203
204         <!-- CRM Lead Graph View -->
205         <record model="ir.ui.view" id="crm_case_graph_view_leads">
206             <field name="name">Opportunities</field>
207             <field name="model">crm.lead</field>
208             <field name="arch" type="xml">
209                 <graph string="Opportunities" type="bar">
210                     <field name="stage_id"/>
211                     <field name="planned_revenue" operator="+"/>
212                 </graph>
213             </field>
214         </record>
215
216         <!-- CRM Lead Tree View -->
217         <record model="ir.ui.view" id="crm_case_tree_view_leads">
218             <field name="name">Leads</field>
219             <field name="model">crm.lead</field>
220             <field name="arch" type="xml">
221                 <tree string="Leads" fonts="bold:message_unread==True" colors="grey:probability == 100">
222                     <field name="date_deadline" invisible="1"/>
223                     <field name="create_date"/>
224                     <field name="name"/>
225                     <field name="contact_name"/>
226                     <field name="country_id" invisible="context.get('invisible_country', True)"/>
227                     <field name="email_from"/>
228                     <field name="phone"/>
229                     <field name="stage_id"/>
230                     <field name="user_id" invisible="1"/>
231                     <field name="partner_id" invisible="1"/>
232                     <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/>
233                     <field name="probability" invisible="1"/>
234                     <field name="type_id" invisible="1"/>
235                     <field name="referred" invisible="1"/>
236                     <field name="channel_id" invisible="1"/>
237                     <field name="message_unread" invisible="1"/>
238                 </tree>
239             </field>
240         </record>
241
242
243         <!-- CRM Lead Calendar View -->
244         <record model="ir.ui.view" id="crm_case_calendar_view_leads">
245             <field name="name">CRM - Leads Calendar</field>
246             <field name="model">crm.lead</field>
247             <field name="priority" eval="2"/>
248             <field name="arch" type="xml">
249                 <calendar string="Leads Generation"
250                     date_start="date_action" color="user_id">
251                     <field name="name"/>
252                     <field name="partner_name"/>
253                 </calendar>
254             </field>
255         </record>
256
257         <!-- CRM Lead Kanban View  -->
258         <record model="ir.ui.view" id="crm_case_kanban_view_leads">
259             <field name="name">CRM - Leads Kanban</field>
260             <field name="model">crm.lead</field>
261             <field name="arch" type="xml">
262                 <kanban default_group_by="stage_id">
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),('contact_name','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="Unassigned" name="unassigned"
336                             domain="[('user_id','=', False)]"
337                             help="No salesperson"/>
338                     <filter string="My Leads"
339                             domain="[('user_id','=',uid)]" context="{'invisible_section': False}"
340                             help="Leads that are assigned to me"/>
341                     <filter string="My Team(s)" groups="base.group_multi_salesteams"
342                             domain="[('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}"
343                             help="Leads that are assigned to any sales teams I am member of"/>
344                     <filter string="Dead" name="dead"
345                             domain="[('probability', '=', '0'), ('stage_id.fold', '=', True)]"/>
346                     <separator />
347                     <filter string="Available for mass mailing"
348                             name='not_opt_out' domain="[('opt_out', '=', False)]"
349                             help="Leads that did not ask not to be included in mass mailing campaigns"/>
350                     <separator />
351                     <group expand="0" string="Group By...">
352                         <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/>
353                         <filter string="Team" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/>
354                         <filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
355                         <filter string="Customer" help="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
356                         <filter string="Country" domain="[]" context="{'group_by':'country_id'}"/>
357                         <filter string="Referrer" domain="[]" context="{'group_by':'referred'}"/>
358                         <filter string="Campaign" domain="[]" context="{'group_by':'type_id'}"/>
359                         <filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
360                         <filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
361                     </group>
362                     <group string="Display">
363                         <filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/>
364                         <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/>
365                     </group>
366                 </search>
367             </field>
368         </record>
369
370
371         <!--
372             OPPORTUNITY
373         -->
374
375         <!-- Opportunities Form View -->
376         <record model="ir.ui.view" id="crm_case_form_view_oppor">
377             <field name="name">Opportunities</field>
378             <field name="model">crm.lead</field>
379             <field name="priority">20</field>
380             <field name="arch" type="xml">
381                 <form string="Opportunities" version="7.0">
382                     <header>
383                         <button name="case_mark_won" string="Mark Won" type="object" class="oe_highlight"/>
384                         <button name="case_mark_lost" string="Mark Lost" type="object" class="oe_highlight"/>
385                         <field name="stage_id" widget="statusbar" clickable="True"
386                             options="{'fold_field': 'fold'}"
387                             domain="['&amp;', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"/>
388                     </header>
389                     <sheet>
390                         <div class="oe_right oe_button_box">
391                             <button string="Schedule/Log Call" type="action"
392                                 name="%(opportunity2phonecall_act)d"/>
393                             <button string="Meeting" type="object"
394                                 name="action_makeMeeting"
395                                 context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
396                         </div>
397                         <div class="oe_title">
398                             <label for="name" class="oe_edit_only"/>
399                             <h1><field name="name"/></h1>
400                             <label for="planned_revenue" class="oe_edit_only"/>
401                             <h2>
402                                 <field name="company_currency" invisible="1"/>
403                                 <field name="planned_revenue" class="oe_inline" widget='monetary' options="{'currency_field': 'company_currency'}"/>
404                                 <span class="oe_grey"> at </span>
405                                 <field name="probability" class="oe_inline" widget="integer"/>%%
406                             </h2>
407                         </div>
408                         <group>
409                             <group>
410                                 <field name="partner_id"
411                                     on_change="on_change_partner_id(partner_id)"
412                                     string="Customer"
413                                     context="{'default_name': partner_name, 'default_email': email_from, 'default_phone': phone}"/>
414                                 <field name="email_from" string="Email" widget="email"/>
415                                 <field name="phone"/>
416                             </group>
417
418                             <group>
419                                 <label for="title_action"/>
420                                 <div>
421                                     <field name="date_action" nolabel="1"/> <label string="-" attrs="{'invisible': ['|', ('date_action', '=', False), ('title_action', '=', False)]}"/>
422                                     <field name="title_action" class="oe_inline" nolabel="1" placeholder="e.g. Call for proposal"/>
423                                 </div>
424                                 <field name="date_deadline"/>
425                                 <field name="priority"/>
426                             </group>
427
428                             <group>
429                                 <field name="user_id" on_change="on_change_user(user_id, context)" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/>
430                                 <label for="section_id" groups="base.group_multi_salesteams"/>
431                                 <div groups="base.group_multi_salesteams">
432                                     <field name="section_id" widget="selection"/>
433                                     <button name="case_escalate" string="Escalate" type="object" class="oe_link"
434                                             attrs="{'invisible': ['|', ('section_id','=',False), ('probability', '=', 100)]}"/>
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="type" invisible="1"/>
486                                 </group>
487                                 <group string="References">
488                                     <field name="ref"/>
489                                     <field name="ref2"/>
490                                 </group>
491                             </group>
492                         </page>
493                         <page string="Fund Raising" groups="crm.group_fund_raising">
494                             <group>
495                                 <field name="payment_mode" widget="selection"/>
496                                 <field name="planned_cost"/>
497                             </group>
498                         </page>
499                         </notebook>
500                     </sheet>
501                     <div class="oe_chatter">
502                         <field name="message_follower_ids" widget="mail_followers"/>
503                         <field name="message_ids" widget="mail_thread"/>
504                     </div>
505                 </form>
506             </field>
507         </record>
508
509         <!-- Opportunities Tree View -->
510         <record model="ir.ui.view" id="crm_case_tree_view_oppor">
511             <field name="name">Opportunities Tree</field>
512             <field name="model">crm.lead</field>
513             <field name="arch" type="xml">
514                 <tree string="Opportunities" fonts="bold:message_unread==True" colors="gray:probability == 100;red:date_deadline and (date_deadline &lt; current_date)">
515                     <field name="date_deadline" invisible="1"/>
516                     <field name="create_date"/>
517                     <field name="name" string="Opportunity"/>
518                     <field name="partner_id" string="Customer"/>
519                     <field name="country_id" invisible="context.get('invisible_country', True)"/>
520                     <field name="date_action"/>
521                     <field name="title_action"/>
522                     <field name="channel_id" invisible="1"/>
523                     <field name="type_id" invisible="1"/>
524                     <field name="stage_id"/>
525                     <field name="planned_revenue" sum="Expected Revenues"/>
526                     <field name="probability" avg="Avg. of Probability"/>
527                     <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/>
528                     <field name="user_id"/>
529                     <field name="referred" invisible="1"/>
530                     <field name="priority" invisible="1"/>
531                     <field name="message_unread" invisible="1"/>
532                     <field name="probability" invisible="1"/>
533                     <field name="write_date" 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                     <field name="stage_id" domain="[]"/>
551                     <field name="probability"/>
552                     <separator/>
553                     <filter string="Won" name="won"
554                             domain="[('probability', '=', 100), ('stage_id.fold', '=', True)]"/>
555                     <filter string="Lost" name="lost"
556                             domain="[('probability', '=', 0), ('stage_id.fold', '=', True)]"/>
557                     <filter string="Unassigned" name="unassigned"
558                             domain="[('user_id','=', False)]" help="No salesperson"/>
559                     <filter string="My Opportunities" name="assigned_to_me"
560                             domain="[('user_id', '=', uid)]" context="{'invisible_section': False}"
561                             help="Opportunities that are assigned to me"/>
562                     <filter string="My Team(s)"
563                             domain="[('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}"
564                             help="Opportunities that are assigned to any sales teams I am member of"/>
565                     <separator/>
566                     <group expand="0" string="Group By..." colspan="16">
567                         <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/>
568                         <filter string="Team" domain="[]" context="{'group_by':'section_id'}"/>
569                         <filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
570                         <filter string="Customer" help="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
571                         <filter string="Country" domain="[]" context="{'group_by':'country_id'}"/>
572                         <filter string="Priority" domain="[]" context="{'group_by':'priority'}"/>
573                         <filter string="Expected Closing" domain="[]" context="{'group_by':'date_deadline'}"/>
574                         <filter string="Referrer" domain="[]" context="{'group_by':'referred'}"/>
575                         <filter string="Campaign" domain="[]" context="{'group_by':'type_id'}"/>
576                         <filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
577                         <filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
578                         <filter string="Last Update Month" domain="[]" context="{'group_by':'write_date'}"/>
579                     </group>
580                     <group string="Display">
581                         <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/>
582                         <filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/>
583                     </group>
584                 </search>
585             </field>
586         </record>
587
588         <!--
589             MASS MAILING
590         -->
591         <act_window name="Lead/Opportunity Mass Mail"
592                 res_model="mail.compose.message"
593                 src_model="crm.lead"
594                 view_mode="form"
595                 multi="True"
596                 target="new"
597                 key2="client_action_multi"
598                 id="crm.action_lead_mass_mail"
599                 context="{
600                             'default_composition_mode': 'mass_mail',
601                             'default_email_to':'{($object.email or \'\')|safe}',
602                             'default_use_template': True,
603                             'default_template_id': ref('crm.email_template_opportunity_mail'),
604                         }"
605                 groups="base.group_sale_salesman"
606                 />
607
608         <!--Update of email_template defined in crm_lead_data, to add ref_ir_act_window
609             allowing to have a well formed email template (context action considered as set). -->
610         <record id="email_template_opportunity_mail" model="email.template">
611             <field name="ref_ir_act_window" ref="crm.action_lead_mass_mail"/>
612         </record>
613
614         <record id="action_mark_as_lost" model="ir.actions.server">
615             <field name="name">Mark As Lost</field>
616             <field name="model_id" ref="model_crm_lead"/>
617             <field name="state">code</field>
618             <field name="code">
619                 if context.get('active_model') == 'crm.lead' and context.get('active_ids'):
620                     self.case_mark_lost(cr, uid, context['active_ids'], context=context)
621             </field>
622         </record>
623
624         <record id="ir_mark_as_lost" model="ir.values">
625             <field eval="'client_action_multi'" name="key2"/>
626             <field eval="'crm.lead'" name="model"/>
627             <field name="name">Mark As Lost</field>
628             <field eval="'ir.actions.server,%d'%action_mark_as_lost" name="value"/>
629         </record>
630
631     </data>
632 </openerp>