[CLEAN] project, project_issue: removed next_type and prev_type, now using stage_previous and stage_next; cleaned views accordingly.
bzr revid: tde@openerp.com-20120531151556-duyy6ryyw6fiup3o
This commit is contained in:
parent
e979794103
commit
8d5aae51f6
|
@ -1100,36 +1100,6 @@ class task(base_stage, osv.osv):
|
|||
def set_kanban_state_done(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'kanban_state': 'done'}, context=context)
|
||||
|
||||
def _change_type(self, cr, uid, ids, next, context=None):
|
||||
"""
|
||||
go to the next stage
|
||||
if next is False, go to previous stage
|
||||
"""
|
||||
for task in self.browse(cr, uid, ids):
|
||||
if task.project_id.type_ids:
|
||||
typeid = task.stage_id.id
|
||||
types_seq={}
|
||||
for type in task.project_id.type_ids :
|
||||
types_seq[type.id] = type.sequence
|
||||
if next:
|
||||
types = sorted(types_seq.items(), lambda x, y: cmp(x[1], y[1]))
|
||||
else:
|
||||
types = sorted(types_seq.items(), lambda x, y: cmp(y[1], x[1]))
|
||||
sorted_types = [x[0] for x in types]
|
||||
if not typeid:
|
||||
self.write(cr, uid, task.id, {'stage_id': sorted_types[0]})
|
||||
elif typeid and typeid in sorted_types and sorted_types.index(typeid) != len(sorted_types)-1:
|
||||
index = sorted_types.index(typeid)
|
||||
self.write(cr, uid, task.id, {'stage_id': sorted_types[index+1]})
|
||||
self.state_change_send_note(cr, uid, [task.id], context)
|
||||
return True
|
||||
|
||||
def next_type(self, cr, uid, ids, context=None):
|
||||
return self._change_type(cr, uid, ids, True, context=context)
|
||||
|
||||
def prev_type(self, cr, uid, ids, context=None):
|
||||
return self._change_type(cr, uid, ids, False, context=context)
|
||||
|
||||
def _store_history(self, cr, uid, ids, context=None):
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
self.pool.get('project.task.history').create(cr, uid, {
|
||||
|
|
|
@ -517,20 +517,21 @@
|
|||
<field name="effective_hours" widget="float_time" sum="Spent Hours" invisible="1"/>
|
||||
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" on_change="onchange_remaining(remaining_hours,planned_hours)" invisible="context.get('set_visible',False)" groups="project.group_time_work_estimation_tasks"/>
|
||||
<field name="date_deadline" invisible="context.get('deadline_visible',True)"/>
|
||||
<button name="do_open" string="Start Task" type="object"
|
||||
icon="gtk-media-play" states="pending,draft"/>
|
||||
<button name="action_close" string="Done" type="object"
|
||||
icon="terp-dialog-close" states="draft,open,pending"/>
|
||||
<button name="%(action_project_task_delegate)d" string="Delegate" type="action"
|
||||
icon="terp-personal" states="pending,open,draft"/>
|
||||
<field name="stage_id" invisible="context.get('set_visible',False)"/>
|
||||
<button name="next_type" invisible="context.get('set_visible',False)"
|
||||
states="open,pending"
|
||||
string="Change Stage"
|
||||
type="object"
|
||||
icon="gtk-go-forward"
|
||||
help="Change Type" attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<button name="stage_previous" string="Previous" type="object"
|
||||
icon="gtk-go-back" states="open" attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<button name="stage_next" string="Next" type="object"
|
||||
icon="gtk-go-forward" states="open" attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<field name="state" invisible="context.get('set_visible',False)" groups="base.group_no_one"/>
|
||||
<field name="date_start" invisible="1" groups="base.group_no_one"/>
|
||||
<field name="date_end" invisible="1" groups="base.group_no_one"/>
|
||||
<field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/>
|
||||
<field name="state" invisible="context.get('set_visible',False)" groups="base.group_no_one"/>
|
||||
<button name="do_open" states="pending,draft,done,cancelled" string="Start Task" type="object" icon="gtk-media-play" help="For changing to open state" invisible="context.get('set_visible',False)" groups="base.group_no_one"/>
|
||||
<button name="%(action_project_task_delegate)d" states="pending,open,draft" string="Delegate" type="action" icon="terp-personal" help="For changing to delegate state"/>
|
||||
<button name="action_close" states="draft,pending,open" string="Done" type="object" icon="terp-dialog-close" help="For changing to done state" groups="base.group_no_one"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
I change the stage of task to next stage.
|
||||
-
|
||||
!python {model: project.task}: |
|
||||
self.next_type(cr, uid, [ref("project_task_1")])
|
||||
self.stage_next(cr, uid, [ref("project_task_1")])
|
||||
-
|
||||
!record {model: project.task.reevaluate, id: reevaluate_id}:
|
||||
remaining_hours : 120
|
||||
|
@ -68,9 +68,9 @@
|
|||
I change the stage of task to previous stage.
|
||||
-
|
||||
!python {model: project.task}: |
|
||||
self.prev_type(cr, uid, [ref("project_task_1")])
|
||||
self.stage_previous(cr, uid, [ref("project_task_1")])
|
||||
-
|
||||
I cancel Task.
|
||||
-
|
||||
!python {model: project.task}: |
|
||||
self.do_cancel(cr, uid, [ref("project_task_2")])
|
||||
self.do_cancel(cr, uid, [ref("project_task_2")])
|
||||
|
|
|
@ -96,18 +96,22 @@
|
|||
<field name="partner_id"/>
|
||||
<field name="project_id" />
|
||||
<field name="priority" string="Priority"/>
|
||||
<field name="stage_id" widget="selection" readonly="1"/>
|
||||
<button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/>
|
||||
<button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/>
|
||||
<field name="version_id" widget="selection"/>
|
||||
<field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
|
||||
<field name="stage_id" widget="selection" readonly="1"/>
|
||||
<button name="stage_previous" string="Previous" type="object"
|
||||
icon="gtk-go-back" help="Change to Previous Stage"
|
||||
attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<button name="stage_next" string="Next" type="object"
|
||||
icon="gtk-go-forward" help="Change to Next Stage"
|
||||
attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<field name="state" groups="base.group_no_one"/>
|
||||
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel" groups="base.group_no_one"/>
|
||||
<button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to" groups="base.group_no_one"/>
|
||||
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" help="To Do" groups="base.group_no_one"/>
|
||||
<button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause" groups="base.group_no_one"/>
|
||||
<button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up" groups="base.group_no_one"/>
|
||||
<button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" groups="base.group_no_one"/>
|
||||
<button name="case_open" string="Open" type="object"
|
||||
icon="gtk-go-forward" states="draft,pending"/>
|
||||
<button name="case_close" string="Done" type="object"
|
||||
icon="gtk-jump-to" states="draft,open,pending"/>
|
||||
<button name="case_cancel" string="Cancel" type="object"
|
||||
icon="gtk-cancel" states="draft,open,pending"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="task_id" invisible="1"/>
|
||||
</tree>
|
||||
|
|
|
@ -444,33 +444,6 @@ class project_issue(base_stage, osv.osv):
|
|||
return stage_ids[0]
|
||||
return False
|
||||
|
||||
def next_type(self, cr, uid, ids, context=None):
|
||||
for task in self.browse(cr, uid, ids):
|
||||
typeid = task.type_id.id
|
||||
types = map(lambda x:x.id, task.project_id.type_ids or [])
|
||||
if types:
|
||||
if not typeid:
|
||||
self.write(cr, uid, [task.id], {'stage_id': types[0]})
|
||||
elif typeid and typeid in types and types.index(typeid) != len(types)-1 :
|
||||
index = types.index(typeid)
|
||||
self.write(cr, uid, [task.id], {'stage_id': types[index+1]})
|
||||
return True
|
||||
|
||||
def prev_type(self, cr, uid, ids, context=None):
|
||||
for task in self.browse(cr, uid, ids):
|
||||
typeid = task.type_id.id
|
||||
types = map(lambda x:x.id, task.project_id and task.project_id.type_ids or [])
|
||||
if types:
|
||||
if typeid and typeid in types:
|
||||
index = types.index(typeid)
|
||||
self.write(cr, uid, [task.id], {'stage_id': index and types[index-1] or False})
|
||||
return True
|
||||
|
||||
def case_open(self, cr, uid, ids, context=None):
|
||||
res = super(project_issue, self).case_open(cr, uid, ids, context)
|
||||
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id' : uid})
|
||||
return res
|
||||
|
||||
def case_cancel(self, cr, uid, ids, context=None):
|
||||
""" Cancels case """
|
||||
self.case_set(cr, uid, ids, 'cancelled', {'active': True}, context=context)
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
<field name="arch" type="xml">
|
||||
<form layout="manual">
|
||||
<div class="oe_form_topbar">
|
||||
|
||||
<button name="case_open" string="Open" type="object"
|
||||
states="draft,pending"/>
|
||||
<button name="case_close" string="Done" type="object"
|
||||
|
@ -64,9 +63,9 @@
|
|||
<button name="case_reset" string="Reset to New" type="object"
|
||||
states="cancelled,done"/>
|
||||
<button name="stage_previous" string="Previous" type="object"
|
||||
states="open" icon="gtk-go-back" context="{'stage_type': 'opportunity'}"/>
|
||||
states="open" icon="gtk-go-back"/>
|
||||
<button name="stage_next" string="Next" type="object"
|
||||
states="open" icon="gtk-go-forward" context="{'stage_type': 'opportunity'}"/>
|
||||
states="open" icon="gtk-go-forward"/>
|
||||
<button name="case_cancel" string="Cancel" type="object"
|
||||
states="draft,open,pending"/>
|
||||
<div class="oe_right">
|
||||
|
@ -145,19 +144,23 @@
|
|||
<field name="partner_id"/>
|
||||
<field name="project_id" />
|
||||
<field name="priority" string="Priority"/>
|
||||
<field name="stage_id" widget="selection" readonly="1"/>
|
||||
<button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage" attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage" attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<field name="version_id" widget="selection"/>
|
||||
<field name="user_id"/>
|
||||
<field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
|
||||
<field name="stage_id" widget="selection" readonly="1"/>
|
||||
<button name="stage_previous" string="Previous" type="object"
|
||||
icon="gtk-go-back" help="Change to Previous Stage"
|
||||
attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<button name="stage_next" string="Next" type="object"
|
||||
icon="gtk-go-forward" help="Change to Next Stage"
|
||||
attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<field name="state" groups="base.group_no_one"/>
|
||||
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel" groups="base.group_no_one"/>
|
||||
<button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to" groups="base.group_no_one"/>
|
||||
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" help="To Do" groups="base.group_no_one"/>
|
||||
<button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause" groups="base.group_no_one"/>
|
||||
<button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/>
|
||||
<button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert" groups="base.group_no_one"/>
|
||||
<button name="case_open" string="Open" type="object"
|
||||
icon="gtk-go-forward" states="draft,pending"/>
|
||||
<button name="case_close" string="Done" type="object"
|
||||
icon="gtk-jump-to" states="draft,open,pending"/>
|
||||
<button name="case_cancel" string="Cancel" type="object"
|
||||
icon="gtk-cancel" states="draft,open,pending"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="task_id" invisible="1"/>
|
||||
</tree>
|
||||
|
@ -311,18 +314,22 @@
|
|||
<field name="name" string="Feature description"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="priority" string="Priority"/>
|
||||
<field name="stage_id" widget="selection" readonly="1"/>
|
||||
<button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/>
|
||||
<button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/>
|
||||
<field name="version_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="stage_id" widget="selection" readonly="1"/>
|
||||
<button name="stage_previous" string="Previous" type="object"
|
||||
icon="gtk-go-back" help="Change to Previous Stage"
|
||||
attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<button name="stage_next" string="Next" type="object"
|
||||
icon="gtk-go-forward" help="Change to Next Stage"
|
||||
attrs="{'invisible': [('stage_id','=', False)]}"/>
|
||||
<field name="state" groups="base.group_no_one"/>
|
||||
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel" groups="base.group_no_one"/>
|
||||
<button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to" groups="base.group_no_one"/>
|
||||
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" groups="base.group_no_one"/>
|
||||
<button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause" groups="base.group_no_one"/>
|
||||
<button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/>
|
||||
<button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert" groups="base.group_no_one"/>
|
||||
<button name="case_open" string="Open" type="object"
|
||||
icon="gtk-go-forward" states="draft,pending"/>
|
||||
<button name="case_close" string="Done" type="object"
|
||||
icon="gtk-jump-to" states="draft,open,pending"/>
|
||||
<button name="case_cancel" string="Cancel" type="object"
|
||||
icon="gtk-cancel" states="draft,open,pending"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
<field name="type_id" invisible="context.get('set_visible',False)"/>
|
||||
<field name="date_start" invisible="1"/>
|
||||
<field name="date_end" invisible="1"/>
|
||||
<button name="next_type" invisible="context.get('set_visible',False)"
|
||||
<button name="stage_next" invisible="context.get('set_visible',False)"
|
||||
states="draft,open,pending"
|
||||
string="Change Stage"
|
||||
type="object"
|
||||
|
|
Loading…
Reference in New Issue