[IMP]crm: Improved a state field based on stage
bzr revid: mma@tinyerp.com-20120406091623-9nqb5lryhueku068
This commit is contained in:
@@ -71,12 +71,18 @@ class crm_case_stage(osv.osv):
|
||||
'on_change': fields.boolean('Change Probability Automatically', help="Setting this stage will change the probability automatically on the opportunity."),
|
||||
'requirements': fields.text('Requirements'),
|
||||
'section_ids':fields.many2many('crm.case.section', 'section_stage_rel', 'stage_id', 'section_id', 'Sections'),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16,
|
||||
help='The state is set to \'Draft\', when a case is created.\
|
||||
\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\'.'),
|
||||
'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."),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'sequence': lambda *args: 1,
|
||||
'probability': lambda *args: 0.0,
|
||||
'state': lambda *a: 'draft',
|
||||
}
|
||||
|
||||
class crm_case_section(osv.osv):
|
||||
|
||||
@@ -175,11 +175,7 @@ class crm_lead(crm_case, osv.osv):
|
||||
multi='day_open', type="float", store=True),
|
||||
'day_close': fields.function(_compute_day, string='Days to Close', \
|
||||
multi='day_close', type="float", store=True),
|
||||
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
|
||||
help='The state is set to \'Draft\', when a case is created.\
|
||||
\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\'.'),
|
||||
'state': fields.related('stage_id','state', type='char', selection=crm.AVAILABLE_STATES, string="State", store=True, readonly=True),
|
||||
'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
|
||||
'subjects': fields.function(_get_email_subject, fnct_search=_history_search, string='Subject of Email', type='char', size=64),
|
||||
|
||||
|
||||
@@ -503,8 +503,8 @@
|
||||
<separator colspan="4" string="Details"/>
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
|
||||
<separator colspan="4"/>
|
||||
<group col="10" colspan="4">
|
||||
<separator colspan="4" groups="base.group_no_one"/>
|
||||
<group col="10" colspan="4" groups="base.group_no_one">
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||
<button name="case_cancel" string="Cancel" states="draft" type="object" icon="gtk-cancel" />
|
||||
<button name="case_mark_lost" string="Mark Lost" states="open,pending" type="object" icon="gtk-cancel" />
|
||||
@@ -618,7 +618,7 @@
|
||||
<field name="user_id"/>
|
||||
<field name="priority" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="state"/>
|
||||
<field name="state" groups="base.group_no_one"/>
|
||||
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" />
|
||||
<button name="case_pending" string="Pending" states="open,draft" type="object" icon="gtk-media-pause" />
|
||||
<button name="case_mark_lost" string="Lost" states="open,pending" type="object" icon="gtk-cancel" />
|
||||
@@ -638,15 +638,15 @@
|
||||
<filter icon="terp-check"
|
||||
string="New" help="New Opportunities"
|
||||
name="new"
|
||||
domain="[('state','=','draft')]"/>
|
||||
domain="[('state','=','draft')]" groups="base.group_no_one"/>
|
||||
<filter icon="terp-camera_test"
|
||||
string="Open" help="Open Opportunities"
|
||||
name="open"
|
||||
domain="[('state','=','open')]"/>
|
||||
domain="[('state','=','open')]" groups="base.group_no_one"/>
|
||||
<filter icon="terp-gtk-media-pause"
|
||||
string="Pending" help="Pending Opportunities"
|
||||
name="pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
domain="[('state','=','pending')]" groups="base.group_no_one"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" string="Opportunity / Customer"
|
||||
filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/>
|
||||
@@ -679,7 +679,7 @@
|
||||
<filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'categ_id'}" />
|
||||
<filter string="Campaign" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'type_id'}" groups="base.group_extended"/>
|
||||
<filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}" />
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" groups="base.group_no_one"/>
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Creation" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" groups="base.group_no_one"/>
|
||||
<filter string="Exp.Closing" icon="terp-go-month" help="Expected Closing" domain="[]" context="{'group_by':'date_deadline'}" />
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
<field name="on_change"/>
|
||||
<field name="case_default"/>
|
||||
<field name="sequence"/>
|
||||
<field name="state"/>
|
||||
</group>
|
||||
<separator string="Requirements" colspan="4"/>
|
||||
<field name="requirements" nolabel="1" colspan="4"/>
|
||||
|
||||
Reference in New Issue
Block a user