[IMP]: Changed inheritance in crm_helpdesk.
bzr revid: uco@tinyerp.co.in-20100111121827-nreyoue18vj2x1np
This commit is contained in:
@@ -83,7 +83,8 @@ between mails and Open ERP.""",
|
||||
'crm_phonecall_view.xml',
|
||||
'crm_phonecall_menu.xml',
|
||||
# 'crm_report_view.xml',
|
||||
'crm_helpdesk_view.xml',
|
||||
'crm_helpdesk_view.xml',
|
||||
'crm_helpdesk_menu.xml',
|
||||
#'crm_report.xml',
|
||||
'security/crm_security.xml',
|
||||
#'security/ir.model.access.csv',
|
||||
|
||||
+30
-43
@@ -32,48 +32,42 @@ import tools
|
||||
from osv import fields,osv,orm
|
||||
from osv.orm import except_orm
|
||||
|
||||
AVAILABLE_PRIORITIES = [
|
||||
('5','Lowest'),
|
||||
('4','Low'),
|
||||
('3','Normal'),
|
||||
('2','High'),
|
||||
('1','Highest')
|
||||
]
|
||||
|
||||
def _links_get(self, cr, uid, context={}):
|
||||
obj = self.pool.get('res.request.link')
|
||||
ids = obj.search(cr, uid, [])
|
||||
res = obj.read(cr, uid, ids, ['object', 'name'], context)
|
||||
return [(r['object'], r['name']) for r in res]
|
||||
|
||||
class crm_helpdesk(osv.osv):
|
||||
_name = "crm.helpdesk"
|
||||
_description = "Helpdesk Cases"
|
||||
_order = "id desc"
|
||||
_inherits = {'crm.case':"inherit_case_id"}
|
||||
_inherit = 'crm.case'
|
||||
_columns = {
|
||||
'inherit_case_id':fields.many2one('crm.case','Case'),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'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." \
|
||||
" 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'),
|
||||
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'probability': fields.float('Probability (%)'),
|
||||
'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)."),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id)]", help='Category related to the section.Subdivide the CRM cases independently or section-wise.'),
|
||||
'duration': fields.float('Duration'),
|
||||
}
|
||||
|
||||
def _map_ids(self, method, cr, uid, ids, *args, **argv):
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
else:
|
||||
select = ids
|
||||
case_data = self.browse(cr, uid, select)
|
||||
new_ids = []
|
||||
for case in case_data:
|
||||
if case.inherit_case_id:
|
||||
new_ids.append(case.inherit_case_id.id)
|
||||
res = getattr(self.pool.get('crm.case'),method)(cr, uid, new_ids, *args, **argv)
|
||||
if isinstance(ids, (str, int, long)) and isinstance(res, list):
|
||||
return res and res[0] or False
|
||||
return res
|
||||
|
||||
|
||||
def onchange_case_id(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('onchange_case_id',cr,uid,ids,*args,**argv)
|
||||
def onchange_partner_id(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('onchange_partner_id',cr,uid,ids,*args,**argv)
|
||||
def onchange_partner_address_id(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('onchange_partner_address_id',cr,uid,ids,*args,**argv)
|
||||
def onchange_categ_id(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('onchange_categ_id',cr,uid,ids,*args,**argv)
|
||||
def case_close(self,cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('case_close',cr,uid,ids,*args,**argv)
|
||||
def case_open(self,cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('case_open',cr,uid,ids,*args,**argv)
|
||||
def case_cancel(self,cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('case_cancel',cr,uid,ids,*args,**argv)
|
||||
def case_reset(self,cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
|
||||
|
||||
|
||||
def msg_new(self, cr, uid, msg):
|
||||
mailgate_obj = self.pool.get('mail.gateway')
|
||||
msg_body = mailgate_obj.msg_body_get(msg)
|
||||
@@ -91,13 +85,6 @@ class crm_helpdesk(osv.osv):
|
||||
res = self.create(cr, uid, data)
|
||||
return res
|
||||
|
||||
def msg_update(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('msg_update',cr, uid, ids, *args, **argv)
|
||||
def emails_get(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('emails_get',cr, uid, ids, *args, **argv)
|
||||
def msg_send(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
|
||||
|
||||
crm_helpdesk()
|
||||
|
||||
class crm_helpdesk_assign_wizard(osv.osv_memory):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
######################## Help Desk (menu) ###########################
|
||||
<record model="ir.actions.act_window" id="crm_case_helpdesk_act111">
|
||||
<field name="name">All Helpdesk Requests</field>
|
||||
<field name="res_model">crm.case</field>
|
||||
<field name="res_model">crm.helpdesk</field>
|
||||
<field name="view_mode">tree,calendar,form</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_helpdesk"/>
|
||||
<field name="domain" eval="'[(\'section_id\',\'=\','+str(ref('section_support_help'))+')]'"/>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_form_view_helpdesk">
|
||||
<field name="name">CRM - Helpdesk Support Form</field>
|
||||
<field name="model">crm.case</field>
|
||||
<field name="model">crm.helpdesk</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Helpdesk Support">
|
||||
@@ -150,7 +150,7 @@
|
||||
</record>
|
||||
<record model="ir.ui.view" id="crm_case_tree_view_helpdesk">
|
||||
<field name="name">CRM - Helpdesk Support Tree</field>
|
||||
<field name="model">crm.case</field>
|
||||
<field name="model">crm.helpdesk</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Helpdesk Support Tree" colors="red:state=='open';black:state in ('draft', 'cancel','done','pending')">
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_helpdesk_calendar_view">
|
||||
<field name="name">CRM - Helpdesk Support Calendar</field>
|
||||
<field name="model">crm.case</field>
|
||||
<field name="model">crm.helpdesk</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
Reference in New Issue
Block a user