[IMP] project: dashboard view improved

[REF] project: renamed type field of project.task into type_id, refactored some code

bzr revid: qdp-launchpad@tinyerp.com-20100715082510-5f7zs3nw7rwomiys
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-07-15 13:55:10 +05:30
parent 24945daabb
commit 887d7693dc
3 changed files with 38 additions and 18 deletions

View File

@ -17,13 +17,33 @@
<field name="name"/>
<field name="project_id"/>
<field name="date_deadline"/>
<field name="planned_hours"/>
<field name="effective_hours"/>
<field name="priority"/>
<field name="planned_hours" widget="float_time"/>
<field name="effective_hours" widget="float_time"/>
<field name="progress" widget="progressbar"/>
</tree>
</field>
</record>
<record id="view_delegated_task_tree" model="ir.ui.view">
<field name="name">project.task.delegated.tree</field>
<field name="model">project.task</field>
<field name="type">tree</field>
<field eval="99" name="priority"/>
<field name="arch" type="xml">
<tree colors="red:date_deadline&lt;current_date;blue:date_deadline==current_date;black:date_deadline&gt;current_date" string="My Delegated Tasks">
<field name="user_id"/>
<field name="name"/>
<field name="project_id"/>
<field name="date_deadline"/>
<field name="total_hours" widget="float_time"/>
<field name="progress" widget="progressbar"/>
<field name="type_id"/>
</tree>
</field>
</record>
<record id="action_view_task_tree" model="ir.actions.act_window">
<field name="name">My Open Tasks</field>
<field name="res_model">project.task</field>
@ -38,8 +58,8 @@
<field name="res_model">project.task</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">['|',('parent_ids.user_id','=',uid),('user_id','=',uid)]</field>
<field name="view_id" ref="project.view_task_tree2"/>
<field name="domain">[('parent_ids.user_id','=',uid),('state', 'in', ('draft','open','pending'))]</field>
<field name="view_id" ref="view_delegated_task_tree"/>
</record>
<record id="action_view_task_tree_deadline" model="ir.actions.act_window">

View File

@ -359,7 +359,7 @@ class task(osv.osv):
'description': fields.text('Description'),
'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Importance'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of tasks."),
'type': fields.many2one('project.task.type', 'Stage',),
'type_id': fields.many2one('project.task.type', 'Stage',),
'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
help='If the task is created the state is \'Draft\'.\n If the task is started, the state becomes \'In Progress\'.\n If review is needed the task is in \'Pending\' state.\
\n If the task is over, the states is set to \'Done\'.'),
@ -549,25 +549,25 @@ class task(osv.osv):
return True
def next_type(self, cr, uid, ids, *args):
for typ in self.browse(cr, uid, ids):
typeid = typ.type.id
types = map(lambda x:x.id, typ.project_id.type_ids or [])
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, typ.id, {'type': types[0]})
self.write(cr, uid, task.id, {'type_id': types[0]})
elif typeid and typeid in types and types.index(typeid) != len(types)-1 :
index = types.index(typeid)
self.write(cr, uid, typ.id, {'type': types[index+1]})
self.write(cr, uid, task.id, {'type_id': types[index+1]})
return True
def prev_type(self, cr, uid, ids, *args):
for typ in self.browse(cr, uid, ids):
typeid = typ.type.id
types = map(lambda x:x.id, typ.project_id.type_ids)
for task in self.browse(cr, uid, ids):
typeid = task.type_id.id
types = map(lambda x:x.id, task.project_id.type_ids)
if types:
if typeid and typeid in types:
index = types.index(typeid)
self.write(cr, uid, typ.id, {'type': index and types[index-1] or False})
self.write(cr, uid, task.id, {'type_id': index and types[index-1] or False})
return True
task()

View File

@ -321,7 +321,7 @@
<field name="partner_id"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<group col="4" colspan="2">
<field name="type" widget="selection" readonly="1"/>
<field name="type_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"/>
</group>
@ -354,7 +354,7 @@
icon="gtk-go-forward"
groups="base.group_extended"
help="Change Type"/>
<field name="type" groups="base.group_extended" invisible="context.get('set_visible',False)"/>
<field name="type_id" groups="base.group_extended" invisible="context.get('set_visible',False)"/>
<field name="date_start" invisible="1"/>
<field name="date_end" invisible="1"/>
<field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/>
@ -441,7 +441,7 @@
<group expand="0" string="Group By..." colspan="4" col="20">
<filter string="Users" name="group_user_id" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Project" name="group_project_id" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Stage" name="group_stage_id" icon="terp-stage" domain="[]" context="{'group_by':'type'}"/>
<filter string="Stage" name="group_stage_id" icon="terp-stage" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="State" name="group_state" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Deadline" icon="terp-gnome-cpu-frequency-applet+" domain="[]" context="{'group_by':'date_deadline'}"/>
@ -659,4 +659,4 @@
<act_window domain="[('project_id', '=', active_id)]" id="act_project_messages" name="Messages" res_model="project.message" src_model="project.project"/>
</data>
</openerp>
</openerp>