From a878fa0903d5b3750cedefc97b07767c9cb98c09 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Wed, 13 Jan 2010 15:07:24 +0530 Subject: [PATCH] [IMP]: rename then name category2_id field to type_id and remove the msg_new function bzr revid: sbh@tinyerp.com-20100113093724-ggajsvixeg99n0gn --- addons/crm/crm.py | 114 +--------------------------- addons/crm/crm_claim.py | 36 +++++---- addons/crm/crm_claims_data.xml | 14 ++-- addons/crm/crm_claims_demo.xml | 14 ++-- addons/crm/crm_claims_view.xml | 39 +++++++++- addons/crm/crm_fund_data.xml | 8 +- addons/crm/crm_fund_demo.xml | 16 ++-- addons/crm/crm_fund_view.xml | 41 +++++++++- addons/crm/crm_fundraising.py | 21 ++++- addons/crm/crm_helpdesk.py | 18 ----- addons/crm/crm_helpdesk_data.xml | 4 - addons/crm/crm_helpdesk_view.xml | 3 - addons/crm/crm_lead.py | 35 ++++----- addons/crm/crm_lead_data.xml | 28 +++---- addons/crm/crm_lead_demo.xml | 14 ++-- addons/crm/crm_lead_view.xml | 40 +++++++++- addons/crm/crm_opportunity.py | 37 +++++---- addons/crm/crm_opportunity_data.xml | 27 +++---- addons/crm/crm_opportunity_demo.xml | 8 +- addons/crm/crm_opportunity_view.xml | 40 +++++++++- addons/crm/crm_phonecall.py | 33 ++++---- addons/crm/crm_phonecall_data.xml | 11 +-- addons/crm/crm_phonecall_view.xml | 35 +++++++++ addons/crm/crm_view.xml | 77 ++----------------- 24 files changed, 345 insertions(+), 368 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index ff9e945af74..d5f689ae4ee 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -101,18 +101,7 @@ class crm_case_section(osv.osv): return res crm_case_section() -class crm_case_categ(osv.osv): - _name = "crm.case.categ" - _description = "Category of case" - _columns = { - 'name': fields.char('Case Category Name', size=64, required=True, translate=True), - 'probability': fields.float('Probability (%)', required=True), - 'section_id': fields.many2one('crm.case.section', 'Case Section'), - } - _defaults = { - 'probability': lambda *args: 0.0 - } -crm_case_categ() + class crm_case_rule(osv.osv): _name = "crm.case.rule" @@ -137,7 +126,8 @@ class crm_case_rule(osv.osv): 'trg_date_range_type': fields.selection([('minutes', 'Minutes'),('hour','Hours'),('day','Days'),('month','Months')], 'Delay type'), 'trg_section_id': fields.many2one('crm.case.section', 'Section'), - 'trg_categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',trg_section_id)]"), + + #'trg_categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',trg_section_id)]"), 'trg_user_id': fields.many2one('res.users', 'Responsible'), 'trg_partner_id': fields.many2one('res.partner', 'Partner'), @@ -221,33 +211,6 @@ def _links_get(self, cr, uid, context={}): return [(r['object'], r['name']) for r in res] -class crm_case_category2(osv.osv): - _name = "crm.case.category2" - _description = "Category2 of case" - _rec_name = "name" - _columns = { - 'name': fields.char('Case Category2 Name', size=64, required=True, translate=True), - 'section_id': fields.many2one('crm.case.section', 'Case Section'), - } - -crm_case_category2() - - -class crm_case_stage(osv.osv): - _name = "crm.case.stage" - _description = "Stage of case" - _rec_name = 'name' - _order = "sequence" - _columns = { - 'name': fields.char('Stage Name', size=64, required=True, translate=True), - 'section_id': fields.many2one('crm.case.section', 'Case Section'), - 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of case stages."), - } - _defaults = { - 'sequence': lambda *args: 1 - } -crm_case_stage() - class crm_case(osv.osv): _name = "crm.case" _description = "Case" @@ -551,6 +514,7 @@ class crm_case(osv.osv): def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, context={}): + for case in cases: data = { 'name': keyword, @@ -770,76 +734,6 @@ class crm_case(osv.osv): return True crm_case() -class crm_menu_config_wizard(osv.osv_memory): - _name = 'crm.menu.config_wizard' - _columns = { - 'name': fields.char('Name', size=64), - 'meeting': fields.boolean('Calendar of Meetings', help="Manages the calendar of meetings of the users."), - 'lead': fields.boolean('Leads', help="Allows you to track and manage leads which are pre-sales requests or contacts, the very first contact with a customer request."), - 'opportunity': fields.boolean('Business Opportunities', help="Tracks identified business opportunities for your sales pipeline."), - 'jobs': fields.boolean('Jobs Hiring Process', help="Helps you to organise the jobs hiring process: evaluation, meetings, email integration..."), - 'document_ics': fields.boolean('Shared Calendar', help=" Will allow you to synchronise your Open ERP calendars with your phone, outlook, Sunbird, ical, ..."), - 'bugs': fields.boolean('Bug Tracking', help="Used by companies to track bugs and support requests on software"), - 'helpdesk': fields.boolean('Helpdesk', help="Manages an Helpdesk service."), - 'fund': fields.boolean('Fund Raising Operations', help="This may help associations in their fund raising process and tracking."), - 'claims': fields.boolean('Claims', help="Manages the supplier and customers claims, including your corrective or preventive actions."), - 'phonecall': fields.boolean('Phone Calls', help="Helps you to encode the result of a phone call or to plan a list of phone calls to process."), - } - _defaults = { - 'meeting': lambda *args: True, - 'opportunity': lambda *args: True, - 'phonecall': lambda *args: True, - } - - def action_create(self, cr, uid, ids, context=None): - module_proxy = self.pool.get('ir.module.module') - modid = module_proxy.search(cr, uid, [('name', '=', 'crm')]) - moddemo = module_proxy.browse(cr, uid, modid[0]).demo - lst = ('data', 'menu') - if moddemo: - lst = ('data', 'menu', 'demo') - res = self.read(cr, uid, ids)[0] - idref = {} - for section in ['meeting', 'lead', 'opportunity', 'jobs', 'bugs', 'fund', 'helpdesk', 'claims', 'phonecall']: - if (not res[section]): - continue - for fname in lst: - file_name = 'crm_' + section + '_' + fname + '.xml' - try: - fp = tools.file_open(os.path.join('crm', file_name)) - except IOError, e: - fp = None - if fp: - tools.convert_xml_import(cr, 'crm', fp, idref, 'init', noupdate=True) - cr.commit() - modobj = self.pool.get('ir.module.module') - modids = modobj.search(cr, uid, [('name', '=', 'crm')]) - modobj.update_translations(cr, 1, modids, None) - - if res['document_ics']: - ids = module_proxy.search(cr, uid, [('name', '=', 'document_ics')]) - module_proxy.button_install(cr, uid, ids, context=context) - cr.commit() - db, pool = pooler.restart_pool(cr.dbname, update_module=True) - - return { - 'view_type': 'form', - "view_mode": 'form', - 'res_model': 'ir.actions.configuration.wizard', - 'type': 'ir.actions.act_window', - 'target': 'new', - } - - def action_cancel(self, cr, uid, ids, context=None): - return { - 'view_type': 'form', - "view_mode": 'form', - 'res_model': 'ir.actions.configuration.wizard', - 'type': 'ir.actions.act_window', - 'target': 'new', - } - -crm_menu_config_wizard() class crm_case_log(osv.osv): _name = "crm.case.log" diff --git a/addons/crm/crm_claim.py b/addons/crm/crm_claim.py index aa8bc6d6423..64971c21a32 100644 --- a/addons/crm/crm_claim.py +++ b/addons/crm/crm_claim.py @@ -64,6 +64,21 @@ class crm_claim_type(osv.osv): crm_claim_type() +class crm_claim_stage(osv.osv): + _name = "crm.claim.stage" + _description = "Stage of claim case" + _rec_name = 'name' + _order = "sequence" + _columns = { + 'name': fields.char('Stage Name', size=64, required=True, translate=True), + 'section_id': fields.many2one('crm.case.section', 'Case Section'), + 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of case stages."), + } + _defaults = { + 'sequence': lambda *args: 1 + } +crm_claim_stage() + class crm_claim(osv.osv): _name = "crm.claim" _description = "Claim Cases" @@ -82,35 +97,18 @@ class crm_claim(osv.osv): "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), 'categ_id': fields.many2one('crm.claim.categ','Category', domain="[('section_id','=',section_id)]"), 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), - 'category2_id': fields.many2one('crm.claim.type', 'Claim Type', domain="[('section_id','=',section_id)]"), + 'type_id': fields.many2one('crm.claim.type', 'Claim Type', domain="[('section_id','=',section_id)]"), 'partner_name': fields.char("Employee's Name", size=64), 'partner_mobile': fields.char('Mobile', size=32), 'partner_phone': fields.char('Phone', size=32), - 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id)]"), + 'stage_id': fields.many2one ('crm.claim.stage', 'Stage', domain="[('section_id','=',section_id)]"), } _defaults = { 'priority': lambda *a: AVAILABLE_PRIORITIES[2][0], } - def msg_new(self, cr, uid, msg): - mailgate_obj = self.pool.get('mail.gateway') - msg_body = mailgate_obj.msg_body_get(msg) - data = { - 'name': msg['Subject'], - 'email_from': msg['From'], - 'email_cc': msg['Cc'], - 'user_id': False, - 'description': msg_body['body'], - 'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })], - } - res = mailgate_obj.partner_get(cr, uid, msg['From']) - if res: - data.update(res) - res = self.create(cr, uid, data) - return res - crm_claim() diff --git a/addons/crm/crm_claims_data.xml b/addons/crm/crm_claims_data.xml index b4c8479c04d..9566e28f52a 100644 --- a/addons/crm/crm_claims_data.xml +++ b/addons/crm/crm_claims_data.xml @@ -21,11 +21,11 @@ - + Corrective - + Preventive @@ -33,23 +33,23 @@ - + Accepted as Claim - + Fixed - + Won't fix - + Invalid - + Awaiting Response diff --git a/addons/crm/crm_claims_demo.xml b/addons/crm/crm_claims_demo.xml index b957d286d85..525998c02ff 100644 --- a/addons/crm/crm_claims_demo.xml +++ b/addons/crm/crm_claims_demo.xml @@ -7,7 +7,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -103,7 +103,7 @@ - + diff --git a/addons/crm/crm_claims_view.xml b/addons/crm/crm_claims_view.xml index 6c02d463a66..66a6c4a1971 100644 --- a/addons/crm/crm_claims_view.xml +++ b/addons/crm/crm_claims_view.xml @@ -38,7 +38,42 @@ form - + + # ------------------------------------------------------ + # Stage + # ------------------------------------------------------ + + crm.claim.stage.tree + crm.claim.stage + tree + + + + + + + + + + crm.claim.stage.form + crm.claim.stage + form + +
+ + + + + +
+ + Claim Stages + crm.claim.stage + form + + + + CRM - Claims Tree @@ -86,7 +121,7 @@ - + diff --git a/addons/crm/crm_fund_data.xml b/addons/crm/crm_fund_data.xml index f76ca888123..08b8d71e5bb 100644 --- a/addons/crm/crm_fund_data.xml +++ b/addons/crm/crm_fund_data.xml @@ -26,22 +26,22 @@ - + Cash - + Cheque - + Credit Card - + Demand Draft diff --git a/addons/crm/crm_fund_demo.xml b/addons/crm/crm_fund_demo.xml index ef8f590954b..23ea6835df1 100644 --- a/addons/crm/crm_fund_demo.xml +++ b/addons/crm/crm_fund_demo.xml @@ -5,7 +5,7 @@ - + @@ -24,7 +24,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -129,7 +129,7 @@ - + diff --git a/addons/crm/crm_fund_view.xml b/addons/crm/crm_fund_view.xml index 57b29f7b2c5..5161dae753c 100644 --- a/addons/crm/crm_fund_view.xml +++ b/addons/crm/crm_fund_view.xml @@ -36,7 +36,42 @@ form - + + # ------------------------------------------------------ + # Fund Stage + # ------------------------------------------------------ + + crm.fundraising.stage.tree + crm.fundraising.stage + tree + + + + + + + + + + crm.fundraising.stage.form + crm.fundraising.stage + form + +
+ + + + + +
+ + Fundraising Stages + crm.claim.stage + form + + + + # ------------------------------------------------------ # Fund Raising # ------------------------------------------------------ @@ -49,7 +84,7 @@ - + @@ -76,7 +111,7 @@ - + diff --git a/addons/crm/crm_fundraising.py b/addons/crm/crm_fundraising.py index 86f3cf1e52e..5bb74150088 100644 --- a/addons/crm/crm_fundraising.py +++ b/addons/crm/crm_fundraising.py @@ -70,6 +70,22 @@ class crm_fundraising_type(osv.osv): crm_fundraising_type() +class crm_fundraising_stage(osv.osv): + _name = "crm.fundraising.stage" + _description = "Stage of fundraising case" + _rec_name = 'name' + _order = "sequence" + _columns = { + 'name': fields.char('Stage Name', size=64, required=True, translate=True), + 'section_id': fields.many2one('crm.case.section', 'Case Section'), + 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of case stages."), + } + _defaults = { + 'sequence': lambda *args: 1 + } +crm_fundraising_stage() + + class crm_fundraising(osv.osv): _name = "crm.fundraising" _description = "Fund Raising Cases" @@ -86,10 +102,9 @@ class crm_fundraising(osv.osv): 'partner_name2': fields.char('Employee Email', size=64), 'partner_phone': fields.char('Phone', size=32), 'partner_mobile': fields.char('Mobile', size=32), - 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id)]"), - 'category2_id': fields.many2one('crm.fundraising.type', 'Fundraising Type', domain="[('section_id','=',section_id)]"), + 'stage_id': fields.many2one ('crm.fundraising.stage', 'Stage', domain="[('section_id','=',section_id)]"), + 'type_id': fields.many2one('crm.fundraising.type', 'Fundraising Type', domain="[('section_id','=',section_id)]"), 'duration': fields.float('Duration'), - 'case_id': fields.many2one('crm.case', 'Related fundraising'), 'ref' : fields.reference('Reference', selection=_links_get, size=128), 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ diff --git a/addons/crm/crm_helpdesk.py b/addons/crm/crm_helpdesk.py index ac94f5e6d98..172ad585726 100644 --- a/addons/crm/crm_helpdesk.py +++ b/addons/crm/crm_helpdesk.py @@ -79,26 +79,8 @@ class crm_helpdesk(osv.osv): "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), 'categ_id': fields.many2one('crm.helpdesk.categ', 'Category', domain="[('section_id','=',section_id)]"), 'duration': fields.float('Duration'), - 'case_id': fields.many2one('crm.case', 'Related Helpdesk'), } - def msg_new(self, cr, uid, msg): - mailgate_obj = self.pool.get('mail.gateway') - msg_body = mailgate_obj.msg_body_get(msg) - data = { - 'name': msg['Subject'], - 'email_from': msg['From'], - 'email_cc': msg['Cc'], - 'user_id': False, - 'description': msg_body['body'], - 'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })], - } - res = mailgate_obj.partner_get(cr, uid, msg['From']) - if res: - data.update(res) - res = self.create(cr, uid, data) - return res - crm_helpdesk() diff --git a/addons/crm/crm_helpdesk_data.xml b/addons/crm/crm_helpdesk_data.xml index 50d350e0641..bc3adea8b38 100644 --- a/addons/crm/crm_helpdesk_data.xml +++ b/addons/crm/crm_helpdesk_data.xml @@ -4,10 +4,6 @@ - - HelpDesk - HD - diff --git a/addons/crm/crm_helpdesk_view.xml b/addons/crm/crm_helpdesk_view.xml index c2476e7cd0a..5bd2b15f84b 100644 --- a/addons/crm/crm_helpdesk_view.xml +++ b/addons/crm/crm_helpdesk_view.xml @@ -54,9 +54,6 @@ - - - diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 1a1bbc62843..5716bb10108 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -69,6 +69,20 @@ class crm_lead_type(osv.osv): } crm_lead_type() +class crm_lead_stage(osv.osv): + _name = "crm.lead.stage" + _description = "Stage of claim case" + _rec_name = 'name' + _order = "sequence" + _columns = { + 'name': fields.char('Stage Name', size=64, required=True, translate=True), + 'section_id': fields.many2one('crm.case.section', 'Case Section'), + 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of case stages."), + } + _defaults = { + 'sequence': lambda *args: 1 + } +crm_lead_stage() class crm_opportunity(osv.osv): _name = "crm.opportunity" crm_opportunity() @@ -80,7 +94,7 @@ class crm_lead(osv.osv): _inherit = 'crm.case' _columns = { 'categ_id': fields.many2one('crm.lead.categ', 'Category', domain="[('section_id','=',section_id)]"), - 'category2_id': fields.many2one('crm.lead.type', 'Lead Type Name', domain="[('section_id','=',section_id)]"), + 'type_id': fields.many2one('crm.lead.type', 'Lead Type Name', domain="[('section_id','=',section_id)]"), 'partner_name': fields.char("Employee's Name", size=64), 'partner_name2': fields.char('Employee Email', size=64), 'partner_phone': fields.char('Phone', size=32), @@ -94,29 +108,12 @@ class crm_lead(osv.osv): " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'planned_revenue': fields.float('Planned Revenue'), 'planned_cost': fields.float('Planned Costs'), - 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id)]"), + 'stage_id': fields.many2one ('crm.lead.stage', 'Stage', domain="[('section_id','=',section_id)]"), 'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \ "the partner mentality in relation to our services.The scale has" \ "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), 'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'), } - - def msg_new(self, cr, uid, msg): - mailgate_obj = self.pool.get('mail.gateway') - msg_body = mailgate_obj.msg_body_get(msg) - data = { - 'name': msg['Subject'], - 'email_from': msg['From'], - 'email_cc': msg['Cc'], - 'user_id': False, - 'description': msg_body['body'], - 'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })], - } - res = mailgate_obj.partner_get(cr, uid, msg['From']) - if res: - data.update(res) - res = self.create(cr, uid, data) - return res crm_lead() diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index 3c329d22a39..bb232abfa52 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -32,61 +32,61 @@
- + New - + Assigned - + In Process - + Converted - + Recycled - + Dead - + Telesales - + Mail - + Email - + Print - + Web - + Radio - + Television - + Newsletter diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index bfe9e8ad2e8..affdd2c437a 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -7,7 +7,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -101,7 +101,7 @@ - + diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 0776699b247..2c0441a7c2f 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -37,7 +37,41 @@ form - + + # ------------------------------------------------------ + # Stage + # ------------------------------------------------------ + + crm.lead.stage.tree + crm.lead.stage + tree + + + + + + + + + + crm.lead.stage.form + crm.lead.stage + form + +
+ + + + + +
+ + Lead Stages + crm.claim.stage + form + + + # ------------------------------------------------------ # Leads # ------------------------------------------------------ @@ -59,7 +93,7 @@