added changes for project
bzr revid: gpa@tinyerp.com-20100929150702-209fgqoz1am8n4cb
This commit is contained in:
parent
3589a2fc9b
commit
7f728b9e80
|
@ -364,7 +364,7 @@ class task(osv.osv):
|
|||
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
res[task.id] = {'effective_hours': hours.get(task.id, 0.0), 'total_hours': task.remaining_hours + hours.get(task.id, 0.0)}
|
||||
res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours
|
||||
res[task.id]['delay_hours'] = res[task.id]['total_hours'] - res[task.id]['effective_hours']
|
||||
res[task.id]['progress'] = 0.0
|
||||
if (task.remaining_hours + hours.get(task.id, 0.0)):
|
||||
res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2)
|
||||
|
@ -647,7 +647,7 @@ class task(osv.osv):
|
|||
'name': newname,
|
||||
}, context)
|
||||
if delegate_data['state'] == 'pending':
|
||||
self.do_pending(cr, uid, [task.id], context)
|
||||
self.do_open(cr, uid, [task.id], context)
|
||||
else:
|
||||
self.do_close(cr, uid, [task.id], context)
|
||||
user_pool = self.pool.get('res.users')
|
||||
|
|
|
@ -301,8 +301,9 @@
|
|||
<field name="type">tree</field>
|
||||
<field eval="2" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours<0 and state in ('pending');red:bool(date_deadline) and (date_deadline<current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
|
||||
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours<0 and state in ('pending');red:date_deadline and (date_deadline>current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
|
||||
<field name="sequence" invisible="not context.get('seq_visible', False)"/>
|
||||
<field name="id"/>
|
||||
<field name="name"/>
|
||||
<field name="project_id" icon="gtk-indent" domain="['|',('user_id','=',uid),('members','=',uid)]"/>
|
||||
<field name="user_id"/>
|
||||
|
|
|
@ -72,7 +72,7 @@ class report_project_task_user(osv.osv):
|
|||
date_trunc('day',t.date_end) as date_end,
|
||||
to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_deadline,
|
||||
-- sum(cast(to_char(date_trunc('day',t.date_end) - date_trunc('day',t.date_start),'DD') as int)) as no_of_days,
|
||||
(extract('epoch' from (t.date_end-t.date_start)))/(3600*24) as no_of_days,
|
||||
abs((extract('epoch' from (t.date_end-t.date_start)))/(3600*24)) as no_of_days,
|
||||
t.user_id,
|
||||
progress as progress,
|
||||
t.project_id,
|
||||
|
|
|
@ -141,7 +141,7 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
else:
|
||||
res[issue.id][field] = abs(float(duration))
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID'),
|
||||
'name': fields.char('Name', size=128, required=True),
|
||||
|
@ -193,6 +193,7 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
|
||||
'date_action_last': fields.datetime('Last Action', readonly=1),
|
||||
'date_action_next': fields.datetime('Next Action', readonly=1),
|
||||
'progress': fields.related('task_id', 'progress', string='Progress (%)',group_operator="avg", store=True),
|
||||
}
|
||||
|
||||
def _get_project(self, cr, uid, context):
|
||||
|
@ -245,6 +246,7 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
|
||||
vals = {
|
||||
'task_id': new_task_id,
|
||||
'state':'open'
|
||||
}
|
||||
case_obj.write(cr, uid, [bug.id], vals)
|
||||
|
||||
|
@ -286,6 +288,15 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
if not stage.on_change:
|
||||
return {'value':{}}
|
||||
return {'value':{}}
|
||||
|
||||
def onchange_task_id(self, cr, uid, ids, task_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = {}
|
||||
if not task_id:
|
||||
return {'value':{}}
|
||||
task = self.pool.get('project.task').browse(cr, uid, task_id, context)
|
||||
return {'value':{'assigned_to': task.user_id.id,}}
|
||||
|
||||
def case_escalate(self, cr, uid, ids, *args):
|
||||
"""Escalates case to top level
|
||||
|
@ -405,6 +416,17 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
@param **args: Return Dictionary of Keyword Value
|
||||
"""
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not context:
|
||||
context={}
|
||||
issue = self.read(cr, uid, id, ['name'], context=context)
|
||||
if not default:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
default['name'] = issue['name'] + _(' (copy)')
|
||||
return super(project_issue, self).copy(cr, uid, id, default=default,
|
||||
context=context)
|
||||
|
||||
project_issue()
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="progress" widget="progressbar"/>
|
||||
<notebook colspan="4">
|
||||
<page string="General">
|
||||
<group col="2" colspan="2">
|
||||
|
@ -85,7 +86,7 @@
|
|||
<separator colspan="3" string="Status"/>
|
||||
<field name="version_id" colspan="3" widget="selection"/>
|
||||
<field name="priority" colspan="3"/>
|
||||
<field name="task_id" />
|
||||
<field name="task_id" on_change="onchange_task_id(task_id)"/>
|
||||
<button string="Convert To Task" name="convert_issue_task" icon="gtk-index" type="object"
|
||||
attrs="{'invisible':[('task_id','!=',False)]}" />
|
||||
</group>
|
||||
|
|
|
@ -24,6 +24,7 @@ from tools.translate import _
|
|||
from osv import fields, osv
|
||||
from resource.faces import task as Task
|
||||
import operator
|
||||
from mx import DateTime
|
||||
|
||||
class project_phase(osv.osv):
|
||||
_name = "project.phase"
|
||||
|
@ -90,6 +91,19 @@ class project_phase(osv.osv):
|
|||
model_data_obj = self.pool.get('ir.model.data')
|
||||
model_data_id = model_data_obj._get_id(cr, uid, 'product', 'uom_hour')
|
||||
return model_data_obj.read(cr, uid, [model_data_id], ['res_id'])[0]['res_id']
|
||||
|
||||
def _compute(self, cr, uid, ids, context=None):
|
||||
res = {}
|
||||
if not ids:
|
||||
return res
|
||||
for phase in self.browse(cr, uid, ids, context=context):
|
||||
tot = 0.0
|
||||
for task in phase.task_ids:
|
||||
tot += task.planned_hours
|
||||
res[phase.id] = {
|
||||
'total_hours' : tot
|
||||
}
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char("Name", size=64, required=True),
|
||||
|
@ -108,7 +122,8 @@ class project_phase(osv.osv):
|
|||
'responsible_id': fields.many2one('res.users', 'Responsible', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
|
||||
help='If the phase is created the state \'Draft\'.\n If the phase is started, the state becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' state.\
|
||||
\n If the phase is over, the states is set to \'Done\'.')
|
||||
\n If the phase is over, the states is set to \'Done\'.'),
|
||||
'total_hours': fields.function(_compute, method=True, string='Total Hours'),
|
||||
}
|
||||
_defaults = {
|
||||
'responsible_id': lambda obj,cr,uid,context: uid,
|
||||
|
@ -130,6 +145,14 @@ class project_phase(osv.osv):
|
|||
project_id = project_obj.browse(cr, uid, project, context=context)
|
||||
result['date_start'] = project_id.date_start
|
||||
return {'value': result}
|
||||
|
||||
def onchange_days(self, cr, uid, ids, project, context=None):
|
||||
result = {}
|
||||
for id in ids:
|
||||
project_id = self.browse(cr, uid, id, context=context)
|
||||
newdate = DateTime.strptime(project_id.date_start, '%Y-%m-%d') + DateTime.RelativeDateTime(days=project_id.duration or 0.0)
|
||||
result['date_end'] = newdate.strftime('%Y-%m-%d')
|
||||
return {'value': result}
|
||||
|
||||
def _check_date_start(self, cr, uid, phase, date_end, context=None):
|
||||
if context is None:
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<group colspan="2" col="4">
|
||||
<field name="project_id" on_change="onchange_project(project_id)" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="duration" colspan="1"/>
|
||||
<field name="duration" colspan="1" on_change="onchange_days(project_id)" />
|
||||
<field name="product_uom" nolabel="1" domain="[('category_id.name', '=', 'Working Time')]"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
|
@ -134,6 +134,7 @@
|
|||
<field name="user_id"/>
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="project_id" invisible="1"/>
|
||||
<field name="total_hours" sum='Total Hours'/>
|
||||
</tree>
|
||||
<form string="Project's Tasks">
|
||||
<notebook colspan="4">
|
||||
|
@ -151,6 +152,7 @@
|
|||
<group colspan="2" col="2">
|
||||
<separator string="Planning" colspan="2"/>
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="total_hours" widget="float_time"/>
|
||||
<field name="remaining_hours" widget="float_time" sum="Remaining Hours"/>
|
||||
<field name="effective_hours" invisible="1"/>
|
||||
</group>
|
||||
|
@ -299,7 +301,30 @@
|
|||
# ------------------------------------------------------
|
||||
# Project Task
|
||||
# ------------------------------------------------------
|
||||
|
||||
|
||||
<record id="view_phase_task_form2" model="ir.ui.view">
|
||||
<field name="name">phase.task.form2</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="project.view_task_form2"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="sequence" position="after">
|
||||
<field name="phase_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_phase_task_search_form" model="ir.ui.view">
|
||||
<field name="name">phase.task.search.form</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">search</field>
|
||||
<field name="inherit_id" ref="project.view_task_search_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="project_id" position="after">
|
||||
<field name="phase_id" select="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
id="project_phase_task_list"
|
||||
name="Related Tasks"
|
||||
|
|
|
@ -35,6 +35,7 @@ class messages(osv.osv):
|
|||
'project_id': fields.many2one('project.project', 'Project',
|
||||
required=True, ondelete="CASCADE"),
|
||||
'message': fields.text('Message', required=True),
|
||||
'date': fields.datetime('Date'),
|
||||
}
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<newline/>
|
||||
<separator colspan="4" string="Message"/>
|
||||
<field name="message" colspan="4" nolabel="1"/>
|
||||
<field name="date"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -67,12 +68,13 @@
|
|||
<field name="model">project.messages</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Communication Messages">
|
||||
<search string="Porject Messages">
|
||||
<group>
|
||||
<field name="project_id"/>
|
||||
<field name="from_id"/>
|
||||
<field name="to_id"/>
|
||||
<field name="message"/>
|
||||
<filter icon="terp-go-today" string="Today" separator="1" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="20">
|
||||
|
@ -86,7 +88,7 @@
|
|||
</record>
|
||||
|
||||
<record id="messages_form" model="ir.actions.act_window">
|
||||
<field name="name">Communication Messages</field>
|
||||
<field name="name">Project Messages</field>
|
||||
<field name="res_model">project.messages</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="search_view_id" ref="view_project_messages_search"/>
|
||||
|
|
|
@ -278,7 +278,6 @@
|
|||
<search string="Planning statistics">
|
||||
<group col="10" colspan="4">
|
||||
<filter icon="gtk-execute" string="My" domain="[('user_id','=',uid),('planning_id.state','<>','cancel')]" help="My Plannings Statistics"/>
|
||||
<filter icon="gtk-execute" string="My Project" domain="[('manager_id','=',uid),('planning_id.state','<>','cancel')]" help="Planning Statistics of My Projects"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="planning_id" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
|
@ -294,6 +293,7 @@
|
|||
<field name="res_model">report_account_analytic.planning.stat</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="context">{"search_default_user_id":uid}</field>
|
||||
<field name="search_view_id" ref="account_analytic_planning_stat_view_search"/>
|
||||
</record>
|
||||
<menuitem id="next_id_85" name="Planning"
|
||||
|
|
|
@ -257,7 +257,7 @@ class project_scrum_product_backlog(osv.osv):
|
|||
'name' : fields.char('Feature', size=64, required=True),
|
||||
'note' : fields.text('Note'),
|
||||
'active' : fields.boolean('Active', help="If Active field is set to true, it will allow you to hide the product backlog without removing it."),
|
||||
'project_id': fields.many2one('project.project', 'Project', required=True, domain=[('scrum','=',1)], help="If you have [?] in the project name, it means there are no analytic account linked to this project."),
|
||||
'project_id': fields.many2one('project.project', 'Project', required=True, domain=[('scrum','=',1)]),
|
||||
'user_id': fields.many2one('res.users', 'Author'),
|
||||
'sprint_id': fields.many2one('project.scrum.sprint', 'Sprint'),
|
||||
'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of product backlog."),
|
||||
|
|
|
@ -192,7 +192,19 @@
|
|||
<!--
|
||||
Scrum Sprint
|
||||
-->
|
||||
|
||||
|
||||
<record id="view_scrum_sprint_calendar" model="ir.ui.view">
|
||||
<field name="name">project.scrum.sprint.calendar</field>
|
||||
<field name="model">project.scrum.sprint</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Scrum Sprint" date_start="date">
|
||||
<field name="name"/>
|
||||
<field name="project_id"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_scrum_sprint_tree" model="ir.ui.view">
|
||||
<field name="name">project.scrum.sprint.tree</field>
|
||||
<field name="model">project.scrum.sprint</field>
|
||||
|
@ -333,7 +345,7 @@
|
|||
<field name="name">Sprints</field>
|
||||
<field name="res_model">project.scrum.sprint</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="view_id" ref="view_scrum_sprint_tree"/>
|
||||
<field name="context">{"search_default_filter_current": 1, "search_default_scrum_master_id":uid}</field>
|
||||
<field name="search_view_id" ref="view_scrum_sprint_search"/>
|
||||
|
@ -345,7 +357,19 @@
|
|||
<!--
|
||||
Daily Meeting
|
||||
-->
|
||||
|
||||
|
||||
<record id="view_scrum_meeting_calendar" model="ir.ui.view">
|
||||
<field name="name">project.scrum.meeting.calendar</field>
|
||||
<field name="model">project.scrum.meeting</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Scrum Meeting" date_start="date" color="user_id">
|
||||
<field name="name"/>
|
||||
<field name="project_id"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_scrum_meeting_tree" model="ir.ui.view">
|
||||
<field name="name">project.scrum.meeting.tree</field>
|
||||
<field name="model">project.scrum.meeting</field>
|
||||
|
@ -424,7 +448,7 @@
|
|||
<field name="name">Scrum Meetings</field>
|
||||
<field name="res_model">project.scrum.meeting</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="context">{'search_default_scrum_daily':1,'search_default_project_id':project_id}</field>
|
||||
<field name="search_view_id" ref="view_scrum_meeting_search"/>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue