[IMP] project: dashboard view improved
authorqdp-launchpad@tinyerp.com <>
Thu, 15 Jul 2010 08:25:10 +0000 (13:55 +0530)
committerqdp-launchpad@tinyerp.com <>
Thu, 15 Jul 2010 08:25:10 +0000 (13:55 +0530)
[REF] project: renamed type field of project.task into type_id, refactored some code

bzr revid: qdp-launchpad@tinyerp.com-20100715082510-5f7zs3nw7rwomiys

addons/project/board_project_view.xml
addons/project/project.py
addons/project/project_view.xml

index 5c216e1..a6c489a 100644 (file)
                     <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">
index 168e7db..af8332a 100644 (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()
index 8fb4884..16ed663 100644 (file)
                             <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>
                         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)"/>
                     <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'}"/>
         <act_window domain="[('project_id', '=', active_id)]" id="act_project_messages" name="Messages" res_model="project.message" src_model="project.project"/>
         
     </data>
-</openerp>
\ No newline at end of file
+</openerp>