[REV] project: like before for CRM (see previous commit) reverted
most changes about stages. Override in project_mrp is back therefore. bzr revid: tde@openerp.com-20131023113716-jw8jh1jvn4dgpcyr
This commit is contained in:
parent
8ce54029cf
commit
d56d97ec62
|
@ -44,10 +44,6 @@ class project_task_type(osv.osv):
|
||||||
'fold': fields.boolean('Folded in Kanban View',
|
'fold': fields.boolean('Folded in Kanban View',
|
||||||
help='This stage is folded in the kanban view when'
|
help='This stage is folded in the kanban view when'
|
||||||
'there are no records in that stage to display.'),
|
'there are no records in that stage to display.'),
|
||||||
'closed': fields.boolean('Closing Stage',
|
|
||||||
help='Indicates whether this field is the end of'
|
|
||||||
'the maangement process. This is for example a'
|
|
||||||
'stage considering the record as done or canceled.'),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -271,7 +267,7 @@ class project(osv.osv):
|
||||||
'task_count': fields.function(_task_count, type='integer', string="Open Tasks",
|
'task_count': fields.function(_task_count, type='integer', string="Open Tasks",
|
||||||
deprecated="This field will be removed in OpenERP v8. Use task_ids one2many field instead."),
|
deprecated="This field will be removed in OpenERP v8. Use task_ids one2many field instead."),
|
||||||
'task_ids': fields.one2many('project.task', 'project_id',
|
'task_ids': fields.one2many('project.task', 'project_id',
|
||||||
domain=[('stage_id.closed', '=', False)]),
|
domain=[('stage_id.fold', '=', False)]),
|
||||||
'color': fields.integer('Color Index'),
|
'color': fields.integer('Color Index'),
|
||||||
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
|
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
|
||||||
help="Internal email associated with this project. Incoming emails are automatically synchronized"
|
help="Internal email associated with this project. Incoming emails are automatically synchronized"
|
||||||
|
@ -563,8 +559,9 @@ class task(osv.osv):
|
||||||
_mail_post_access = 'read'
|
_mail_post_access = 'read'
|
||||||
_track = {
|
_track = {
|
||||||
'stage_id': {
|
'stage_id': {
|
||||||
'project.mt_task_new': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence == 1,
|
# this is only an heuristics; depending on your particular stage configuration it may not match all 'new' stages
|
||||||
'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj.stage_id.sequence != 1,
|
'project.mt_task_new': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence <= 1,
|
||||||
|
'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj.stage_id.sequence > 1,
|
||||||
},
|
},
|
||||||
'user_id': {
|
'user_id': {
|
||||||
'project.mt_task_assigned': lambda self, cr, uid, obj, ctx=None: obj.user_id and obj.user_id.id,
|
'project.mt_task_assigned': lambda self, cr, uid, obj, ctx=None: obj.user_id and obj.user_id.id,
|
||||||
|
@ -589,7 +586,7 @@ class task(osv.osv):
|
||||||
def _get_default_stage_id(self, cr, uid, context=None):
|
def _get_default_stage_id(self, cr, uid, context=None):
|
||||||
""" Gives default stage_id """
|
""" Gives default stage_id """
|
||||||
project_id = self._get_default_project_id(cr, uid, context=context)
|
project_id = self._get_default_project_id(cr, uid, context=context)
|
||||||
return self.stage_find(cr, uid, [], project_id, [('sequence', '=', '1')], context=context)
|
return self.stage_find(cr, uid, [], project_id, [('fold', '=', False)], context=context)
|
||||||
|
|
||||||
def _resolve_project_id_from_context(self, cr, uid, context=None):
|
def _resolve_project_id_from_context(self, cr, uid, context=None):
|
||||||
""" Returns ID of project based on the value of 'default_project_id'
|
""" Returns ID of project based on the value of 'default_project_id'
|
||||||
|
@ -1001,7 +998,7 @@ class task(osv.osv):
|
||||||
|
|
||||||
def set_remaining_time(self, cr, uid, ids, remaining_time=1.0, context=None):
|
def set_remaining_time(self, cr, uid, ids, remaining_time=1.0, context=None):
|
||||||
for task in self.browse(cr, uid, ids, context=context):
|
for task in self.browse(cr, uid, ids, context=context):
|
||||||
if (task.stage_id and task.stage_id.sequence == 1) or (task.planned_hours == 0.0):
|
if (task.stage_id and task.stage_id.sequence <= 1) or (task.planned_hours == 0.0):
|
||||||
self.write(cr, uid, [task.id], {'planned_hours': remaining_time}, context=context)
|
self.write(cr, uid, [task.id], {'planned_hours': remaining_time}, context=context)
|
||||||
self.write(cr, uid, ids, {'remaining_hours': remaining_time}, context=context)
|
self.write(cr, uid, ids, {'remaining_hours': remaining_time}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<field name="name" string="Tasks"/>
|
<field name="name" string="Tasks"/>
|
||||||
<field name="categ_ids"/>
|
<field name="categ_ids"/>
|
||||||
<filter string="Unassigned" name="unassigned" domain="[('user_id', '=', False)]"/>
|
<filter string="Unassigned" name="unassigned" domain="[('user_id', '=', False)]"/>
|
||||||
<filter string="New" name="draft" domain="[('stage_id.sequence', '=', 1)]"/>
|
<filter string="New" name="draft" domain="[('stage_id.sequence', '<=', 1)]"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
<filter string="My Tasks" domain="[('user_id','=',uid)]"/>
|
<filter string="My Tasks" domain="[('user_id','=',uid)]"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
|
@ -687,11 +687,10 @@
|
||||||
<group>
|
<group>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="sequence"/>
|
<field name="sequence"/>
|
||||||
<field name="case_default"/>
|
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
<field name="case_default"/>
|
||||||
<field name="fold"/>
|
<field name="fold"/>
|
||||||
<field name="closed"/>
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<field name="description" placeholder="Add a description..."/>
|
<field name="description" placeholder="Add a description..."/>
|
||||||
|
|
|
@ -75,7 +75,7 @@ class report_project_task_user(osv.osv):
|
||||||
date_trunc('day',t.date_last_stage_update) as date_last_stage_update,
|
date_trunc('day',t.date_last_stage_update) as date_last_stage_update,
|
||||||
to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_deadline,
|
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,
|
-- sum(cast(to_char(date_trunc('day',t.date_end) - date_trunc('day',t.date_start),'DD') as int)) as no_of_days,
|
||||||
abs((extract('epoch' from (t.date_end-t.date_start)))/(3600*24)) as no_of_days,
|
abs((extract('epoch' from (t.write_date-t.date_start)))/(3600*24)) as no_of_days,
|
||||||
t.user_id,
|
t.user_id,
|
||||||
progress as progress,
|
progress as progress,
|
||||||
t.project_id,
|
t.project_id,
|
||||||
|
@ -89,9 +89,9 @@ class report_project_task_user(osv.osv):
|
||||||
total_hours as total_hours,
|
total_hours as total_hours,
|
||||||
t.delay_hours as hours_delay,
|
t.delay_hours as hours_delay,
|
||||||
planned_hours as hours_planned,
|
planned_hours as hours_planned,
|
||||||
(extract('epoch' from (t.date_end-t.create_date)))/(3600*24) as closing_days,
|
(extract('epoch' from (t.write_date-t.create_date)))/(3600*24) as closing_days,
|
||||||
(extract('epoch' from (t.date_start-t.create_date)))/(3600*24) as opening_days,
|
(extract('epoch' from (t.date_start-t.create_date)))/(3600*24) as opening_days,
|
||||||
abs((extract('epoch' from (t.date_deadline-t.date_end)))/(3600*24)) as delay_endings_days
|
abs((extract('epoch' from (t.date_deadline-t.write_date)))/(3600*24)) as delay_endings_days
|
||||||
FROM project_task t
|
FROM project_task t
|
||||||
WHERE t.active = 'true'
|
WHERE t.active = 'true'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
<tasks>
|
<tasks>
|
||||||
<task type="zoom" name="tasks">
|
<task type="zoom" name="tasks">
|
||||||
<task_name type="field" name="name"/>
|
<task_name type="field" name="name"/>
|
||||||
<task_status type="field" name="state" />
|
|
||||||
<task_descritpion type="field" name="description"/>
|
<task_descritpion type="field" name="description"/>
|
||||||
<task_sequence type="field" name="sequence"/>
|
<task_sequence type="field" name="sequence"/>
|
||||||
<task_priority type="field" name="priority"/>
|
<task_priority type="field" name="priority"/>
|
||||||
|
|
|
@ -586,7 +586,7 @@ class project(osv.Model):
|
||||||
'issue_count': fields.function(_issue_count, type='integer', string="Unclosed Issues",
|
'issue_count': fields.function(_issue_count, type='integer', string="Unclosed Issues",
|
||||||
deprecated="This field will be removed in OpenERP v8. Use issue_ids one2many field instead."),
|
deprecated="This field will be removed in OpenERP v8. Use issue_ids one2many field instead."),
|
||||||
'issue_ids': fields.one2many('project.issue', 'project_id',
|
'issue_ids': fields.one2many('project.issue', 'project_id',
|
||||||
domain=[('stage_id.closed', '=', False)])
|
domain=[('stage_id.fold', '=', False)])
|
||||||
}
|
}
|
||||||
|
|
||||||
def _check_escalation(self, cr, uid, ids, context=None):
|
def _check_escalation(self, cr, uid, ids, context=None):
|
||||||
|
|
|
@ -23,6 +23,22 @@ from openerp.osv import fields, osv
|
||||||
from openerp import netsvc
|
from openerp import netsvc
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectTaskStageMrp(osv.Model):
|
||||||
|
""" Override project.task.type model to add a 'closed' boolean field allowing
|
||||||
|
to know that tasks in this stage are considered as closed. Indeed since
|
||||||
|
OpenERP 8.0 status is not present on tasks anymore, only stage_id. """
|
||||||
|
_name = 'project.task.type'
|
||||||
|
_inherit = 'project.task.type'
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'closed': fields.boolean('Close', help="Tasks in this stage are considered as closed."),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'closed': False,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class project_task(osv.osv):
|
class project_task(osv.osv):
|
||||||
_name = "project.task"
|
_name = "project.task"
|
||||||
_inherit = "project.task"
|
_inherit = "project.task"
|
||||||
|
|
Loading…
Reference in New Issue