[IMP] project

bzr revid: hmo@tinyerp.com-20100930144119-rqcos1j0xumt4h6t
This commit is contained in:
Harry (OpenERP) 2010-09-30 20:11:19 +05:30
parent 99245023a2
commit 0994368ae1
11 changed files with 91 additions and 29 deletions

View File

@ -441,6 +441,7 @@ class task(osv.osv):
'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'),
'manager_id': fields.related('project_id', 'analytic_account_id', 'user_id', type='many2one', relation='res.users', string='Project Manager'),
'company_id': fields.many2one('res.company', 'Company'),
'id': fields.integer('ID'),
}
_defaults = {

View File

@ -303,6 +303,7 @@
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0 and state in ('pending');red:date_deadline and (date_deadline&gt;current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
<field name="id"/>
<field name="sequence" invisible="not context.get('seq_visible', False)"/>
<field name="name"/>
<field name="project_id" icon="gtk-indent" domain="['|',('user_id','=',uid),('members','=',uid)]"/>

View File

@ -185,7 +185,7 @@ class project_issue(crm.crm_case, osv.osv):
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="float", store=True),
'assigned_to': fields.many2one('res.users', 'Assigned to', help='This is the current user to whom the related task have been assigned'),
'assigned_to': fields.related('task_id', 'user_id', string = 'Assigned to', type="many2one", relation="res.users", store=True, help='This is the current user to whom the related task have been assigned'),
'working_hours_open': fields.function(_compute_day, string='Working Hours to Open the Issue', \
method=True, multi='working_days_open', type="float", store=True),
'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \
@ -318,6 +318,7 @@ class project_issue(crm.crm_case, osv.osv):
else:
raise osv.except_osv(_('Warning !'), _('You cannot escalate this issue.\nThe relevant Project has not configured the Escalation Project!'))
self.write(cr, uid, [case.id], data)
self._history(cr, uid, cases, _('Escalate'))
return True
def message_new(self, cr, uid, msg, context):
@ -369,6 +370,31 @@ class project_issue(crm.crm_case, osv.osv):
return res
def get_stage_dict(self, cr, uid, ids, context=None):
"""This function gives dictionary for stage according to stage levels
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
stage_obj = self.pool.get('crm.case.stage')
domain = [('object_id.model', '=', self._name)]
if 'force_domain' in context and context['force_domain']:
domain += context['force_domain']
sid = stage_obj.search(cr, uid, domain, context=context)
s = {}
previous = {}
section = self._name
for stage in stage_obj.browse(cr, uid, sid, context=context):
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
return s
def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context=None):
if context is None:
context = {}

View File

@ -73,7 +73,6 @@
<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">
@ -89,6 +88,7 @@
<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)]}" />
<field name="progress" colspan="3" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
</group>
<separator string= "Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4"/>
@ -202,6 +202,7 @@
<field name="version_id" widget="selection"/>
<field name="user_id"/>
<field name="assigned_to"/>
<field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
<field name="state"/>
<button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/>
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" help="To Do"/>
@ -225,9 +226,9 @@
<filter string="To Do" domain="[('state','=','open')]" help="To Do Issues" icon="terp-camera_test"/>
<filter string="Pending" domain="[('state','=','pending')]" help="Pending Issues" icon="terp-gtk-media-pause"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Today" separator="1" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]" help="Today's bugs" />
<filter icon="terp-go-today" string="Today" separator="1" domain="[('create_date','=',time.strftime('%%Y-%%m-%%d'))]" help="Today's bugs" />
<filter icon="terp-go-week" 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'))]"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d')), ('create_date', '&gt;=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Bugs during last 7 days"
/>
<separator orientation="vertical"/>

View File

@ -109,8 +109,8 @@ class project_phase(osv.osv):
'name': fields.char("Name", size=64, required=True),
'date_start': fields.date('Start Date', help="Starting Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'date_end': fields.date('End Date', help="Ending Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_start': fields.date('Start Date', help='force the phase to start after this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_end': fields.date('End Date', help='force the phase to finish before this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_start': fields.date('Minimum Start Date', help='force the phase to start after this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_end': fields.date('Deadline', help='force the phase to finish before this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'project_id': fields.many2one('project.project', 'Project', required=True),
'next_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'prv_phase_id', 'next_phase_id', 'Next Phases', states={'cancelled':[('readonly',True)]}),
'previous_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'next_phase_id', 'prv_phase_id', 'Previous Phases', states={'cancelled':[('readonly',True)]}),
@ -394,8 +394,10 @@ class project_resource_allocation(osv.osv):
_columns = {
'resource_id': fields.many2one('resource.resource', 'Resource', required=True),
'phase_id': fields.many2one('project.phase', 'Project Phase', ondelete='cascade', required=True),
'phase_id_date_start': fields.related('phase_id', 'date_start', type='date', string='Starting Date of the phase'),
'phase_id_date_end': fields.related('phase_id', 'date_end', type='date', string='Ending Date of the phase'),
'project_id': fields.related('phase_id', 'project_id', type='many2one', relation="project.project", string='Project', store=True),
'user_id': fields.related('resource_id', 'user_id', type='many2one', relation="res.users", string='User'),
'date_start': fields.date('Start Date', help="Starting Date"),
'date_end': fields.date('End Date', help="Ending Date"),
'useability': fields.float('Usability', help="Usability of this resource for this project phase in percentage (=50%)"),
}
_defaults = {

View File

@ -13,14 +13,27 @@
<field name="model">project.resource.allocation</field>
<field name="type">gantt</field>
<field name="arch" type="xml">
<gantt color="phase_id" date_start="phase_id_date_start" date_stop="phase_id_date_end" string="R.A." mode="year">
<level object="project.resource" link="resource_id" domain="[]">
<field name="useability"/>
<gantt color="phase_id" date_start="date_start" date_stop="date_end" string="R.A." mode="year">
<level object="res.users" link="user_id" domain="[]">
<field name="useability" string="Availability"/>
</level>
</gantt>
</field>
</record>
<record id="view_project_resource_allocation_calendar" model="ir.ui.view">
<field name="name">project.resource.allocation.calendar</field>
<field name="model">project.resource.allocation</field>
<field name="type">calendar</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<calendar color="user_id" date_start="date_start" date_stop="date_end" day_length="12" string="Resources">
<field name="phase_id"/>
<field name="project_id"/>
</calendar>
</field>
</record>
<record id="view_project_resource_allocation_form" model="ir.ui.view">
<field name="name">project.resource.allocation.form</field>
@ -28,9 +41,14 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Project Resource Allocation">
<field name="resource_id" select="1"/>
<field name="phase_id"/>
<field name="useability" string="Availability"/>
<group colspan="4" col="6">
<field name="resource_id"/>
<field name="phase_id"/>
<field name="project_id"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="useability" string="Availability"/>
</group>
</form>
</field>
</record>
@ -44,6 +62,7 @@
<tree editable="bottom" string="Project Resource Allocation">
<field name="resource_id"/>
<field name="phase_id"/>
<field name="project_id"/>
<field name="useability"/>
</tree>
</field>
@ -58,11 +77,13 @@
<group colspan="4" col="20">
<field name="resource_id"/>
<field name="phase_id"/>
<field name="project_id"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="20">
<filter name="resource" string="Resource" icon="terp-folder-blue" domain="[]" context="{'group_by':'resource_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Phase" icon="terp-project" domain="[]" context="{'group_by':'phase_id'}"/>
</group>
</search>
@ -73,7 +94,7 @@
<field name="name">Resource Allocations</field>
<field name="res_model">project.resource.allocation</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,gantt</field>
<field name="view_mode">gantt,tree,form,calendar</field>
<field name="context">{}</field>
<field name="search_view_id" ref="view_project_resource_allocation_search"/>
</record>
@ -110,10 +131,14 @@
<field colspan="4" name="resource_ids" nolabel="1">
<tree editable="bottom" string="Project Resource Allocation">
<field name="resource_id" context="{'project_id':parent.project_id}"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="useability"/>
</tree>
<form string="Project Resource Allocation">
<field name="resource_id" context="{'project_id':parent.project_id}"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="useability"/>
</form>
</field>
@ -265,7 +290,7 @@
<field name="name">Project Phases</field>
<field name="res_model">project.phase</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,gantt,calendar</field>
<field name="view_mode">gantt,tree,form,calendar</field>
<field name="context">{'search_default_responsible_id':uid}</field>
<field name="search_view_id" ref="view_project_phase_search"/>
<field name="help">You can subdivide your larger projects into several phases. For each phase, you can define your resources allocation (humans or engine), describe de differend task and link your phase with previous and next one, add constraints date and scheduling. A gantt view of your project phase is also available from this menu. Gantt view is a graphically draw of the project plan; it includes any task dependencies by visually adjusting task durations and priorities, and by linking tasks to each other.</field>

View File

@ -30,6 +30,7 @@ class messages(osv.osv):
logger = netsvc.Logger()
_columns = {
'create_date': fields.datetime('Creation Date', readonly=True),
'from_id': fields.many2one('res.users', 'From', required=True, ondelete="CASCADE"),
'to_id': fields.many2one('res.users', 'To', ondelete="CASCADE", help="Keep this empty to broadcast the message."),
'project_id': fields.many2one('project.project', 'Project',

View File

@ -44,7 +44,6 @@
<newline/>
<separator colspan="4" string="Message"/>
<field name="message" colspan="4" nolabel="1"/>
<field name="date"/>
</group>
</form>
</field>
@ -56,6 +55,7 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Messages">
<field name="create_date"/>
<field name="project_id"/>
<field name="from_id"/>
<field name="to_id"/>
@ -70,11 +70,12 @@
<field name="arch" type="xml">
<search string="Project Messages">
<group>
<filter icon="terp-go-today" string="Today" separator="1" domain="[('create_date','=',time.strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical"/>
<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="[('create_date','=',time.strftime('%%Y-%%m-%%d'))]"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="20">

View File

@ -18,13 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from mx import DateTime
from osv import fields, osv
from tools.translate import _
import re
import time
import tools
from datetime import datetime
from dateutil.relativedelta import relativedelta
class project_scrum_project(osv.osv):
_inherit = 'project.project'
@ -147,7 +147,7 @@ class project_scrum_sprint(osv.osv):
proj = self.pool.get('project.project').browse(cr, uid, [project_id])[0]
v['product_owner_id']= proj.product_owner_id and proj.product_owner_id.id or False
v['scrum_master_id']= proj.user_id and proj.user_id.id or False
v['date_stop'] = (DateTime.now() + DateTime.RelativeDateTime(days=int(proj.sprint_size or 14))).strftime('%Y-%m-%d')
v['date_stop'] = (datetime.now() + relativedelta(days=int(proj.sprint_size or 14))).strftime('%Y-%m-%d')
return {'value':v}
project_scrum_sprint()
@ -264,7 +264,7 @@ class project_scrum_product_backlog(osv.osv):
'tasks_id': fields.one2many('project.task', 'product_backlog_id', 'Tasks Details'),
'state': fields.selection([('draft','Draft'),('open','Open'),('pending','Pending'),('done','Done'),('cancel','Cancelled')], 'State', required=True),
'progress': fields.function(_compute, multi="progress", group_operator="avg", type='float', method=True, string='Progress', help="Computed as: Time Spent / Total Time."),
'effective_hours': fields.function(_compute, multi="effective_hours", method=True, string='Spent Hours', help="Computed using the sum of the time spent on every related tasks"),
'effective_hours': fields.function(_compute, multi="effective_hours", method=True, string='Spent Hours', help="Computed using the sum of the time spent on every related tasks", store=True),
'expected_hours': fields.float('Planned Hours', help='Estimated total time to do the Backlog'),
'create_date': fields.datetime("Creation Date", readonly=True),
'task_hours': fields.function(_compute, multi="task_hours", method=True, string='Task Hours', help='Estimated time of the total hours of the tasks')

View File

@ -41,7 +41,7 @@
<field name="user_id"/>
<field name="progress" widget="progressbar"/>
<field name="expected_hours" sum="Planned hours" widget="float_time" string="Total Planned Hours"/>
<field name="effective_hours" sum="Effective hours" widget="float_time" string="Total Spent Hours"/>
<field name="effective_hours" sum="Spent hours" widget="float_time" string="Total Spent Hours"/>
<field name="state"/>
<button type="object" string="Open" name="button_open" states="draft,pending" icon="terp-camera_test"/>
<button type="object" string="Pending" name="button_pending" states="open" icon="gtk-media-pause"/>
@ -198,7 +198,7 @@
<field name="model">project.scrum.sprint</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar string="Scrum Sprint" date_start="date">
<calendar string="Scrum Sprint" date_start="date_start">
<field name="name"/>
<field name="project_id"/>
</calendar>
@ -364,7 +364,7 @@
<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="sprint_id"/>
<field name="project_id"/>
</calendar>
</field>

View File

@ -31,6 +31,7 @@ class backlog_create_task(osv.osv_memory):
mod_obj = self.pool.get('ir.model.data')
task = self.pool.get('project.task')
backlog_id = self.pool.get('project.scrum.product.backlog')
document_pool = self.pool.get('ir.attachment')
ids_task = []
if context is None:
@ -39,9 +40,9 @@ class backlog_create_task(osv.osv_memory):
backlogs = backlog_id.browse(cr, uid, context['active_ids'], context=context)
result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form')
id = mod_obj.read(cr, uid, result, ['res_id'])
for backlog in backlogs:
ids_task.append(task.create(cr, uid, {
task_id = task.create(cr, uid, {
'product_backlog_id': backlog.id,
'name': backlog.name,
'description': backlog.note,
@ -50,8 +51,11 @@ class backlog_create_task(osv.osv_memory):
'planned_hours': backlog.expected_hours,
'remaining_hours':backlog.expected_hours,
'sequence':backlog.sequence,
}))
})
document_ids = document_pool.search(cr, uid, [('res_id', '=', backlog.id), ('res_model', '=', backlog_id._name)])
for document_id in document_ids:
document_pool.copy(cr, uid, document_id, default={'res_id':task_id, 'res_model':task._name})
ids_task.append(task_id)
return {
'domain': "[('product_backlog_id','in',["+','.join(map(str, context['active_ids']))+"])]",
'name': 'Tasks',