Delegation view
bzr revid: fp@tinyerp.com-7cc15418496331e1be82a44a1a880ef21cbbf1f5
This commit is contained in:
parent
5d64919461
commit
3a6f24b4a3
|
@ -170,6 +170,24 @@ class task(osv.osv):
|
|||
_name = "project.task"
|
||||
_description = "Task"
|
||||
_date_name = "date_deadline"
|
||||
def _str_get(self, task, context={}):
|
||||
return '*** '+task.user_id.name.upper()+(' - %.1fh / %.1fh'%(task.effective_hours or 0.0,task.planned_hours))+' ***\n'+(task.description or '')+'\n\n'
|
||||
|
||||
def _history_get(self, cr, uid, ids, name, args, context={}):
|
||||
result = {}
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
result[task.id] = self._str_get(task)
|
||||
t2 = task.parent_id
|
||||
while t2:
|
||||
result[task.id] = self._str_get(t2) + result[task.id]
|
||||
t2 = t2.parent_id
|
||||
t3 = task.child_ids
|
||||
while t3:
|
||||
t2 = t3.pop(0)
|
||||
result[task.id] = result[task.id] + self._str_get(t2)
|
||||
t3 += t2.child_ids
|
||||
return result
|
||||
|
||||
def _hours_effect(self, cr, uid, ids, name, args, context):
|
||||
task_set = ','.join(map(str, ids))
|
||||
cr.execute(("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id in (%s) GROUP BY task_id") % (task_set,))
|
||||
|
@ -188,12 +206,13 @@ class task(osv.osv):
|
|||
'sequence': fields.integer('Sequence'),
|
||||
'type': fields.many2one('project.task.type', 'Type'),
|
||||
'state': fields.selection([('draft', 'Draft'),('open', 'Open'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State'),
|
||||
'date_start': fields.datetime('Date Start'),
|
||||
'date_start': fields.date('Date Start'),
|
||||
'date_deadline': fields.datetime('Deadline'),
|
||||
'date_close': fields.datetime('Date Closed', readonly=True),
|
||||
'project_id': fields.many2one('project.project', 'Project', ondelete='cascade'),
|
||||
'parent_id': fields.many2one('project.task', 'Parent Task'),
|
||||
'child_ids': fields.one2many('project.task', 'parent_id', 'Delegated Tasks'),
|
||||
'history': fields.function(_history_get, method=True, string="Task Details", type="text"),
|
||||
'notes': fields.text('Notes'),
|
||||
'start_sequence': fields.boolean('Wait for previous sequences'),
|
||||
'planned_hours': fields.float('Planned hours'),
|
||||
|
|
|
@ -293,7 +293,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Task edition">
|
||||
<notebook>
|
||||
<page string="Task definition">
|
||||
<page string="Information">
|
||||
<field name="name" select="1"/>
|
||||
<field name="project_id" required="1" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
|
@ -318,7 +318,21 @@
|
|||
|
||||
</group>
|
||||
</page>
|
||||
<page string="Other Information">
|
||||
<page string="Delegations">
|
||||
<field name="history" colspan="4" nolabel="1"/>
|
||||
<field name="child_ids" colspan="4" nolabel="1" height="150">
|
||||
<tree string="Delegated tasks">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="date_deadline"/>
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="parent_id" colspan="4"/>
|
||||
</page>
|
||||
<page string="Extra Info">
|
||||
<field name="date_start" select="2"/>
|
||||
<field name="date_close" select="2"/>
|
||||
<field name="type"/>
|
||||
|
@ -331,17 +345,6 @@
|
|||
<field name="billable" select="2"/>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field colspan="4" name="notes" nolabel="1"/>
|
||||
<field name="child_ids" colspan="4" nolabel="1">
|
||||
<tree string="Delegated tasks">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="date_deadline"/>
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="parent_id" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
|
|
@ -35,6 +35,7 @@ ask_form = """<?xml version="1.0" ?>
|
|||
<field name="user_id" colspan="4"/>
|
||||
<field name="planned_hours" colspan="4"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="include_info"/>
|
||||
<separator string="Validation Task" colspan="4"/>
|
||||
<field name="planned_hours_me" colspan="4"/>
|
||||
<field name="prefix" colspan="4"/>
|
||||
|
@ -45,6 +46,7 @@ ask_fields = {
|
|||
'name': {'string': 'Title', 'type': 'char', 'required': 'True', 'size':64},
|
||||
'prefix': {'string': 'Prefix of Task', 'type': 'char', 'required': 'True', 'size':64},
|
||||
'user_id': {'string':'Assign To', 'type':'many2one', 'relation': 'res.users', 'required':'True'},
|
||||
'include_info': {'string':'Copy Description', 'type':'boolean'},
|
||||
'planned_hours': {'string':'Planned Hours', 'type':'float', 'widget':'float_time'},
|
||||
'planned_hours_me': {'string':'Hours to Validate', 'type':'float', 'widget':'float_time'},
|
||||
'state': {'string':'Validation State', 'type':'selection', 'selection': [('pending','Pending'),('done','Done')]},
|
||||
|
@ -59,7 +61,8 @@ class wizard_delegate(wizard.interface):
|
|||
'user_id': data['form']['user_id'],
|
||||
'planned_hours': data['form']['planned_hours'],
|
||||
'parent_id': data['id'],
|
||||
'state': 'open'
|
||||
'state': 'open',
|
||||
'description': data['form']['include_info'] and task.description or ''
|
||||
})
|
||||
task_obj.write(cr, uid, data['id'], {
|
||||
'planned_hours': data['form']['planned_hours_me'],
|
||||
|
|
Loading…
Reference in New Issue