[MERGE] from trunk-salesteams-chm

bzr revid: chm@openerp.com-20130128154423-xlq04czqoy2k7jo1
This commit is contained in:
Christophe Matthieu 2013-01-28 16:44:23 +01:00
commit 1e9cf860ae
9 changed files with 250 additions and 54 deletions

View File

@ -80,6 +80,8 @@ Dashboard for CRM will include:
'crm_lead_view.xml', 'crm_lead_view.xml',
'crm_lead_menu.xml', 'crm_lead_menu.xml',
'crm_salesteams.xml',
'crm_meeting_menu.xml', 'crm_meeting_menu.xml',
'crm_phonecall_view.xml', 'crm_phonecall_view.xml',
@ -113,6 +115,7 @@ Dashboard for CRM will include:
'test/ui/duplicate_lead.yml', 'test/ui/duplicate_lead.yml',
'test/ui/delete_lead.yml', 'test/ui/delete_lead.yml',
], ],
'css': ['static/src/css/crm.css'],
'installable': True, 'installable': True,
'application': True, 'application': True,
'auto_install': False, 'auto_install': False,

View File

@ -109,6 +109,20 @@ class crm_case_section(osv.osv):
def get_full_name(self, cr, uid, ids, field_name, arg, context=None): def get_full_name(self, cr, uid, ids, field_name, arg, context=None):
return dict(self.name_get(cr, uid, ids, context=context)) return dict(self.name_get(cr, uid, ids, context=context))
def get_number_leads(self, cr, uid, section_ids, field_name, arg, context=None):
res = dict.fromkeys(section_ids, 0)
lead_obj = self.pool.get('crm.lead')
for section_id in section_ids:
res[section_id] = lead_obj.search(cr, uid, [("section_id", "=", section_id), '|', '|', ("type", "=", "lead"), ("type", "=", "both"), ("type", "=", False), ('state', 'not in', ['done', 'cancel'])], count=True, context=context)
return res
def get_number_opportunities(self, cr, uid, section_ids, field_name, arg, context=None):
res = dict.fromkeys(section_ids, 0)
lead_obj = self.pool.get('crm.lead')
for section_id in section_ids:
res[section_id] = lead_obj.search(cr, uid, [("section_id", "=", section_id), '|', ("type", "=", "opportunity"), ("type", "=", "both"), ('state', 'not in', ['done', 'cancel'])], context=context, count=True)
return res
_columns = { _columns = {
'name': fields.char('Sales Team', size=64, required=True, translate=True), 'name': fields.char('Sales Team', size=64, required=True, translate=True),
'complete_name': fields.function(get_full_name, type='char', size=256, readonly=True, store=True), 'complete_name': fields.function(get_full_name, type='char', size=256, readonly=True, store=True),
@ -128,6 +142,8 @@ class crm_case_section(osv.osv):
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
help="The email address associated with this team. New emails received will automatically " help="The email address associated with this team. New emails received will automatically "
"create new leads assigned to the team."), "create new leads assigned to the team."),
'number_lead': fields.function(get_number_leads, type='integer', readonly=True),
'number_opportunity': fields.function(get_number_opportunities, type='integer', readonly=True),
} }
def _get_stage_common(self, cr, uid, context): def _get_stage_common(self, cr, uid, context):

View File

@ -45,6 +45,7 @@
</record> </record>
<record model="crm.case.stage" id="stage_lead6"> <record model="crm.case.stage" id="stage_lead6">
<field name="name">Won</field> <field name="name">Won</field>
<field eval="True" name="fold"/>
<field eval="1" name="case_default"/> <field eval="1" name="case_default"/>
<field name="state">done</field> <field name="state">done</field>
<field eval="'100'" name="probability"/> <field eval="'100'" name="probability"/>

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- CRM lead search by Salesteams -->
<record model="ir.actions.act_window" id="crm_case_form_view_salesteams_lead">
<field name="name">Leads</field>
<field name="res_model">crm.lead</field>
<field name="view_mode">tree,form</field>
<field name="domain">['|', ('type','=','lead'), ('type','=',False)]</field>
<field name="context">{
'search_default_section_id': [active_id],
'default_section_id': active_id,
'search_default_new': True,
'search_default_open': True
}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new lead.
</p><p>
Use leads if you need a qualification step before creating an
opportunity or a customer. It can be a business card you received,
a contact form filled in your website, or a file of unqualified
prospects you import, etc.
</p><p>
Once qualified, the lead can be converted into a business
opportunity and/or a new customer in your address book.
</p>
</field>
</record>
<!-- CRM opportunity search by Salesteams -->
<record model="ir.actions.act_window" id="crm_case_form_view_salesteams_opportunity">
<field name="name">Leads</field>
<field name="res_model">crm.lead</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('type','=','opportunity')]</field>
<field name="view_id" ref="crm.crm_case_kanban_view_leads"/>
<field name="context">{
'search_default_section_id': [active_id],
'default_section_id': active_id,
'search_default_new': True,
'search_default_open': True
}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new lead.
</p><p>
Use leads if you need a qualification step before creating an
opportunity or a customer. It can be a business card you received,
a contact form filled in your website, or a file of unqualified
prospects you import, etc.
</p><p>
Once qualified, the lead can be converted into a business
opportunity and/or a new customer in your address book.
</p>
</field>
</record>
<!-- Case Sections Salesteams kanban view -->
<record model="ir.ui.view" id="crm_case_section_salesteams_view_kanban">
<field name="name">crm.case.section.kanban</field>
<field name="model">crm.case.section</field>
<field name="arch" type="xml">
<kanban version="7.0">
<field name="name"/>
<field name="user_id"/>
<field name="member_ids"/>
<field name="note"/>
<field name="alias_id"/>
<field name="number_lead"/>
<field name="number_opportunity"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_project oe_kanban_global_click oe_kanban_crm_salesteams" style="width:200px;">
<div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
<span class="oe_e">í</span>
<ul class="oe_dropdown_menu">
<t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Project Settings</a></li></t>
<t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
</ul>
</div>
<div class="oe_kanban_content">
<h4>
<field name="name"/>
<div class="oe_kanban_crm_salesteams_leader">
<small>
<t t-if="record.user_id.raw_value">(<field name="user_id"/>)</t>
<t t-if="!record.user_id.raw_value"><br/></t>
</small>
</div>
</h4>
<div class="oe_kanban_crm_salesteams_list">
<a name="%(crm_case_form_view_salesteams_lead)d" type="action">
<field name="number_lead"/>
<t t-if="record.number_lead.raw_value &gt; 1">Leads</t>
<t t-if="record.number_lead.raw_value &lt;= 1">Lead</t>
</a><br/>
<a name="%(crm_case_form_view_salesteams_opportunity)d" type="action">
<field name="number_opportunity"/>
<t t-if="record.number_opportunity.raw_value &gt; 1">Opportunities</t>
<t t-if="record.number_opportunity.raw_value &lt;= 1">Opportunity</t>
</a>
</div>
<div class="oe_kanban_crm_salesteams_avatars">
<t t-foreach="record.member_ids.raw_value.slice(0,11)" t-as="member">
<img t-att-src="kanban_image('res.users', 'image_small', member)" t-att-data-member_id="member"/>
</t>
</div>
<br/>
<small style="position: absolute; bottom: 5px;">
<field name="alias_id"/>
</small>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- Case Sections Action -->
<record id="crm_case_section_salesteams_act" model="ir.actions.act_window">
<field name="name">Sales Teams</field>
<field name="res_model">crm.case.section</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_id" ref="crm_case_section_salesteams_view_kanban"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new sales team.
</p><p>
Use sales team to organize your different salespersons or
departments into separate teams. Each team will work in
its own list of opportunities.
</p>
</field>
</record>
<menuitem
action="crm_case_section_salesteams_act"
id="crm.menu_crm_case_section_act"
sequence="1"
parent="base.menu_sales"
groups="base.group_sale_manager,base.group_sale_salesman"/>
</data>
</openerp>

View File

@ -77,56 +77,58 @@
<field name="model">crm.case.section</field> <field name="model">crm.case.section</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Sales Team" version="7.0"> <form string="Sales Team" version="7.0">
<group> <sheet>
<group> <group>
<field name="name" colspan="2"/> <group>
<field name="parent_id"/> <field name="name" colspan="2"/>
<field name="code"/> <field name="parent_id"/>
</group> <field name="code"/>
<group>
<field name="user_id"/>
<field name="resource_calendar_id"/>
<field name="active"/>
</group>
</group>
<notebook colspan="4">
<page string="Sales Team">
<group>
<field name="alias_id" invisible="1" required="0"/>
<label for="alias_name" attrs="{'invisible': [('alias_domain', '=', False)]}"/>
<div attrs="{'invisible': [('alias_domain', '=', False)]}">
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
</div>
<field name="change_responsible"/>
</group> </group>
<separator string="Team Members"/>
<field name="member_ids" widget="many2many_kanban"> <group>
<kanban quick_create="false" create="true"> <field name="user_id"/>
<field name="name"/> <field name="resource_calendar_id"/>
<templates> <field name="active"/>
<t t-name="kanban-box"> </group>
<div style="position: relative"> </group>
<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a> <notebook colspan="4">
<div class="oe_module_vignette"> <page string="Sales Team">
<div class="oe_module_desc"> <group>
<field name="name"/> <field name="alias_id" invisible="1" required="0"/>
<label for="alias_name" attrs="{'invisible': [('alias_domain', '=', False)]}"/>
<div attrs="{'invisible': [('alias_domain', '=', False)]}">
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
</div>
<field name="change_responsible"/>
</group>
<separator string="Team Members"/>
<field name="member_ids" widget="many2many_kanban">
<kanban quick_create="false" create="true">
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div style="position: relative">
<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
<div class="oe_module_vignette">
<div class="oe_module_desc">
<field name="name"/>
</div>
</div> </div>
</div> </div>
</div> </t>
</t> </templates>
</templates> </kanban>
</kanban> </field>
</field> </page>
</page> <page string="Stages">
<page string="Stages"> <separator string="Select Stages for this Sales Team"/>
<separator string="Select Stages for this Sales Team"/> <field name="stage_ids"/>
<field name="stage_ids"/> </page>
</page> <page string="Notes">
<page string="Notes"> <field name="note"/>
<field name="note"/> </page>
</page> </notebook>
</notebook> </sheet>
<div class="oe_chatter"> <div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" help="Follow this salesteam to automatically track the events associated to users of this team."/> <field name="message_follower_ids" widget="mail_followers" help="Follow this salesteam to automatically track the events associated to users of this team."/>
<field name="message_ids" widget="mail_thread"/> <field name="message_ids" widget="mail_thread"/>

View File

@ -36,4 +36,4 @@ access_res_partner_bank_type_crm_user,res.partner.bank.type.crm.user,base.model_
access_crm_lead_partner_manager,crm.lead.partner.manager,model_crm_lead,base.group_partner_manager,1,0,0,0 access_crm_lead_partner_manager,crm.lead.partner.manager,model_crm_lead,base.group_partner_manager,1,0,0,0
access_crm_phonecall_partner_manager,crm.phonecall.partner.manager,model_crm_phonecall,base.group_partner_manager,1,1,1,1 access_crm_phonecall_partner_manager,crm.phonecall.partner.manager,model_crm_phonecall,base.group_partner_manager,1,1,1,1
access_crm_payment_mode_user,crm.payment.mode,model_crm_payment_mode,base.group_sale_salesman,1,0,0,0 access_crm_payment_mode_user,crm.payment.mode,model_crm_payment_mode,base.group_sale_salesman,1,0,0,0
access_crm_payment_mode,crm.payment.mode,model_crm_payment_mode,base.group_sale_manager,1,1,1,1 access_crm_payment_mode,crm.payment.mode,model_crm_payment_mode,base.group_sale_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
36 access_crm_lead_partner_manager crm.lead.partner.manager model_crm_lead base.group_partner_manager 1 0 0 0
37 access_crm_phonecall_partner_manager crm.phonecall.partner.manager model_crm_phonecall base.group_partner_manager 1 1 1 1
38 access_crm_payment_mode_user crm.payment.mode model_crm_payment_mode base.group_sale_salesman 1 0 0 0
39 access_crm_payment_mode crm.payment.mode model_crm_payment_mode base.group_sale_manager 1 1 1 1

View File

@ -0,0 +1,22 @@
.oe_kanban_crm_salesteams {
width: 220px;
min-height: 160px;
}
.oe_kanban_crm_salesteams_avatars {
margin-top: 8px;
}
.oe_kanban_crm_salesteams_avatars img {
width: 30px;
height: 30px;
padding-left: 0px;
margin-top: 3px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

View File

@ -4,7 +4,7 @@ mail.message
============ ============
Models Models
+++++++ ++++++
``mail.message`` is a class for holding the main attributes of a message object ``mail.message`` is a class for holding the main attributes of a message object
(notification for system message, reciving email message or sent messages). It (notification for system message, reciving email message or sent messages). It
@ -19,7 +19,8 @@ should inherit from this class.
.. versionchanged:: 7.0 .. versionchanged:: 7.0
ClientAction (ir.actions.client) ClientAction (ir.actions.client)
+++++++ ++++++++++++++++++++++++++++++++
<record id="action_mail_inbox_feeds" model="ir.actions.client"> <record id="action_mail_inbox_feeds" model="ir.actions.client">
<field name="name">Inbox</field> <field name="name">Inbox</field>
<field name="tag">mail.wall</field> <field name="tag">mail.wall</field>
@ -56,7 +57,7 @@ ClientAction (ir.actions.client)
- ``readonly`` : Read only mode, hide all action buttons and composer - ``readonly`` : Read only mode, hide all action buttons and composer
Fields Fields
+++++++ ++++++
- ``type`` : usually 'email', 'comment', 'notification'. - ``type`` : usually 'email', 'comment', 'notification'.
Message type: email for external email message recieve, notification for system Message type: email for external email message recieve, notification for system
@ -64,7 +65,7 @@ Fields
- ``subtype_id`` : - ``subtype_id`` :
Subtype of the notification for system message. The users can followe a document Subtype of the notification for system message. The users can followe a document
and choose the subtype of this document (eg: Create, Comment, Done). and choose the subtype of this document (eg: Create, Comment, Done).
You can defined new subtypes and choose his name, by agreement the id begin by "mt_" on the model You can defined new subtypes and choose his name, by agreement the id begin by "mt\_" on the model
"mail.message.subtype". "mail.message.subtype".
- ``partner_ids`` : - ``partner_ids`` :
List of recipients, the recipients have this message in their personal mailboxe. List of recipients, the recipients have this message in their personal mailboxe.
@ -104,4 +105,4 @@ Methods
sort by id. The messages that the user can read but not in his search, are group in sort by id. The messages that the user can read but not in his search, are group in
expandable messages. The expandable messages contain the domain to expand. expandable messages. The expandable messages contain the domain to expand.
- ``check_access_rule`` : - ``check_access_rule`` :
Overwrite the initial message for this model. Overwrite the initial message for this model.

View File

@ -1,7 +1,7 @@
.. _mail_state: .. _mail_state:
message_unread message_unread
============= ==============
``message_unread`` is a boolean field that states whether the document ``message_unread`` is a boolean field that states whether the document
has unread messages. In previous versions, some documents were going has unread messages. In previous versions, some documents were going
@ -10,7 +10,7 @@ gateway. Now the state related to messages differs from the state or
stage of the document itself. stage of the document itself.
message_unread and need action mechanism message_unread and need action mechanism
+++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++
The ``mail`` module introduces a default behavior for the need_action The ``mail`` module introduces a default behavior for the need_action
mechanism [REF]. mechanism [REF].