[IMP] crm_claim: added crm.claim.stage, because claim stages should be different from opportunity stages. Updated the module to use them.
bzr revid: tde@openerp.com-20120530130058-23j8o61vbwzikk35
This commit is contained in:
parent
5727d7372b
commit
ca6f8dc624
|
@ -36,6 +36,34 @@ CRM_CLAIM_PENDING_STATES = (
|
|||
crm.AVAILABLE_STATES[4][0], # Pending
|
||||
)
|
||||
|
||||
class crm_claim_stage(osv.osv):
|
||||
""" Model for claim stages. This models the main stages of a claim
|
||||
management flow. Main CRM objects (leads, opportunities, project
|
||||
issues, ...) will now use only stages, instead of state and stages.
|
||||
Stages are for example used to display the kanban view of records.
|
||||
"""
|
||||
_name = "crm.claim.stage"
|
||||
_description = "Claim stages"
|
||||
_rec_name = 'name'
|
||||
_order = "sequence"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Stage Name', size=64, required=True, translate=True),
|
||||
'sequence': fields.integer('Sequence', help="Used to order stages. Lower is better."),
|
||||
'section_ids':fields.many2many('crm.case.section', 'section_claim_stage_rel', 'stage_id', 'section_id', string='Sections',
|
||||
help="Link between stages and sales teams. When set, this limitate the current stage to the selected sales teams."),
|
||||
'state': fields.selection(crm.AVAILABLE_STATES, 'State', required=True, help="The related state for the stage. The state of your document will automatically change regarding the selected stage. For example, if a stage is related to the state 'Close', when your document reaches this stage, it will be automatically have the 'closed' state."),
|
||||
'case_default': fields.boolean('Common to All Teams',
|
||||
help="If you check this field, this stage will be proposed by default on each sales team. It will not assign this stage to existing teams."),
|
||||
'fold': fields.boolean('Hide in Views when Empty',
|
||||
help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'sequence': lambda *args: 1,
|
||||
'state': 'draft',
|
||||
'fold': False,
|
||||
}
|
||||
|
||||
class crm_claim(base_stage, osv.osv):
|
||||
""" Crm claim
|
||||
|
@ -74,7 +102,7 @@ class crm_claim(base_stage, osv.osv):
|
|||
'email_cc': fields.text('Watchers Emails', size=252, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
|
||||
'email_from': fields.char('Email', size=128, help="These people will receive email."),
|
||||
'partner_phone': fields.char('Phone', size=32),
|
||||
'stage_id': fields.many2one ('crm.case.stage', 'Stage',
|
||||
'stage_id': fields.many2one ('crm.claim.stage', 'Stage',
|
||||
domain="['|', ('section_ids', '=', section_id), ('case_default', '=', True)]"),
|
||||
'cause': fields.text('Root Cause'),
|
||||
'state': fields.related('stage_id', 'state', type="selection", store=True,
|
||||
|
@ -114,7 +142,7 @@ class crm_claim(base_stage, osv.osv):
|
|||
lead_section_id = lead.section_id.id if lead.section_id else None
|
||||
if lead_section_id:
|
||||
domain += ['|', ('section_ids', '=', lead_section_id), ('case_default', '=', True)]
|
||||
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, domain, order=order, context=context)
|
||||
stage_ids = self.pool.get('crm.claim.stage').search(cr, uid, domain, order=order, context=context)
|
||||
if stage_ids:
|
||||
return stage_ids[0]
|
||||
return False
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<!--
|
||||
<data noupdate="1">
|
||||
|
||||
-->
|
||||
<data>
|
||||
<!--
|
||||
Claims Categories
|
||||
-->
|
||||
|
@ -42,31 +44,38 @@
|
|||
Case Stage
|
||||
-->
|
||||
|
||||
<record model="crm.case.stage" id="stage_claim1">
|
||||
<field name="name">Accepted as Claim</field>
|
||||
<record model="crm.claim.stage" id="stage_claim1">
|
||||
<field name="name">Draft</field>
|
||||
<field name="state">draft</field>
|
||||
<field name="sequence">26</field>
|
||||
<field name="case_default" eval="True"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_claim5">
|
||||
<record model="crm.claim.stage" id="stage_claim5">
|
||||
<field name="name">Actions Defined</field>
|
||||
<field name="state">open</field>
|
||||
<field name="sequence">27</field>
|
||||
<field name="case_default" eval="True"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_claim2">
|
||||
<record model="crm.claim.stage" id="stage_claim2">
|
||||
<field name="name">Actions Done</field>
|
||||
<field name="state">done</field>
|
||||
<field name="sequence">28</field>
|
||||
<field name="case_default" eval="True"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_claim3">
|
||||
<field name="name">Won't fix</field>
|
||||
<record model="crm.claim.stage" id="stage_claim3">
|
||||
<field name="name">Refused</field>
|
||||
<field name="state">done</field>
|
||||
<field name="sequence">29</field>
|
||||
<field name="case_default" eval="True"/>
|
||||
<field name="fold" eval="True"/>
|
||||
</record>
|
||||
<record model="crm.claim.stage" id="stage_claim3">
|
||||
<field name="name">Cancelled</field>
|
||||
<field name="state">cancel</field>
|
||||
<field name="sequence">30</field>
|
||||
<field name="case_default" eval="True"/>
|
||||
<field name="fold" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.section" id="crm.section_sales_department">
|
||||
<field name="name">Sales Department</field>
|
||||
<field name="code">Sales</field>
|
||||
<field name="stage_ids" eval="[(4, ref('stage_claim1')), (4, ref('stage_claim2')), (4, ref('stage_claim3')), (4, ref('stage_claim5'))]"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<field name="stage_id" invisible="1"/>
|
||||
<field name="date_deadline" invisible="1"/>
|
||||
<field name="date_closed" invisible="1"/>
|
||||
<field name="state" groups="base.group_no_one"/>
|
||||
<field name="stage_id"/>
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" groups="base.group_no_one"/>
|
||||
|
|
Loading…
Reference in New Issue