[IMP] project issue form

bzr revid: fp@tinyerp.com-20100309095619-r2d676mg94jhsc1u
This commit is contained in:
Fabien Pinckaers 2010-03-09 10:56:19 +01:00
parent 33c94dc95f
commit 0129ecbcf7
3 changed files with 98 additions and 121 deletions

View File

@ -224,6 +224,7 @@ class crm_case(osv.osv):
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'email_cc': fields.text('Watchers Emails', size=252 , help="These people will receive a copy of the future" \
" communication between partner and users by email"),
'probability': fields.float('Probability'),
'email_last': fields.function(_email_last, method=True,
string='Latest E-Mail', type='text'),
'partner_id': fields.many2one('res.partner', 'Partner'),
@ -318,7 +319,7 @@ class crm_case(osv.osv):
if section in s:
st = case.stage_id.id or False
s[section] = dict([(v, k) for (k, v) in s[section].iteritems()])
if st in s[section]:
if st and st in s[section]:
stage_value = self.pool.get('crm.case.stage').read(cr, uid,s[section][st] ,['probability'], context)
self.write(cr, uid, [case.id], {'stage_id': s[section][st],'probability':stage_value['probability']})
return True

View File

@ -29,10 +29,8 @@ from tools.translate import _
import tools
from osv import fields,osv,orm
from osv.orm import except_orm
from crm import crm
class project_issue(osv.osv):
_name = "project.issue"
_description = "Project Issue"
@ -45,30 +43,22 @@ class project_issue(osv.osv):
'ref2' : fields.reference('Reference 2', selection=crm._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="[('object_id.model', '=', 'crm.project.bug')]"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'type_id': fields.many2one('crm.case.resource.type', 'Bug Type', domain="[('object_id.model', '=', 'project.issue')]"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Severity'),
'type_id': fields.many2one('crm.case.resource.type', 'Version', domain="[('object_id.model', '=', 'project.issue')]"),
'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="[('object_id.model', '=', 'project.issue')]"),
'project_id':fields.many2one('project.project', 'Project'),
'duration': fields.float('Duration'),
'probability': fields.float('Probability (%)'),
'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]")
}
def _get_project(self, cr, uid, context):
user = self.pool.get('res.users').browse(cr,uid,uid, context=context)
if user.context_project_id:
return user.context_project_id
return False
return False
def _convert(self, cr, uid, ids, xml_id, context=None):
data_obj = self.pool.get('ir.model.data')
@ -79,7 +69,7 @@ class project_issue(osv.osv):
if categ_id:
self.write(cr, uid, ids, {'categ_id': categ_id})
return True
def convert_to_feature(self, cr, uid, ids, context=None):
return self._convert(cr, uid, ids, 'feature_request_categ', context=context)
@ -92,14 +82,10 @@ class project_issue(osv.osv):
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
if not stage.on_change:
return {'value':{}}
return {'value':{'probability':stage.probability}}
return {'value':{}}
_defaults = {
'project_id':_get_project,
'probability':lambda *a:0.0,
'planned_cost':lambda *a:0.0,
'planned_revenue':lambda *a:0.0,
}
'project_id':_get_project,
}
project_issue()

View File

@ -11,22 +11,22 @@
<field name="name">Issue Categories</field>
<field name="res_model">crm.case.categ</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'project.issue')]</field>
<field name="context">{'object_id':'project.issue'}</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'project.issue')]</field>
<field name="context">{'object_id':'project.issue'}</field>
</record>
# ------------------------------------------------------
# Stage
# ------------------------------------------------------
<record id="project_issue_stage_act" model="ir.actions.act_window">
<field name="name">Issue Stages</field>
<field name="res_model">crm.case.stage</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_stage_tree"/>
<field name="domain">[('object_id.model', '=', 'project.issue')]</field>
<field name="context">{'object_id':'project.issue'}</field>
</record>
<menuitem action="project_issue_stage_act" id="menu_project_issue_stage_act" parent="crm.menu_crm_case_stage"/>
# Stage
# ------------------------------------------------------
<record id="project_issue_stage_act" model="ir.actions.act_window">
<field name="name">Issue Stages</field>
<field name="res_model">crm.case.stage</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_stage_tree"/>
<field name="domain">[('object_id.model', '=', 'project.issue')]</field>
<field name="context">{'object_id':'project.issue'}</field>
</record>
<menuitem action="project_issue_stage_act" id="menu_project_issue_stage_act" parent="crm.menu_crm_case_stage"/>
<record model="ir.ui.view" id="project_issue_form_view">
<field name="name">Project Issue Tracker Form</field>
@ -34,50 +34,38 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Issue Tracker Form">
<group colspan="4" col="6">
<field name="name" string="Title" colspan="2"/>
<field name="project_id" required="True"/>
<group colspan="3" col="4">
<field name="name"/>
<field name="user_id"/>
<field name="project_id" required="True"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'project.issue')]"/>
<group col="3" colspan="2">
<field name="task_id"/>
<button string="Convert To Task"
name="%(wizard_project_issue_task_set)d"
icon="gtk-index" type="action"
attrs="{'invisible':[('task_id','!=',False)]}" />
</group>
<group colspan="1" col="3">
<field name="task_id"/>
<button string="Convert To Task"
name="%(wizard_project_issue_task_set)d"
icon="gtk-index" type="action"
attrs="{'invisible':[('task_id','!=',False)]}"/>
<newline/>
<field name="stage_id" on_change="onchange_stage_id(stage_id)" domain="[('object_id.model', '=', 'project.issue')]"/>
<group colspan="1" col="2">
<button icon="gtk-go-back" string="" name="stage_previous" type="object"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
</group>
<!-- <group colspan="4" col="5">
<label string="" colspan="2"/>
<button string="Convert To Feature Request"
name="convert_to_feature"
icon="gtk-convert" type="object" attrs="{'invisible':[('categ_id','=',ref('bug_categ'))]}"/>
<button string="Convert To Bug"
name="convert_to_bug"
icon="gtk-convert" type="object" attrs="{'invisible':[('categ_id','=',ref('feature_request_categ'))]}"/>
</group> -->
</group>
<notebook colspan="4">
<page string="General">
<separator colspan="4" string="Communication"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" colspan="2"/>
<field name="partner_address_id" string="Contact" on_change="onchange_partner_address_id(partner_address_id, email_from)" colspan="1"/>
<field name="email_from" colspan="2"/>
<separator colspan="4" string="Status and Categorization"/>
<group colspan="4" col="6">
<field name="type_id" string="Version"/>
<field name="priority" string="Severity"/>
<field name="user_id" />
<label string="Resolution: " align="1.0"/>
<group colspan="1" col="3">
<field name="stage_id" select="1" nolabel="1" on_change="onchange_stage_id(stage_id)" domain="[('object_id.model', '=', 'project.issue')]"/>
<button icon="gtk-go-back" string="" name="stage_previous" type="object"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Communication"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)"/>
<field name="partner_address_id" string="Contact" on_change="onchange_partner_address_id(partner_address_id, email_from)"/>
<field name="email_from"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Status"/>
<field name="type_id"/>
<field name="priority"/>
</group>
<newline/>
<separator string= "Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4"/>
<separator colspan="4"/>
@ -92,25 +80,27 @@
</group>
</page>
<page string="History" groups="base.group_extended">
<field name="id" select="1"/>
<field name="active" />
<separator colspan="4" string="Dates"/>
<field name="create_date"/>
<field name="date_closed"/>
<separator colspan="4" string="Estimates"/>
<field name="planned_revenue"/>
<field name="planned_cost"/>
<field name="probability"/>
<separator colspan="4" string="References"/>
<field name="ref" colspan="4"/>
<field name="ref2" colspan="4"/>
<group col="2" colspan="2">
<separator colspan="2" string="Dates"/>
<field name="create_date"/>
<field name="date_closed"/>
</group>
<group col="2" colspan="2">
<separator string="References" colspan="2"/>
<field name="id"/>
<field name="active"/>
</group>
<group col="2" colspan="2">
<separator string="References" colspan="2"/>
<field name="ref" colspan="4"/>
<field name="ref2" colspan="4"/>
</group>
<field name="log_ids" nolabel="1" colspan="4">
<form string="Actions">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date" />
<field name="user_id" />
<field name="som" />
<field name="canal_id"/>
</form>
</field>
@ -126,9 +116,9 @@
<field name="email"/>
<field name="canal_id"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
@ -153,16 +143,16 @@
<field name="arch" type="xml">
<tree string="Issue Tracker Tree" colors="red:state=='open';black:state in ('draft', 'cancel','done','pending')">
<field name="id"/>
<field name="name" string="Title"/>
<field name="name"/>
<field name="partner_id"/>
<field name="priority" string="Severity"/>
<field name="stage_id" string="Resolution"/>
<button icon="gtk-go-back" string=""
name="stage_previous" type="object"
states="open,draft,pending,done,cancel" />
name="stage_previous" type="object"
states="open,draft,pending,done,cancel" />
<button icon="gtk-go-forward" string=""
name="stage_next" type="object"
states="open,draft,pending,done,cancel" />
name="stage_next" type="object"
states="open,draft,pending,done,cancel" />
<field name="type_id" string="Version"/>
<field name="user_id"/>
<field name="state"/>
@ -184,29 +174,29 @@
<search string="Issue Tracker Search">
<group col="3" colspan="1">
<filter icon="gtk-home" string=" Today "
separator="1"
domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"
help="Todays's bugs"
separator="1"
domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"
help="Todays's bugs"
/>
<filter icon="gtk-media-rewind"
string=" 7 Days " separator="1"
domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d')), ('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Bugs during last 7 days"
string=" 7 Days " separator="1"
domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d')), ('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Bugs during last 7 days"
/>
</group>
<separator orientation="vertical"/>
<group col="5" colspan="2">
<field name="name" select='1' string="Subject"/>
<field name="name" select='1' string="Subject"/>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My Bugs" default="1"/>
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My Bugs" default="1"/>
</field>
<field name="state" select="1">
<filter icon="gtk-new" domain="[('state','in',('open','draft'))]" help="Current Bugs" default="1"/>
<filter icon="gtk-yes" domain="[('state','=','open')]" help="Open Bugs"/>
</field>
<field name="project_id" select="1" widget="selection" string="Project" default="context.get('project_id', False)">
<filter icon="terp-crm"
<field name="project_id" select="1" widget="selection" string="Project" default="context.get('project_id', False)">
<filter icon="terp-crm"
domain="[('project_id','=',context.get('project_id',False))]"
help="My Project"
/>
@ -245,11 +235,11 @@
<field name="priority" string="Severity"/>
<field name="stage_id" string="Resolution"/>
<button icon="gtk-go-back" string=""
name="stage_previous" type="object"
states="open,draft,pending,done,cancel" />
name="stage_previous" type="object"
states="open,draft,pending,done,cancel" />
<button icon="gtk-go-forward" string=""
name="stage_next" type="object"
states="open,draft,pending,done,cancel" />
name="stage_next" type="object"
states="open,draft,pending,done,cancel" />
<field name="type_id" string="Version"/>
<field name="user_id"/>
<field name="state"/>
@ -263,7 +253,7 @@
</field>
</record>
<record id="view_project_feature_filter" model="ir.ui.view">
<record id="view_project_feature_filter" model="ir.ui.view">
<field name="name">Project Issue- Feature Tracker Search</field>
<field name="model">project.issue</field>
<field name="type">search</field>
@ -271,28 +261,28 @@
<search string="Feature Tracker Search">
<group col="3" colspan="1">
<filter icon="gtk-home" string=" Today "
separator="1"
domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"
help="Todays's features"
separator="1"
domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"
help="Todays's features"
/>
<filter icon="gtk-media-rewind"
string=" 7 Days " separator="1"
domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d')), ('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Features during last 7 days"
string=" 7 Days " separator="1"
domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d')), ('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Features during last 7 days"
/>
</group>
<separator orientation="vertical"/>
<group col="5" colspan="2">
<field name="name" select='1' string="Feature description"/>
<field name="name" select='1' string="Feature description"/>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My Features" default="1"/>
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My Features" default="1"/>
</field>
<field name="state" select="1">
<filter icon="gtk-new" domain="[('state','in',('open','draft'))]" help="Current Features" default="1"/>
<filter icon="gtk-yes" domain="[('state','=','open')]" help="Open Features"/>
</field>
<field name="project_id" select="1" widget="selection" string="Project" default="context.get('project_id', False)">
<filter icon="terp-crm"
<field name="project_id" select="1" widget="selection" string="Project" default="context.get('project_id', False)">
<filter icon="terp-crm"
domain="[('project_id','=',context.get('project_id',False))]"
help="My Project"
/>