[IMP]: Removed some fields from crm.case. Changed crm.claim inheritance from _inherits to _inherit.
bzr revid: uco@tinyerp.co.in-20100111111120-yl8hfuqesbj35i3m
This commit is contained in:
+1
-23
@@ -375,14 +375,9 @@ class crm_case(osv.osv):
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'name': fields.char('Description',size=64,required=True),
|
||||
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the case without removing it."),
|
||||
'description': fields.text('Your action'),
|
||||
'section_id': fields.many2one('crm.case.section', 'Section', select=True, help='Section to which Case belongs to. Define Responsible user and Email account for mail gateway.'),
|
||||
'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.'),
|
||||
'planned_revenue': fields.float('Planned Revenue'),
|
||||
'planned_cost': fields.float('Planned Costs'),
|
||||
'probability': fields.float('Probability (%)'),
|
||||
'email_from': fields.char('Partner Email', size=128, help="These people will receive email."),
|
||||
'email_cc': fields.char('Watchers Emails', size=252 , help="These people will receive a copy of the future" \
|
||||
" communication between partner and users by email"),
|
||||
@@ -390,15 +385,9 @@ class crm_case(osv.osv):
|
||||
string='Latest E-Mail', type='text'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', domain="[('partner_id','=',partner_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)."),
|
||||
'date': fields.datetime('Date'),
|
||||
'create_date': fields.datetime('Created' ,readonly=True),
|
||||
'date_deadline': fields.datetime('Deadline'),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'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."),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'history_line': fields.one2many('crm.case.history', 'case_id', 'Communication', readonly=1),
|
||||
'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History', readonly=1),
|
||||
@@ -407,20 +396,10 @@ class crm_case(osv.osv):
|
||||
\nIf the case is in progress the state is set to \'Open\'.\
|
||||
\nWhen the case is over, the state is set to \'Done\'.\
|
||||
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
|
||||
'ref' : fields.reference('Reference', selection=_links_get, size=128),
|
||||
'ref2' : fields.reference('Reference 2', selection=_links_get, size=128),
|
||||
|
||||
'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):
|
||||
@@ -457,11 +436,10 @@ class crm_case(osv.osv):
|
||||
'partner_address_id': _get_default_partner_address,
|
||||
'email_from': _get_default_email,
|
||||
'state': lambda *a: 'draft',
|
||||
'priority': lambda *a: AVAILABLE_PRIORITIES[2][0],
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'section_id': _get_section,
|
||||
}
|
||||
_order = 'priority, date_deadline desc, date desc,id desc'
|
||||
_order = 'date_deadline desc, date desc,id desc'
|
||||
|
||||
def unlink(self, cr, uid, ids, context={}):
|
||||
for case in self.browse(cr, uid, ids, context):
|
||||
|
||||
+40
-47
@@ -26,52 +26,51 @@ import pooler
|
||||
import netsvc
|
||||
from tools.translate import _
|
||||
|
||||
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_claim(osv.osv):
|
||||
_name = "crm.claim"
|
||||
_description = "Claim Cases"
|
||||
_order = "id desc"
|
||||
_inherits = {'crm.case':"inherit_case_id"}
|
||||
_inherit = 'crm.case'
|
||||
_table = 'crm_claim'
|
||||
_columns = {
|
||||
'inherit_case_id': fields.many2one('crm.case','Case',ondelete='cascade'),
|
||||
'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'),
|
||||
'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.'),
|
||||
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'category2_id': fields.many2one('crm.case.category2', 'Category Name', 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)]"),
|
||||
'case_id': fields.many2one('crm.case', 'Related Case'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'priority': lambda *a: AVAILABLE_PRIORITIES[2][0],
|
||||
}
|
||||
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 stage_next(self, cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('stage_next',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 case_escalate(self,cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
|
||||
def case_pending(self,cr, uid, ids, *args, **argv):
|
||||
return self._map_ids('case_pending',cr,uid,ids,*args,**argv)
|
||||
|
||||
def msg_new(self, cr, uid, msg):
|
||||
mailgate_obj = self.pool.get('mail.gateway')
|
||||
@@ -90,12 +89,6 @@ class crm_claim(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_claim()
|
||||
|
||||
|
||||
@@ -132,7 +125,7 @@ class crm_claim_assign_wizard(osv.osv_memory):
|
||||
{
|
||||
'section_id':res.get('section_id',False),
|
||||
'user_id':res.get('user_id',False),
|
||||
'case_id' : case.inherit_case_id.id
|
||||
'case_id' : case.id
|
||||
}, context=context)
|
||||
case_obj.case_close(cr, uid, [case_id])
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="name">All Claims</field>
|
||||
<field name="res_model">crm.claim</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,calendar</field>
|
||||
<field name="view_mode">tree,calendar,form,graph</field>
|
||||
<field name="view_id" ref="crm_case_claims_tree_view"/>
|
||||
<field name="context" eval="{'default_state':'open'}"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_claims_filter"/>
|
||||
@@ -31,6 +31,12 @@
|
||||
<field name="view_id" ref="crm_case_claims_form_view"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_claim0"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_sec_graph_view_act_job">
|
||||
<field name="sequence" eval="4"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="crm_case_graph_view_stage_cost"/>
|
||||
<field name="act_window_id" ref="crm_case_categ_claim0"/>
|
||||
</record>
|
||||
<menuitem name="Claims" id="menu_crm_case_claims" parent="menu_aftersale" action="crm_case_categ_claim0"/>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
<field name="partner_id"/>
|
||||
<field name="date" string="Date"/>
|
||||
<field name="categ_id" string="Type" select="1"/>
|
||||
<field name="user_id" string="Responsible" select="2"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -179,6 +178,19 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_graph_view_stage_cost">
|
||||
<field name="name">CRM -Graph</field>
|
||||
<field name="model">crm.claim</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="view_crm_case_claims_filter" model="ir.ui.view">
|
||||
<field name="name">CRM - Claims Search</field>
|
||||
<field name="model">crm.claim</field>
|
||||
|
||||
+10
-39
@@ -340,9 +340,6 @@
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="priority"/>
|
||||
<field name="planned_revenue" sum="Planned revenue"/>
|
||||
<field name="planned_cost" sum="Planned costs"/>
|
||||
<field name="state"/>
|
||||
<button name="case_close" states="open,draft,pending" string="Close" type="object" icon="gtk-close"/>
|
||||
<button name="case_open" states="draft,pending" string="Open" type="object" icon="gtk-go-forward"/>
|
||||
@@ -365,20 +362,18 @@
|
||||
<field colspan="2" name="section_id" widget="selection"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="date_deadline" select="2"/>
|
||||
<field name="priority"/>
|
||||
<newline />
|
||||
<notebook colspan="4">
|
||||
<page string="General">
|
||||
<group col="8" colspan="4">
|
||||
<field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" select="1"/>
|
||||
<field colspan="3" name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)" select="2"/>
|
||||
<newline/>
|
||||
<field colspan="3" name="email_from" select="2"/>
|
||||
<button name="remind_partner" states="open,pending" string="Send Reminder" type="object" icon="gtk-go-forward"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<button name="remind_user" states="open,pending" string="Send Reminder" type="object" icon="gtk-go-forward"/>
|
||||
</group>
|
||||
|
||||
<group col="8" colspan="4">
|
||||
<field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" select="1"/>
|
||||
<field colspan="3" name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)" select="2"/>
|
||||
<newline/>
|
||||
<field colspan="3" name="email_from" select="2"/>
|
||||
<button name="remind_partner" states="open,pending" string="Send Reminder" type="object" icon="gtk-go-forward"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<button name="remind_user" states="open,pending" string="Send Reminder" type="object" icon="gtk-go-forward"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Description"/>
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<separator colspan="4"/>
|
||||
@@ -395,20 +390,10 @@
|
||||
<page string="History">
|
||||
<field name="id" select="1"/>
|
||||
<field name="active" select="2"/>
|
||||
<field name="categ_id" on_change="onchange_categ_id(categ_id)" select="2"/>
|
||||
<field name="som" select="2"/>
|
||||
<separator colspan="4" string="Dates"/>
|
||||
<field name="create_date"/>
|
||||
<field name="date_closed"/>
|
||||
<field name="date_action_last"/>
|
||||
<field name="date_action_next"/>
|
||||
<separator colspan="4" string="Estimates"/>
|
||||
<field name="planned_revenue"/>
|
||||
<field name="planned_cost"/>
|
||||
<field name="probability"/>
|
||||
<separator colspan="4" string="References"/>
|
||||
<field colspan="4" name="ref"/>
|
||||
<field colspan="4" name="ref2"/>
|
||||
<field colspan="4" name="log_ids" nolabel="1">
|
||||
<form string="Actions">
|
||||
<separator colspan="4" string="Action Information"/>
|
||||
@@ -477,20 +462,6 @@
|
||||
</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>
|
||||
<field name="res_model">crm.case</field>
|
||||
@@ -513,7 +484,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,graph</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
</record>
|
||||
<record id="ir_open_section_case" model="ir.values">
|
||||
<field eval="'tree_but_open'" name="key2"/>
|
||||
|
||||
Reference in New Issue
Block a user