From 9bb0e6f30ec3a2ef1055e167c2fae8ec0005ba2e Mon Sep 17 00:00:00 2001 From: Randhir Mayatra rma-openerp Date: Mon, 21 Apr 2014 15:32:12 +0530 Subject: [PATCH] [IMP] improve demo data and menu items --- addons/crm/crm.py | 17 ++------ addons/crm/crm_data.xml | 14 +++---- addons/crm/crm_demo.xml | 16 -------- addons/crm/crm_lead.py | 1 + addons/crm/crm_lead_data.xml | 34 ++++++++-------- addons/crm/crm_lead_demo.xml | 52 ++++++++++++------------- addons/crm/crm_phonecall_data.xml | 4 +- addons/crm/crm_phonecall_demo.xml | 12 +++--- addons/sale_team/__openerp__.py | 12 ++++-- addons/sale_team/sale_team.py | 14 ++++++- addons/sale_team/sale_team.xml | 4 +- addons/sale_team/sale_team_security.xml | 18 --------- 12 files changed, 83 insertions(+), 115 deletions(-) delete mode 100644 addons/sale_team/sale_team_security.xml diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 166cfc7f435..da57ae628b3 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -91,7 +91,6 @@ class crm_case_stage(osv.osv): class crm_case_section(osv.osv): """ Model for sales teams. """ _name = "crm.case.section" - _inherits = {'mail.alias': 'alias_id'} _inherit = 'crm.case.section' _description = "Sales Teams" @@ -120,18 +119,17 @@ class crm_case_section(osv.osv): return res _columns = { - - 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="The email address associated with this team. New emails received will automatically ""create new leads assigned to the team."), 'stage_ids': fields.many2many('crm.case.stage', 'section_stage_rel', 'section_id', 'stage_id', 'Stages'), 'use_leads': fields.boolean('Leads', help="The first contact you get with a potential customer is a lead you qualify before converting it into a real business opportunity. Check this box to manage leads in this sales team."), - + 'monthly_open_leads': fields.function(_get_opportunities_data, type="string", readonly=True, multi='_get_opportunities_data', string='Open Leads per Month'), 'monthly_planned_revenue': fields.function(_get_opportunities_data, type="string", readonly=True, multi='_get_opportunities_data', - string='Planned Revenue per Month') + string='Planned Revenue per Month'), + 'resource_calendar_id': fields.many2one('resource.calendar', "Working Time", help="Used to compute open days"), } def _get_stage_common(self, cr, uid, context): @@ -142,15 +140,6 @@ class crm_case_section(osv.osv): 'stage_ids': _get_stage_common, 'use_leads': True, } - - def create(self, cr, uid, vals, context=None): - if context is None: - context = {} - create_context = dict(context, alias_model_name='crm.lead', alias_parent_model_name=self._name) - section_id = super(crm_case_section, self).create(cr, uid, vals, context=create_context) - section = self.browse(cr, uid, section_id, context=context) - self.pool.get('mail.alias').write(cr, uid, [section.alias_id.id], {'alias_parent_thread_id': section_id, 'alias_defaults': {'section_id': section_id, 'type': 'lead'}}, context=context) - return section_id def unlink(self, cr, uid, ids, context=None): # Cascade-delete mail aliases as well, as they should not exist without the sales team. diff --git a/addons/crm/crm_data.xml b/addons/crm/crm_data.xml index 231a7124824..41f4819e500 100644 --- a/addons/crm/crm_data.xml +++ b/addons/crm/crm_data.xml @@ -26,34 +26,30 @@ Email - - Direct Sales - DM + True - sales - Cash - + Check - + Credit Card - + Demand Draft - + diff --git a/addons/crm/crm_demo.xml b/addons/crm/crm_demo.xml index 82bdcd8fcd9..1541753523a 100644 --- a/addons/crm/crm_demo.xml +++ b/addons/crm/crm_demo.xml @@ -6,22 +6,6 @@ - - - - - - Indirect Sales - IM - - - - - Marketing - SPD - - - OpenERP partners True diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 32891c21981..e0149269243 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -195,6 +195,7 @@ class crm_lead(format_address, osv.osv): resource_id = resource_ids[0] duration = float(ans.days) + if lead.section_id and lead.section_id.resource_calendar_id: duration = float(ans.days) * 24 new_dates = cal_obj.interval_get(cr, diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index 1abcdac9712..6dbe9b2ba88 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -60,7 +60,7 @@ opportunity - + Telesales - + Email Campaign - Services - + Email Campaign - Products - + Twitter Ads - + Google Adwords - + Banner Ads - + Television - + Newsletter - + Product - + Software - + Services - + Information - + Design - + Training - + Consulting - + Other - + diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index dab17888d7a..0187f14555f 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -20,7 +20,7 @@ 1 - + Hello, @@ -55,7 +55,7 @@ Could you please send me the details ? 4 - + @@ -84,7 +84,7 @@ Could you please send me the details ? 2 - + @@ -105,7 +105,7 @@ Could you please send me the details ? 3 - + @@ -130,7 +130,7 @@ Could you please send me the details ? 3 - + Hi, @@ -157,7 +157,7 @@ Contact: +1 813 494 5005 3 - + @@ -175,7 +175,7 @@ Contact: +1 813 494 5005 5 - + @@ -194,7 +194,7 @@ Contact: +1 813 494 5005 4 - + @@ -213,7 +213,7 @@ Contact: +1 813 494 5005 2 - + @@ -231,7 +231,7 @@ Contact: +1 813 494 5005 2 - + Hi, @@ -254,7 +254,7 @@ Andrew 3 - + @@ -272,7 +272,7 @@ Andrew 2 - + @@ -310,7 +310,7 @@ Andrew Meeting for pricing information. - + @@ -335,7 +335,7 @@ Andrew Send Catalogue by Email - + @@ -356,7 +356,7 @@ Andrew Call to ask system requirement - + @@ -383,7 +383,7 @@ Andrew Convert to quote - + @@ -408,7 +408,7 @@ Andrew Send price list regarding our interventions - + @@ -435,7 +435,7 @@ Andrew Call to define real needs about training - + @@ -462,7 +462,7 @@ Andrew Ask for the good receprion of the proposition - + @@ -479,7 +479,7 @@ Andrew 2 - + @@ -493,7 +493,7 @@ Andrew 3 - + @@ -511,7 +511,7 @@ Andrew 3 - + @@ -526,7 +526,7 @@ Andrew 5 - + @@ -545,7 +545,7 @@ Andrew 5 - + @@ -568,7 +568,7 @@ Andrew 2 Conf call with technical service - + @@ -592,7 +592,7 @@ Andrew Send Catalogue by Email - + diff --git a/addons/crm/crm_phonecall_data.xml b/addons/crm/crm_phonecall_data.xml index 0e2bb6511c5..4e613e7f72a 100644 --- a/addons/crm/crm_phonecall_data.xml +++ b/addons/crm/crm_phonecall_data.xml @@ -6,13 +6,13 @@ --> Inbound - + Outbound - + diff --git a/addons/crm/crm_phonecall_demo.xml b/addons/crm/crm_phonecall_demo.xml index 4002e18815e..c6026c8d894 100644 --- a/addons/crm/crm_phonecall_demo.xml +++ b/addons/crm/crm_phonecall_demo.xml @@ -11,7 +11,7 @@ Left the message done +34 934 340 230 - + @@ -24,7 +24,7 @@ Need more information on the proposed deal done +44 121 690 4596 - + @@ -37,7 +37,7 @@ Ask for convenient time of meeting open +1 786 525 0724 - + @@ -50,7 +50,7 @@ done (077) 582-4035 (077) 341-3591 - + @@ -63,7 +63,7 @@ More information on the proposed deal pending +1 312 349 2324 - + @@ -74,7 +74,7 @@ Proposal for discount offer open +34 230 953 485 - + diff --git a/addons/sale_team/__openerp__.py b/addons/sale_team/__openerp__.py index bb1e8ab5830..9bbdc73e876 100644 --- a/addons/sale_team/__openerp__.py +++ b/addons/sale_team/__openerp__.py @@ -22,13 +22,17 @@ 'name' : 'Sale Team', 'version' : '1.0', 'author' : 'OpenERP SA', - 'category': 'hidden', + 'category': 'Sales Management', 'summary': 'Sales Team', 'description': """ """, 'website': 'http://www.openerp.com', - 'depends' : ['base','web_kanban','mail', 'resource'], - 'data': ['sale_team.xml','sale_team_security.xml','res_config_view.xml','ir.model.access.csv'], - 'demo': [], + 'depends' : ['base','mail'], + 'data': ['security/sale_team_security.xml', + 'res_config_view.xml', + 'ir.model.access.csv', + 'sale_team_data.xml', + 'sale_team.xml',], + 'demo': ['sale_team_demo.xml'], 'css': ['static/src/css/sale_team.css'], 'installable': True, 'auto_install': True, diff --git a/addons/sale_team/sale_team.py b/addons/sale_team/sale_team.py index 423bb21391c..eb6c892c2e9 100644 --- a/addons/sale_team/sale_team.py +++ b/addons/sale_team/sale_team.py @@ -34,6 +34,7 @@ class crm_case_section(osv.osv): _name = "crm.case.section" _inherit = ['mail.thread', 'ir.needaction_mixin'] _description = "Sales Teams" + _inherits = {'mail.alias': 'alias_id'} _order = "complete_name" _period_number = 5 @@ -71,6 +72,7 @@ class crm_case_section(osv.osv): return section_result _columns = { + 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="The email address associated with this team. New emails received will automatically ""create new leads assigned to the team."), '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), 'code': fields.char('Code', size=8), @@ -82,7 +84,6 @@ class crm_case_section(osv.osv): 'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by OpenERP about cases in this sales team"), 'parent_id': fields.many2one('crm.case.section', 'Parent Team'), 'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Teams'), - 'resource_calendar_id': fields.many2one('resource.calendar', "Working Time", help="Used to compute open days"), 'note': fields.text('Description'), 'working_hours': fields.float('Working Hours', digits=(16, 2)), 'color': fields.integer('Color Index'), @@ -115,7 +116,16 @@ class crm_case_section(osv.osv): name = record['parent_id'][1] + ' / ' + name res.append((record['id'], name)) return res - + + def create(self, cr, uid, vals, context=None): + if context is None: + context = {} + create_context = dict(context, alias_model_name='res.user', alias_parent_model_name=self._name) + section_id = super(crm_case_section, self).create(cr, uid, vals, context=create_context) + section = self.browse(cr, uid, section_id, context=context) + self.pool.get('mail.alias').write(cr, uid, [section.alias_id.id], {'alias_parent_thread_id': section_id, 'alias_defaults': {'section_id': section_id, 'type': 'lead'}}, context=context) + return section_id + class res_users(osv.Model): _inherit = 'res.users' _columns = { diff --git a/addons/sale_team/sale_team.xml b/addons/sale_team/sale_team.xml index 0120dbd21b5..f2fea79a933 100644 --- a/addons/sale_team/sale_team.xml +++ b/addons/sale_team/sale_team.xml @@ -1,7 +1,9 @@ - + Users Preferences diff --git a/addons/sale_team/sale_team_security.xml b/addons/sale_team/sale_team_security.xml deleted file mode 100644 index ff8eef01678..00000000000 --- a/addons/sale_team/sale_team_security.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Do Not Use Sales Teams - - - - - - - - Manage Sales Teams - - - - -