[IMP]: Merged crm_config into crm.

bzr revid: uco@tinyerp.co.in-20100111070747-k5q57o9uerdl1jel
This commit is contained in:
uco (OpenERP)
2010-01-11 12:37:47 +05:30
parent 95d42cbb9b
commit 478cb95e7f
6 changed files with 193 additions and 263 deletions
-1
View File
@@ -22,7 +22,6 @@
import crm
import crm_mailgate
import crm_segmentation
import crm_config
import crm_meeting
import crm_lead
import crm_phonecall
-1
View File
@@ -63,7 +63,6 @@ between mails and Open ERP.""",
'update_xml': [
'crm_wizard.xml',
'crm_view.xml',
'crm_config_view.xml',
'crm_job_wizard.xml',
'crm_jobs_view.xml',
'crm_jobs_menu.xml',
+143
View File
@@ -327,6 +327,34 @@ def _links_get(self, cr, uid, context={}):
res = obj.read(cr, uid, ids, ['object', 'name'], 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"
@@ -385,6 +413,15 @@ class crm_case(osv.osv):
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'company_id': fields.many2one('res.company','Company'),
'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)]"),
'duration': fields.float('Duration'),
'case_id': fields.many2one('crm.case', 'Related Case'),
'partner_name': fields.char("Employee's Name", size=64),
'partner_name2': fields.char('Employee Email', size=64),
'partner_phone': fields.char('Phone', size=32),
'partner_mobile': fields.char('Mobile', size=32),
'child_ids': fields.one2many('crm.case', 'case_id', 'Events'),
}
def _get_default_partner_address(self, cr, uid, context):
if not context.get('portal',False):
@@ -433,6 +470,41 @@ class crm_case(osv.osv):
_('You can not delete this case. You should better cancel it.'))
return super(crm_case, self).unlink(cr, uid, ids, context)
def stage_next(self, cr, uid, ids, context={}):
ok = False
sid = self.pool.get('crm.case.stage').search(cr, uid, [], context=context)
s = {}
previous = {}
for stage in self.pool.get('crm.case.stage').browse(cr, uid, sid, context=context):
section = stage.section_id.id or False
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
if section in s:
st = case.stage_id.id or False
if st in s[section]:
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 {}
case = self.browse(cr, uid, case_id, context=context)
value = {}
if not name:
value['name'] = case.name
if (not partner_id) and case.partner_id:
value['partner_id'] = case.partner_id.id
if case.partner_address_id:
value['partner_address_id'] = case.partner_address_id.id
if case.email_from:
value['email_from'] = case.email_from
return {'value': value}
def _action(self, cr, uid, cases, state_to, scrit=None, context={}):
if not scrit:
scrit = []
@@ -855,6 +927,77 @@ 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"
_description = "Case Communication History"
-190
View File
@@ -1,190 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import tools
from osv import fields, osv
import os
import pooler
import netsvc
from tools.translate import _
from osv.orm import except_orm
#AVAILABLE_STATES = [
# ('draft','Unreviewed'),
# ('open','Open'),
# ('cancel', 'Refuse Bug'),
# ('done', 'Done'),
# ('pending','Pending')
#]
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_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)]"),
'duration': fields.float('Duration'),
'case_id': fields.many2one('crm.case', 'Related Case'),
'partner_name': fields.char("Employee's Name", size=64),
'partner_name2': fields.char('Employee Email', size=64),
'partner_phone': fields.char('Phone', size=32),
'partner_mobile': fields.char('Mobile', size=32),
'child_ids': fields.one2many('crm.case', 'case_id', 'Events'),
}
def stage_next(self, cr, uid, ids, context={}):
ok = False
sid = self.pool.get('crm.case.stage').search(cr, uid, [], context=context)
s = {}
previous = {}
for stage in self.pool.get('crm.case.stage').browse(cr, uid, sid, context=context):
section = stage.section_id.id or False
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
if section in s:
st = case.stage_id.id or False
if st in s[section]:
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 {}
case = self.browse(cr, uid, case_id, context=context)
value = {}
if not name:
value['name'] = case.name
if (not partner_id) and case.partner_id:
value['partner_id'] = case.partner_id.id
if case.partner_address_id:
value['partner_address_id'] = case.partner_address_id.id
if case.email_from:
value['email_from'] = case.email_from
return {'value': value}
crm_cases()
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()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-70
View File
@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- graph view -->
<record model="ir.ui.view" id="crm_case_graph_view_stage_cost">
<field name="name">CRM -Graph</field>
<field name="model">crm.case</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Cases By Stage and Estimates" type="bar" orientation="vertical">
<field name="stage_id"/>
<field name="planned_cost" operator="+"/>
<field name="planned_revenue" operator="+"/>
</graph>
</field>
</record>
<!-- calendar view -->
<record id="crm_case_calendar_section-view" model="ir.ui.view">
<field name="name">crm.case.calendar.section</field>
<field name="model">crm.case</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar color="section_id" date_start="date" date_stop="date_deadline" day_length="12" string="Cases">
<field name="name"/>
<field name="partner_id"/>
<field name="state"/>
</calendar>
</field>
</record>
# ------------------------------------------------------
# Stage
# ------------------------------------------------------
<record model="ir.ui.view" id="crm_case_stage_tree">
<field name="name">crm.case.stage.tree</field>
<field name="model">crm.case.stage</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Stages">
<field name="sequence"/>
<field name="name"/>
<field name="section_id"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_case_stage_form">
<field name="name">crm.case.stage.form</field>
<field name="model">crm.case.stage</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Stage">
<field name="name" select="1"/>
<field name="section_id" select="1" widget="selection"/>
<field name="sequence"/>
</form>
</field>
</record>
<record id="crm_case_stage_act" model="ir.actions.act_window">
<field name="name">Stages</field>
<field name="res_model">crm.case.stage</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_case_stage_tree"/>
</record>
<menuitem action="crm_case_stage_act" id="menu_crm_case_stage_act" parent="crm.next_id_51"/>
</data>
</openerp>
+50 -1
View File
@@ -245,6 +245,41 @@
<field name="target">new</field>
</record>
# ------------------------------------------------------
# Stage
# ------------------------------------------------------
<record model="ir.ui.view" id="crm_case_stage_tree">
<field name="name">crm.case.stage.tree</field>
<field name="model">crm.case.stage</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Stages">
<field name="sequence"/>
<field name="name"/>
<field name="section_id"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_case_stage_form">
<field name="name">crm.case.stage.form</field>
<field name="model">crm.case.stage</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Stage">
<field name="name" select="1"/>
<field name="section_id" select="1" widget="selection"/>
<field name="sequence"/>
</form>
</field>
</record>
<record id="crm_case_stage_act" model="ir.actions.act_window">
<field name="name">Stages</field>
<field name="res_model">crm.case.stage</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_case_stage_tree"/>
</record>
<menuitem action="crm_case_stage_act" id="menu_crm_case_stage_act" parent="crm.next_id_51"/>
<!-- Cases -->
<record id="crm_case_log_tree-view" model="ir.ui.view">
<field name="name">crm.case.log.tree</field>
@@ -441,6 +476,20 @@
</search>
</field>
</record>
<!-- graph view -->
<record model="ir.ui.view" id="crm_case_graph_view_stage_cost">
<field name="name">CRM -Graph</field>
<field name="model">crm.case</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Cases By Stage and Estimates" type="bar" orientation="vertical">
<field name="stage_id"/>
<field name="planned_cost" operator="+"/>
<field name="planned_revenue" operator="+"/>
</graph>
</field>
</record>
<record id="crm_case_categ0-act" model="ir.actions.act_window">
<field name="name">Cases</field>
@@ -464,7 +513,7 @@
<field name="res_model">crm.case</field>
<field name="domain">[('section_id','child_of',[active_id])]</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="view_mode">tree,form,calendar,graph</field>
</record>
<record id="ir_open_section_case" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>