[MERGE] forward port of branch 8.0 up to 591e329
[odoo/odoo.git] / addons / crm / crm.py
index 9d12c56..45f84b8 100644 (file)
@@ -23,11 +23,10 @@ from openerp.osv import osv, fields
 from openerp.http import request
 
 AVAILABLE_PRIORITIES = [
-    ('0', 'Very Low'),
+    ('0', 'Normal'),
     ('1', 'Low'),
-    ('2', 'Normal'),
-    ('3', 'High'),
-    ('4', 'Very High'),
+    ('2', 'High'),
+    ('3', 'Very High'),
 ]
 
 
@@ -52,7 +51,7 @@ class crm_tracking_campaign(osv.Model):
     _rec_name = "name"
     _columns = {
         'name': fields.char('Campaign Name', required=True, translate=True),
-        'section_id': fields.many2one('crm.case.section', 'Sales Team'),
+        'team_id': fields.many2one('crm.team', 'Sales Team', oldname='section_id'),
     }
 
 
@@ -70,7 +69,7 @@ class crm_tracking_mixin(osv.AbstractModel):
     _name = 'crm.tracking.mixin'
 
     _columns = {
-        'campaign_id': fields.many2one('crm.tracking.campaign', 'Campaign',  # old domain ="['|',('section_id','=',section_id),('section_id','=',False)]"
+        'campaign_id': fields.many2one('crm.tracking.campaign', 'Campaign',  # old domain ="['|',('team_id','=',team_id),('team_id','=',False)]"
                                        help="This is a name that helps you keep track of your different campaign efforts Ex: Fall_Drive, Christmas_Special"),
         'source_id': fields.many2one('crm.tracking.source', 'Source', help="This is the source of the link Ex: Search Engine, another domain, or name of email list"),
         'medium_id': fields.many2one('crm.tracking.medium', 'Channel', help="This is the method of delivery. Ex: Postcard, Email, or Banner Ad", oldname='channel_id'),
@@ -108,13 +107,13 @@ class crm_tracking_mixin(osv.AbstractModel):
     }
 
 
-class crm_case_stage(osv.osv):
+class crm_stage(osv.Model):
     """ Model for case stages. This models the main stages of a document
         management flow. Main CRM objects (leads, opportunities, project
         issues, ...) will now use only stages, instead of state and stages.
         Stages are for example used to display the kanban view of records.
     """
-    _name = "crm.case.stage"
+    _name = "crm.stage"
     _description = "Stage of case"
     _rec_name = 'name'
     _order = "sequence"
@@ -125,10 +124,13 @@ class crm_case_stage(osv.osv):
         'probability': fields.float('Probability (%)', required=True, help="This percentage depicts the default/average probability of the Case for this stage to be a success"),
         'on_change': fields.boolean('Change Probability Automatically', help="Setting this stage will change the probability automatically on the opportunity."),
         'requirements': fields.text('Requirements'),
-        'section_ids': fields.many2many('crm.case.section', 'section_stage_rel', 'stage_id', 'section_id', string='Sections',
-                                        help="Link between stages and sales teams. When set, this limitate the current stage to the selected sales teams."),
+        'team_ids': fields.many2many('crm.team', 'crm_team_stage_rel', 'stage_id', 'team_id', string='Teams',
+                        help="Link between stages and sales teams. When set, this limitate the current stage to the selected sales teams."),
         'case_default': fields.boolean('Default to New Sales Team',
-                                       help="If you check this field, this stage will be proposed by default on each sales team. It will not assign this stage to existing teams."),
+                        help="If you check this field, this stage will be proposed by default on each sales team. It will not assign this stage to existing teams."),
+        'legend_priority': fields.text(
+            'Priority Management Explanation', translate=True,
+            help='Explanation text to help users using the star and priority mechanism on stages or issues that are in this stage.'),
         'fold': fields.boolean('Folded in Kanban View',
                                help='This stage is folded in the kanban view when'
                                'there are no records in that stage to display.'),
@@ -146,35 +148,4 @@ class crm_case_stage(osv.osv):
         'case_default': True,
     }
 
-
-class crm_case_categ(osv.osv):
-    """ Category of Case """
-    _name = "crm.case.categ"
-    _description = "Category of Case"
-    _columns = {
-        'name': fields.char('Name', required=True, translate=True),
-        'section_id': fields.many2one('crm.case.section', 'Sales Team'),
-        'object_id': fields.many2one('ir.model', 'Object Name'),
-    }
-
-    def _find_object_id(self, cr, uid, context=None):
-        """Finds id for case object"""
-        context = context or {}
-        object_id = context.get('object_id', False)
-        ids = self.pool.get('ir.model').search(cr, uid, ['|', ('id', '=', object_id), ('model', '=', context.get('object_name', False))])
-        return ids and ids[0] or False
-    _defaults = {
-        'object_id': _find_object_id
-    }
-
-
-class crm_payment_mode(osv.osv):
-    """ Payment Mode for Fund """
-    _name = "crm.payment.mode"
-    _description = "CRM Payment Mode"
-    _columns = {
-        'name': fields.char('Name', required=True),
-        'section_id': fields.many2one('crm.case.section', 'Sales Team'),
-    }
-
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: