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">
17 <field name="sequence"/>
18 <field name="probability"/>
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.
33 Stages will allow salespersons to easily track how a specific
34 lead or opportunity is positioned in the sales cycle.
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"/>
42 LEADS/OPPORTUNITIES CATEGORIES
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.
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.
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"/>
73 id="act_crm_opportunity_crm_phonecall_new"
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}"
82 id="act_crm_opportunity_crm_meeting_new"
84 res_model="crm.meeting"
85 view_mode="tree,form,calendar"
86 context="{'default_duration': 4.0, 'default_opportunity_id': active_id}"
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">
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="['&', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"
102 on_change="onchange_stage_id(stage_id)"/>
105 <div class="oe_right oe_button_box" name="buttons">
106 <button string="Schedule/Log Call"
107 name="%(opportunity2phonecall_act)d"
110 <div class="oe_title">
111 <label for="name" class="oe_edit_only"/>
112 <h1><field name="name" placeholder="Describe the lead..."/></h1>
116 <field name="partner_name" string="Company Name"/>
117 <!-- Preload all the partner's information -->
118 <field name="partner_id" string="Customer"
119 on_change="on_change_partner_id(partner_id)"
120 options='{"create_name_field": "name"}'
121 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}"/>
122 <label for="street" string="Address"/>
124 <field name="street" placeholder="Street..."/>
125 <field name="street2"/>
126 <div class="address_format">
127 <field name="city" placeholder="City" style="width: 40%%"/>
128 <field name="state_id" on_change="onchange_state(state_id)" options='{"no_open": True}' placeholder="State" style="width: 24%%"/>
129 <field name="zip" placeholder="ZIP" style="width: 34%%"/>
131 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>
135 <label for="contact_name"/>
137 <field name="contact_name" class="oe_inline"/><span attrs="{'invisible': [('title', '=', '')]}">, </span>
138 <field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" class="oe_inline" options='{"no_open": True}'/>
140 <field name="email_from" widget="email"/>
141 <field name="function"/>
142 <field name="phone"/>
143 <field name="mobile"/>
147 <field name="user_id" on_change="on_change_user(user_id, context)"
148 context="{'default_groups_ref': ['base.group_user', 'base.group_sale_salesman_all_leads'] }"/>
149 <label for="section_id" groups="base.group_multi_salesteams"/>
150 <div groups="base.group_multi_salesteams">
151 <field name="section_id"/>
152 <button name="case_escalate" string="Escalate"
153 type="object" class="oe_link"
154 attrs="{'invisible': ['|', ('section_id','=',False), ('probability', '=', 100)]}"/>
156 <field name="type" invisible="1"/>
159 <field name="priority"/>
160 <field name="categ_ids"
161 widget="many2many_tags"
162 domain="[('object_id.model','=','crm.lead')]"
163 context="{'object_name': 'crm.lead'}"
167 <notebook colspan="4">
168 <page string="Internal Notes">
169 <field name="description"/>
171 <page string="Extra Info">
172 <group string="Categorization" groups="base.group_multi_company,base.group_no_one" name="categorization">
173 <field name="company_id"
174 groups="base.group_multi_company"
175 widget="selection" colspan="2"/>
177 <group string="Mailings">
178 <field name="opt_out"/>
180 <group string="Misc">
182 <field name="probability" groups="base.group_no_one"/>
183 <field name="active"/>
184 <field name="referred"/>
187 <field name="date_open" groups="base.group_no_one"/>
188 <field name="date_closed" groups="base.group_no_one"/>
194 <div class="oe_chatter">
195 <field name="message_follower_ids" widget="mail_followers"/>
196 <field name="message_ids" widget="mail_thread"/>
202 <!-- CRM Lead Graph View -->
203 <record model="ir.ui.view" id="crm_case_graph_view_leads">
204 <field name="name">Opportunities</field>
205 <field name="model">crm.lead</field>
206 <field name="arch" type="xml">
207 <graph string="Opportunities" type="bar">
208 <field name="stage_id"/>
209 <field name="planned_revenue" operator="+"/>
214 <!-- CRM Lead Tree View -->
215 <record model="ir.ui.view" id="crm_case_tree_view_leads">
216 <field name="name">Leads</field>
217 <field name="model">crm.lead</field>
218 <field name="arch" type="xml">
219 <tree string="Leads" fonts="bold:message_unread==True" colors="grey:probability == 100">
220 <field name="date_deadline" invisible="1"/>
221 <field name="create_date"/>
223 <field name="contact_name"/>
224 <field name="country_id" invisible="context.get('invisible_country', True)"/>
225 <field name="email_from"/>
226 <field name="phone"/>
227 <field name="stage_id"/>
228 <field name="user_id" invisible="1"/>
229 <field name="partner_id" invisible="1"/>
230 <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/>
231 <field name="probability" invisible="1"/>
232 <field name="type_id" invisible="1"/>
233 <field name="referred" invisible="1"/>
234 <field name="channel_id" invisible="1"/>
235 <field name="message_unread" invisible="1"/>
241 <!-- CRM Lead Calendar View -->
242 <record model="ir.ui.view" id="crm_case_calendar_view_leads">
243 <field name="name">CRM - Leads Calendar</field>
244 <field name="model">crm.lead</field>
245 <field name="priority" eval="2"/>
246 <field name="arch" type="xml">
247 <calendar string="Leads Generation"
248 date_start="date_action" color="user_id">
250 <field name="partner_name"/>
255 <!-- CRM Lead Kanban View -->
256 <record model="ir.ui.view" id="crm_case_kanban_view_leads">
257 <field name="name">CRM - Leads Kanban</field>
258 <field name="model">crm.lead</field>
259 <field name="arch" type="xml">
260 <kanban default_group_by="stage_id">
261 <field name="stage_id"/>
262 <field name="color"/>
263 <field name="priority"/>
264 <field name="planned_revenue" sum="Expected Revenues"/>
265 <field name="user_email"/>
266 <field name="user_id"/>
267 <field name="partner_address_email"/>
268 <field name="message_summary"/>
269 <field name="message_unread"/>
271 <field name="date_deadline"/>
272 <t t-name="kanban-box">
273 <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
274 <div class="oe_dropdown_toggle oe_dropdown_kanban">
275 <span class="oe_e">Ã</span>
276 <ul class="oe_dropdown_menu">
277 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
278 <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
279 <li><a name="%(mail.action_email_compose_message_wizard)d" type="action">Send Email</a></li>
280 <li><a name="%(opportunity2phonecall_act)d" type="action">Schedule/Log Call</a></li>
281 <li><a name="action_makeMeeting" type="object">Schedule Meeting</a></li>
282 <li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
285 <div class="oe_kanban_content">
287 <b><field name="name"/></b>
288 <t t-if="record.planned_revenue.raw_value">
289 - <b><t t-esc="record.planned_revenue.value"/>
290 <field name="company_currency"/></b>
294 <field name="partner_id"/>
296 <div style="padding-left: 0.5em">
297 <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>
298 <span t-attf-class="#{red || ''}"><field name="date_action"/></span>
299 <t t-if="record.date_action.raw_value"> : </t>
300 <field name="title_action"/>
302 <div class="oe_kanban_bottom_right">
303 <a t-if="record.priority.raw_value == 1" type="object" name="set_normal_priority" class="oe_e oe_star_on">7</a>
304 <a t-if="record.priority.raw_value != 1" type="object" name="set_high_priority" class="oe_e oe_star_off">7</a>
305 <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"/>
307 <div class="oe_kanban_footer_left">
308 <t t-raw="record.message_summary.raw_value"/>
311 <div class="oe_clear"></div>
319 <!-- CRM Lead Search View -->
320 <record id="view_crm_case_leads_filter" model="ir.ui.view">
321 <field name="name">CRM - Leads Search</field>
322 <field name="model">crm.lead</field>
323 <field name="arch" type="xml">
324 <search string="Search Leads">
325 <field name="name" string="Lead / Customer" filter_domain="['|','|',('partner_name','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>
326 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]"/>
327 <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/>
328 <field name="user_id"/>
329 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
330 <field name="create_date"/>
331 <field name="country_id" context="{'invisible_country': False}"/>
333 <filter string="Unassigned" name="unassigned"
334 domain="[('user_id','=', False)]"
335 help="No salesperson"/>
336 <filter string="Assigned to Me"
337 domain="[('user_id','=',uid)]" context="{'invisible_section': False}"
338 help="Leads that are assigned to me"/>
339 <filter string="Assigned to My Team(s)" groups="base.group_multi_salesteams"
340 domain="[('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}"
341 help="Leads that are assigned to any sales teams I am member of"/>
342 <filter string="Dead" name="dead"
343 domain="[('probability', '=', '0'), ('stage_id.sequence', '!=', 1)]"/>
345 <filter string="Available for mass mailing"
346 name='not_opt_out' domain="[('opt_out', '=', False)]"
347 help="Leads that did not ask not to be included in mass mailing campaigns"/>
349 <group expand="0" string="Group By...">
350 <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/>
351 <filter string="Team" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/>
352 <filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
353 <filter string="Customer" help="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
354 <filter string="Country" domain="[]" context="{'group_by':'country_id'}"/>
355 <filter string="Referrer" domain="[]" context="{'group_by':'referred'}"/>
356 <filter string="Campaign" domain="[]" context="{'group_by':'type_id'}"/>
357 <filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
358 <filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
360 <group string="Display">
361 <filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/>
362 <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/>
373 <!-- Opportunities Form View -->
374 <record model="ir.ui.view" id="crm_case_form_view_oppor">
375 <field name="name">Opportunities</field>
376 <field name="model">crm.lead</field>
377 <field name="priority">20</field>
378 <field name="arch" type="xml">
379 <form string="Opportunities" version="7.0">
381 <button name="case_mark_won" string="Mark Won" type="object" class="oe_highlight"
382 attrs="{'invisible': [('probability', '=', 100)]}"/>
383 <button name="case_mark_lost" string="Mark Lost" type="object" class="oe_highlight"/>
384 <field name="stage_id" widget="statusbar" clickable="True"
385 domain="['&', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"/>
388 <div class="oe_right oe_button_box">
389 <button string="Schedule/Log Call" type="action"
390 name="%(opportunity2phonecall_act)d"/>
391 <button string="Meeting" type="object"
392 name="action_makeMeeting"
393 context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
395 <div class="oe_title">
396 <label for="name" class="oe_edit_only"/>
397 <h1><field name="name"/></h1>
398 <label for="planned_revenue" class="oe_edit_only"/>
400 <field name="company_currency" invisible="1"/>
401 <field name="planned_revenue" class="oe_inline" widget='monetary' options="{'currency_field': 'company_currency'}"/>
402 <span class="oe_grey"> at </span>
403 <field name="probability" class="oe_inline" widget="integer"/>%%
408 <field name="partner_id"
409 on_change="onchange_partner_id(partner_id, email_from)"
411 context="{'default_name': partner_name, 'default_email': email_from, 'default_phone': phone}"/>
412 <field name="email_from" string="Email"/>
413 <field name="phone"/>
417 <label for="title_action"/>
419 <field name="date_action" nolabel="1"/> <label string="-" attrs="{'invisible': ['|', ('date_action', '=', False), ('title_action', '=', False)]}"/>
420 <field name="title_action" class="oe_inline" nolabel="1" placeholder="e.g. Call for proposal"/>
422 <field name="date_deadline"/>
423 <field name="priority"/>
427 <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']}"/>
428 <label for="section_id" groups="base.group_multi_salesteams"/>
429 <div groups="base.group_multi_salesteams">
430 <field name="section_id" widget="selection"/>
431 <button name="case_escalate" string="Escalate" type="object" class="oe_link"
432 attrs="{'invisible': ['|', ('section_id','=',False), ('probability', '=', 100)]}"/>
436 <field name="categ_ids"
437 string="Categories" widget="many2many_tags"
438 context="{'object_name': 'crm.lead'}"
439 domain="[('object_id.model', '=', 'crm.lead')]"/>
444 <notebook colspan="4">
445 <page string="Internal Notes">
446 <field name="description"/>
451 <field name="partner_name"/>
452 <label for="street" string="Address"/>
454 <field name="street" placeholder="Street..."/>
455 <field name="street2"/>
456 <div class="address_format">
457 <field name="city" placeholder="City" style="width: 40%%"/>
458 <field name="state_id" options='{"no_open": True}' on_change="onchange_state(state_id)" placeholder="State" style="width: 24%%"/>
459 <field name="zip" placeholder="ZIP" style="width: 34%%"/>
461 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>
466 <label for="contact_name"/>
468 <field name="contact_name" class="oe_inline"/>
469 <field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" options='{"no_open": True}' class="oe_inline"/>
471 <field name="function"/>
472 <field name="mobile"/>
475 <group string="Mailings" name="mailings">
476 <field name="opt_out"/>
478 <group string="Misc">
479 <field name="active"/>
480 <field name="day_open" groups="base.group_no_one"/>
481 <field name="day_close" groups="base.group_no_one"/>
482 <field name="referred"/>
483 <field name="type" invisible="1"/>
485 <group string="References">
491 <page string="Fund Raising" groups="crm.group_fund_raising">
493 <field name="payment_mode" widget="selection"/>
494 <field name="planned_cost"/>
499 <div class="oe_chatter">
500 <field name="message_follower_ids" widget="mail_followers"/>
501 <field name="message_ids" widget="mail_thread"/>
507 <!-- Opportunities Tree View -->
508 <record model="ir.ui.view" id="crm_case_tree_view_oppor">
509 <field name="name">Opportunities Tree</field>
510 <field name="model">crm.lead</field>
511 <field name="arch" type="xml">
512 <tree string="Opportunities" fonts="bold:message_unread==True" colors="gray:probability == 100;red:date_deadline and (date_deadline < current_date)">
513 <field name="date_deadline" invisible="1"/>
514 <field name="create_date"/>
515 <field name="name" string="Opportunity"/>
516 <field name="partner_id" string="Customer"/>
517 <field name="country_id" invisible="context.get('invisible_country', True)"/>
518 <field name="date_action"/>
519 <field name="title_action"/>
520 <field name="channel_id" invisible="1"/>
521 <field name="type_id" invisible="1"/>
522 <field name="stage_id"/>
523 <field name="planned_revenue" sum="Expected Revenues"/>
524 <field name="probability" avg="Avg. of Probability"/>
525 <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/>
526 <field name="user_id"/>
527 <field name="referred" invisible="1"/>
528 <field name="priority" invisible="1"/>
529 <field name="message_unread" invisible="1"/>
530 <field name="probability" invisible="1"/>
531 <field name="write_date" invisible="1"/>
537 <!-- Opportunities Search View -->
538 <record id="view_crm_case_opportunities_filter" model="ir.ui.view">
539 <field name="name">CRM - Opportunities Search</field>
540 <field name="model">crm.lead</field>
541 <field name="arch" type="xml">
542 <search string="Search Opportunities">
543 <field name="name" string="Opportunity" filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/>
544 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>
545 <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/>
546 <field name="user_id"/>
547 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
548 <field name="stage_id"/>
549 <field name="probability"/>
551 <filter string="New" name="new"
552 domain="[('probability', '=', 0), ('stage_id.sequence', '=', 1)]"/>
553 <filter string="Won" name="won"
554 domain="[('probability', '=', 100), ('stage_id.on_change', '=', 1)]"/>
555 <filter string="Lost" name="lost"
556 domain="[('probability', '=', 0), ('stage_id.sequence', '!=', 1)]"/>
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="Assigned to 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"/>
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'}"/>
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"/>
591 <act_window name="Lead/Opportunity Mass Mail"
592 res_model="mail.compose.message"
597 key2="client_action_multi"
598 id="crm.action_lead_mass_mail"
600 'default_composition_mode': 'mass_mail',
601 'default_email_to':'{$object.email or \'\'}',
602 'default_use_template': True,
603 'default_template_id': ref('crm.email_template_opportunity_mail'),
605 groups="base.group_sale_salesman"
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"/>
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>
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)
622 <field name="groups_id" eval="[(4,ref('base.group_sale_salesman'))]"/>
625 <record id="ir_mark_as_lost" model="ir.values">
626 <field eval="'client_action_multi'" name="key2"/>
627 <field eval="'crm.lead'" name="model"/>
628 <field name="name">Mark As Lost</field>
629 <field eval="'ir.actions.server,%d'%action_mark_as_lost" name="value"/>