From 57fdf116353e0cff9336dc55a159070ecf59cd6f Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 19 Apr 2013 12:36:00 +0200 Subject: [PATCH] [IMP] salesteams: add demo data bzr revid: chm@openerp.com-20130419103600-71j6munkzygnffe4 --- addons/crm/__openerp__.py | 4 +- addons/crm/crm.py | 11 +++--- addons/crm/crm_data.xml | 4 +- addons/crm/crm_demo.xml | 18 ++------- addons/crm/crm_lead_demo.xml | 61 ++++++++++++++++++------------- addons/crm/crm_phonecall_demo.xml | 6 +-- addons/sale/sale_demo.xml | 2 + addons/sale_crm/__openerp__.py | 2 +- addons/sale_crm/sale_crm.py | 16 ++++---- 9 files changed, 61 insertions(+), 63 deletions(-) diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 577a51f4784..4b88fc13d6d 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -81,8 +81,6 @@ Dashboard for CRM will include: 'crm_lead_view.xml', 'crm_lead_menu.xml', - 'crm_case_section_view.xml', - 'crm_meeting_menu.xml', 'crm_phonecall_view.xml', @@ -97,6 +95,8 @@ Dashboard for CRM will include: 'board_crm_view.xml', 'res_config_view.xml', + + 'crm_case_section_view.xml', ], 'demo': [ 'crm_demo.xml', diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 9a1c2856e25..9787a21b9dd 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -19,6 +19,7 @@ # ############################################################################## +from openerp import tools from openerp.osv import fields from openerp.osv import osv from openerp.tools.translate import _ @@ -56,8 +57,6 @@ MONTHS = { "annually": 12 } -_strftime = '%Y-%m-%d %H:%M:%S' - class crm_case_channel(osv.osv): _name = "crm.case.channel" _description = "Channels" @@ -139,9 +138,9 @@ class crm_case_section(osv.osv): dates = [first_day + relativedelta(months=-(MONTHS[section.target_duration]*(key+1)-1)) for key in range(0, 5)] nb_leads = [] for when in range(0, 5): - domain = [('type', '!=', 'opportunity'), ("section_id", "=", section.id), ('create_date', '>=', dates[when].strftime(_strftime))] + domain = [("section_id", "=", section.id), '|', ('type', '=', 'lead'), ('date_open', '!=', None), ('create_date', '>=', dates[when].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] if when: - domain += [('create_date', '<', dates[when-1].strftime(_strftime))] + domain += [('create_date', '<', dates[when-1].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] nb_leads.append(lead_obj.search(cr, uid, domain, context=context, count=True)) nb_leads.reverse() res[section.id] = nb_leads @@ -156,9 +155,9 @@ class crm_case_section(osv.osv): dates = [first_day + relativedelta(months=-(MONTHS[section.target_duration]*(key+1)-1)) for key in range(0, 5)] nb_leads = [] for when in range(0, 5): - domain = [('type', '=', 'opportunity'), ("section_id", "=", section.id), ('state', '!=', 'cancel'), ('date_closed', '>=', dates[when].strftime(_strftime))] + domain = [("section_id", "=", section.id), ('state', '=', 'done'), ('type', '=', 'opportunity'), ('date_closed', '>=', dates[when].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] if when: - domain += [('date_closed', '<', dates[when-1].strftime(_strftime))] + domain += [('date_closed', '<', dates[when-1].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] rate = 0 opportunity_ids = lead_obj.search(cr, uid, domain, context=context) for opportunity in lead_obj.browse(cr, uid, opportunity_ids, context=context): diff --git a/addons/crm/crm_data.xml b/addons/crm/crm_data.xml index f24aee13c1d..153771532a5 100644 --- a/addons/crm/crm_data.xml +++ b/addons/crm/crm_data.xml @@ -27,8 +27,8 @@ - Sales - Sales + Direct Marketing + DM True diff --git a/addons/crm/crm_demo.xml b/addons/crm/crm_demo.xml index 203193dc3bc..0f7368fa907 100644 --- a/addons/crm/crm_demo.xml +++ b/addons/crm/crm_demo.xml @@ -7,9 +7,9 @@ - Sales Marketing Department - SMD - + Indirect Marketing + IM + semesterly @@ -18,18 +18,6 @@ - - Direct Marketing - DM - - - - - Online Support - OS - - - OpenERP partners True diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index 21d60ad2961..e7e6beae33e 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -20,7 +20,7 @@ 1 - + Hello, @@ -44,7 +44,7 @@ Can you send me the details ? 4 - + @@ -63,7 +63,7 @@ Can you send me the details ? 2 - + @@ -82,7 +82,7 @@ Can you send me the details ? 3 - + @@ -133,7 +133,7 @@ Contact: +1 813 494 5005 3 - + @@ -152,7 +152,7 @@ Contact: +1 813 494 5005 5 - + @@ -197,6 +197,9 @@ Contact: +1 813 494 5005 + + + lead @@ -211,7 +214,7 @@ Contact: +1 813 494 5005 2 - + Hi, @@ -235,7 +238,7 @@ Andrew 3 - + @@ -291,7 +294,7 @@ Andrew Meeting for pricing information. - + @@ -317,7 +320,7 @@ Andrew Send Catalogue by Email - + @@ -326,7 +329,7 @@ Andrew opportunity Plan to buy RedHat servers - + 69 rue de Chimay @@ -339,10 +342,11 @@ Andrew Call to ask system requirement - + - + + @@ -367,6 +371,7 @@ Andrew + @@ -388,10 +393,11 @@ Andrew Send price list regarding our interventions - + - + + @@ -412,7 +418,7 @@ Andrew Call to define real needs about training - + @@ -438,8 +444,9 @@ Andrew Ask for the good receprion of the proposition - + + @@ -468,10 +475,11 @@ Andrew 3 - + - + + @@ -486,7 +494,7 @@ Andrew 3 - + @@ -504,14 +512,15 @@ Andrew 5 - + + opportunity Need 20 Days of Consultancy - + info@mycompany.net @@ -525,6 +534,7 @@ Andrew + @@ -544,7 +554,7 @@ Andrew 2 Conf call with technical service - + @@ -569,10 +579,11 @@ Andrew Send Catalogue by Email - + - + + diff --git a/addons/crm/crm_phonecall_demo.xml b/addons/crm/crm_phonecall_demo.xml index f441c29a7e6..4002e18815e 100644 --- a/addons/crm/crm_phonecall_demo.xml +++ b/addons/crm/crm_phonecall_demo.xml @@ -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 - + @@ -74,7 +74,7 @@ Proposal for discount offer open +34 230 953 485 - + diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml index 428b586ffa8..eb937199aba 100644 --- a/addons/sale/sale_demo.xml +++ b/addons/sale/sale_demo.xml @@ -288,6 +288,8 @@ + + diff --git a/addons/sale_crm/__openerp__.py b/addons/sale_crm/__openerp__.py index 6591589342e..7bc1dc24bfc 100644 --- a/addons/sale_crm/__openerp__.py +++ b/addons/sale_crm/__openerp__.py @@ -47,7 +47,7 @@ modules. 'security/ir.model.access.csv', 'report/sale_crm_account_invoice_report_view.xml', ], - 'demo': [], + 'demo': ['sale_crm_demo.xml'], 'test': ['test/sale_crm.yml'], 'installable': True, 'auto_install': True, diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index bcc2c28f417..46c0bcb4aa6 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -20,6 +20,7 @@ ############################################################################## from datetime import date +from openerp import tools from dateutil.relativedelta import relativedelta from openerp.osv import osv, fields @@ -30,9 +31,6 @@ MONTHS = { "annually": 12 } -_strftime = '%Y-%m-%d %H:%M:%S' - - class sale_order(osv.osv): _inherit = 'sale.order' _columns = { @@ -54,9 +52,9 @@ class crm_case_section(osv.osv): dates = [first_day + relativedelta(months=-(MONTHS[section.target_duration]*(key+1)-1)) for key in range(0, 5)] rate_invoice = [] for when in range(0, 5): - domain = [("section_id", "=", section.id), ('state', 'in', ['draft', 'sent']), ('date_order', '>=', dates[when].strftime(_strftime))] + domain = [("section_id", "=", section.id), ('state', 'in', ['draft', 'sent']), ('date_order', '>=', dates[when].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] if when: - domain += [('date_order', '<', dates[when-1].strftime(_strftime))] + domain += [('date_order', '<', dates[when-1].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] rate = 0 opportunity_ids = obj.search(cr, uid, domain, context=context) for invoice in obj.browse(cr, uid, opportunity_ids, context=context): @@ -75,9 +73,9 @@ class crm_case_section(osv.osv): dates = [first_day + relativedelta(months=-(MONTHS[section.target_duration]*(key+1)-1)) for key in range(0, 5)] rate_invoice = [] for when in range(0, 5): - domain = [("section_id", "=", section.id), ('state', 'not in', ['draft', 'sent']), ('date_confirm', '>=', dates[when].strftime(_strftime))] + domain = [("section_id", "=", section.id), ('state', 'not in', ['draft', 'sent']), ('date_confirm', '>=', dates[when].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] if when: - domain += [('date_confirm', '<', dates[when-1].strftime(_strftime))] + domain += [('date_confirm', '<', dates[when-1].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] rate = 0 opportunity_ids = obj.search(cr, uid, domain, context=context) for invoice in obj.browse(cr, uid, opportunity_ids, context=context): @@ -96,9 +94,9 @@ class crm_case_section(osv.osv): dates = [first_day + relativedelta(months=-(MONTHS[section.target_duration]*(key+1)-1)) for key in range(0, 5)] rate_invoice = [] for when in range(0, 5): - domain = [("section_id", "=", section.id), ('state', 'not in', ['draft', 'cancel']), ('date', '>=', dates[when].strftime(_strftime))] + domain = [("section_id", "=", section.id), ('state', 'not in', ['draft', 'cancel']), ('date', '>=', dates[when].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] if when: - domain += [('date', '<', dates[when-1].strftime(_strftime))] + domain += [('date', '<', dates[when-1].strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] rate = 0 opportunity_ids = obj.search(cr, uid, domain, context=context) for invoice in obj.browse(cr, uid, opportunity_ids, context=context):