diff --git a/addons/crm_configuration/crm_config.py b/addons/crm_configuration/crm_config.py index 697a82d19c3..a53f2c7db85 100644 --- a/addons/crm_configuration/crm_config.py +++ b/addons/crm_configuration/crm_config.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -20,12 +20,9 @@ # ############################################################################## -import time import tools -from osv import fields,osv,orm +from osv import fields, osv import os -import mx.DateTime -import base64 import pooler #AVAILABLE_STATES = [ @@ -35,6 +32,7 @@ import pooler # ('done', 'Done'), # ('pending','Pending') #] + class crm_case_category2(osv.osv): _name = "crm.case.category2" _description = "Category2 of case" @@ -43,8 +41,10 @@ class crm_case_category2(osv.osv): '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" @@ -60,20 +60,22 @@ class crm_case_stage(osv.osv): } crm_case_stage() + class crm_cases(osv.osv): _name = "crm.case" _inherit = "crm.case" _columns = { 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id)]"), - 'category2_id': fields.many2one('crm.case.category2','Category Name', domain="[('section_id','=',section_id)]"), + 'category2_id': fields.many2one('crm.case.category2', 'Category Name', domain="[('section_id','=',section_id)]"), 'duration': fields.float('Duration'), 'note': fields.text('Note'), - 'case_id': fields.many2one('crm.case','Related Case'), + 'case_id': fields.many2one('crm.case', 'Related Case'), 'partner_name': fields.char('Employee Name', size=64), 'partner_name2': fields.char('Employee Email', size=64), 'partner_phone': fields.char('Phone', size=16), 'partner_mobile': fields.char('Mobile', size=16), } + def stage_next(self, cr, uid, ids, context={}): ok = False sid = self.pool.get('crm.case.stage').search(cr, uid, [], context=context) @@ -93,8 +95,10 @@ class crm_cases(osv.osv): self.write(cr, uid, [case.id], {'stage_id': s[section][st]}) return True + def onchange_case_id(self, cr, uid, ids, case_id, name, partner_id, context={}): - if not case_id: return {} + if not case_id: + return {} case = self.browse(cr, uid, case_id, context=context) value = {} if not name: @@ -105,50 +109,56 @@ class crm_cases(osv.osv): value['partner_address_id'] = case.partner_address_id.id if case.email_from: value['email_from'] = case.email_from - return {'value':value} + return {'value': value} crm_cases() + class crm_menu_config_wizard(osv.osv_memory): - _name='crm.menu.config_wizard' + _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="Help 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 softwares"), + '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="Help 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 softwares"), '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="Help you to encode the result of a phone call or to planify a list of phone calls to process."), + '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="Help you to encode the result of a phone call or to planify 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_configuration')]) + modid = module_proxy.search(cr, uid, [('name', '=', 'crm_configuration')]) moddemo = module_proxy.browse(cr, uid, modid[0]).demo - lst= ('data','menu') + lst = ('data', 'menu') if moddemo: - lst = ('data','menu','demo') - res = self.read(cr,uid,ids)[0] + lst = ('data', 'menu', 'demo') + res = self.read(cr, uid, ids)[0] idref = {} - for section in ['meeting','lead','opportunity','jobs','bugs','fund','helpdesk','claims','phonecall']: + 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' + file_name = 'crm_' + section + '_' + fname + '.xml' try: - fp = tools.file_open(os.path.join('crm_configuration',file_name )) + fp = tools.file_open(os.path.join('crm_configuration', file_name)) except IOError, e: fp = None if fp: - tools.convert_xml_import(cr, 'crm_configuration', fp, idref, 'init', noupdate=True) + tools.convert_xml_import(cr, 'crm_configuration', fp, idref, 'init', noupdate=True) + cr.commit() + modobj = self.pool.get('ir.module.module') + modids = modobj.search(cr, uid, [('name', '=', 'crm_configuration')]) + modobj.update_translations(cr, 1, modids, None) if res['document_ics']: ids = module_proxy.search(cr, uid, [('name', '=', 'document_ics')]) @@ -161,15 +171,16 @@ class crm_menu_config_wizard(osv.osv_memory): "view_mode": 'form', 'res_model': 'ir.actions.configuration.wizard', 'type': 'ir.actions.act_window', - 'target':'new', + 'target': 'new', } - def action_cancel(self,cr,uid,ids,conect=None): + + 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', + 'target': 'new', } crm_menu_config_wizard()