[IMP] project views

bzr revid: fp@tinyerp.com-20100119204315-yxqms2s4ut1sgele
This commit is contained in:
Fabien Pinckaers 2010-01-19 21:43:15 +01:00
parent f6e30ad653
commit ce2a8bcb22
3 changed files with 18 additions and 47 deletions

View File

@ -132,7 +132,7 @@ class project(osv.osv):
# \n If it is to be reviewed then the state is \'Pending\'.\n When the project is completed the state is set to \'Done\'.'),
# 'company_id': fields.many2one('res.company', 'Company'),
# 'timesheet_id': fields.many2one('hr.timesheet.group', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"),
'allowed_task_type': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Allowed Task Types'),
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Allowed Task Types'),
}
_defaults = {
@ -489,35 +489,23 @@ class task(osv.osv):
return True
def next_type(self, cr, uid, ids, *args):
type_obj = self.pool.get('project.task.type')
types = []
for typ in self.browse(cr, uid, ids):
typeid = typ.type.id
types = map(lambda x:x.id, typ.project_id.allowed_task_type)
types = map(lambda x:x.id, typ.project_id.type_ids)
if types:
if typeid and typeid in types and types.index(typeid) != len(types)-1 :
index = types.index(typeid)
else:
index = -1
self.write(cr, uid, typ.id, {'type': types[index+1]})
else:
self.write(cr, uid, typ.id, {'type': ''})
self.write(cr, uid, typ.id, {'type': types[index+1]})
return True
def prev_type(self, cr, uid, ids, *args):
type_obj = self.pool.get('project.task.type')
types = []
for typ in self.browse(cr, uid, ids):
typeid = typ.type.id
types = map(lambda x:x.id, typ.project_id.allowed_task_type)
types = map(lambda x:x.id, typ.project_id.type_ids)
if types:
if typeid and typeid in types and types.index(typeid) != 0 :
index = types.index(typeid)
else:
index = len(types)
self.write(cr, uid, typ.id, {'type': types[index-1]})
else:
self.write(cr, uid, typ.id, {'type': ''})
self.write(cr, uid, typ.id, {'type': types[index-1]})
return True
task()

View File

@ -32,7 +32,7 @@
<field name="warn_manager">1</field>
<field name="name">Open ERP Integration</field>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development'),ref('project_tt_testing'),ref('project_tt_merge')])]" name="allowed_task_type"/>
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development'),ref('project_tt_testing'),ref('project_tt_merge')])]" name="type_ids"/>
</record>
<record id="project_project_21" model="project.project">
<field name="warn_manager">1</field>
@ -41,7 +41,7 @@
<field name="name">Study + Prototype</field>
<field model="account.analytic.account" name="category_id" search="[('name','=', 'Seagate P1')]"/>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development')])]" name="allowed_task_type"/>
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development')])]" name="type_ids"/>
</record>
<record id="project_project_22" model="project.project">
<field name="priority">20</field>
@ -49,7 +49,7 @@
<field name="name">Specific Developements</field>
<field model="account.analytic.account" name="category_id" search="[('name','=', 'Seagate P1')]"/>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'), ref('project_tt_development')])]" name="allowed_task_type"/>
<field eval="[(6, 0, [ref('project_tt_specification'), ref('project_tt_development')])]" name="type_ids"/>
</record>
<record id="project_project_23" model="project.project">
<field name="priority">30</field>
@ -57,7 +57,7 @@
<field name="name">Install, data import, configuration</field>
<field model="account.analytic.account" name="category_id" search="[('name','=', 'Seagate P1')]"/>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_development')])]" name="allowed_task_type"/>
<field eval="[(6, 0, [ref('project_tt_development')])]" name="type_ids"/>
</record>
<!-- Tasks -->

View File

@ -83,24 +83,9 @@
<label string="Date Stop: %%(date_stop)s"/>
</group>
</page>
<page string="Tasks">
<field name="tasks" nolabel="1" attrs="{'readonly':[('state','in',['cancelled','done'])]}" colspan="4">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0;red:bool(date_deadline) and (date_deadline&lt;current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
<!-- <tree string="Tasks">-->
<field name="sequence"/>
<field name="name"/>
<field name="user_id" string="Project Manager"/>
<field name="date_deadline"/>
<field name="planned_hours" sum="Planned" widget="float_time"/>
<field name="delay_hours" sum="Delay" widget="float_time"/>
<field name="progress" widget="progressbar"/>
<field name="priority"/>
<field name="state"/>
<field name="remaining_hours" invisible="1"/>
</tree>
</field>
<separator string="Allowed Task Types"/>
<field nolabel="1" name="allowed_task_type" colspan="4" groups="base.group_extended"/>
<page string="Tasks" groups="base.group_extended">
<separator string="Task Types"/>
<field nolabel="1" name="type_ids" colspan="4"/>
</page>
<page string="Notes">
<field colspan="4" name="description" nolabel="1"/>
@ -378,7 +363,7 @@
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0;red:bool(date_deadline) and (date_deadline&lt;current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
<field name="sequence" string="Seq."/>
<field name="sequence" invisible="1"/>
<field name="name"/>
<field name="project_id" icon="gtk-indent"/>
<field name="user_id"/>
@ -485,21 +470,19 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Task Edition">
<group col="8" colspan="4">
<group col="20" colspan="4">
<filter string="By Users" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="By Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="By Type" icon="terp-project" domain="[]" context="{'group_by':'type'}"/>
<separator orientation="vertical"/>
<filter string="Draft" domain="[('state','=','draft')]" help="Draft Tasks" icon="terp-project"/>
<filter string="In Progress" domain="[('state','=','open')]" help="Open Tasks" icon="terp-project"/>
<filter string="Pending" domain="[('state','=','pending')]" help="Pending Tasks" icon="terp-project"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="type" select="1" widget="selection"/>
<field name="project_id" select="1" widget="selection">
<filter domain="[('manager_id','=',False)]" help="Unassigned Project" icon="terp-project"/>
</field>
<filter string="By Users" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="By Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="By Type" icon="terp-project" domain="[]" context="{'group_by':'type'}"/>
</group>
<group col="4" colspan="1">
<field name="user_id" select="1" widget="selection">
<filter domain="[('user_id','=',uid)]" help="My Tasks" icon="gtk-execute" default="1"/>
<filter domain="[('user_id','=',False)]" help="Unassigned Tasks" icon="gtk-execute" separator="1"/>