[IMP]: *Added allowed task types field in project. *Removed 'All Attachments' wizard. *Added 'Next' and 'Previous' buttons on task for task type field. *Changed demo data for task type.
bzr revid: uco@tinyerp.co.in-20100118125412-sbd1ujtwcir0qqxj
This commit is contained in:
parent
f1489df74b
commit
8f83656717
|
@ -28,6 +28,21 @@ from tools.translate import _
|
|||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class project_task_type(osv.osv):
|
||||
_name = 'project.task.type'
|
||||
_description = 'Project task type'
|
||||
_columns = {
|
||||
'name': fields.char('Type', required=True, size=64, translate=True),
|
||||
'description': fields.text('Description'),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
}
|
||||
_order = 'sequence'
|
||||
|
||||
_defaults = {
|
||||
'sequence': lambda *args: 1
|
||||
}
|
||||
project_task_type()
|
||||
|
||||
class project(osv.osv):
|
||||
_name = "project.project"
|
||||
_description = "Project"
|
||||
|
@ -119,6 +134,7 @@ class project(osv.osv):
|
|||
help='The project can be in either if the states \'Template\' and \'Running\'.\n If it is template then we can make projects based on the template projects. If its in \'Running\' state it is a normal project.\
|
||||
\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'),
|
||||
'allowed_task_type': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Allowed Task Types'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -206,15 +222,6 @@ class project(osv.osv):
|
|||
return True
|
||||
project()
|
||||
|
||||
class project_task_type(osv.osv):
|
||||
_name = 'project.task.type'
|
||||
_description = 'Project task type'
|
||||
_columns = {
|
||||
'name': fields.char('Type', required=True, size=64, translate=True),
|
||||
'description': fields.text('Description'),
|
||||
}
|
||||
project_task_type()
|
||||
|
||||
class task(osv.osv):
|
||||
_name = "project.task"
|
||||
_description = "Tasks"
|
||||
|
@ -431,6 +438,29 @@ class task(osv.osv):
|
|||
self.write(cr, uid, ids, {'state': 'pending'})
|
||||
return True
|
||||
|
||||
def next_type(self, cr, uid, ids, *args):
|
||||
type_obj = self.pool.get('project.task.type')
|
||||
type_ids = type_obj.search(cr,uid,[])
|
||||
for typ in self.browse(cr, uid, ids):
|
||||
typeid = typ.type.id
|
||||
if typeid and type_ids.index(typeid) != len(type_ids)-1 :
|
||||
index = type_ids.index(typeid)
|
||||
else:
|
||||
index = -1
|
||||
self.write(cr, uid, typ.id, {'type': type_ids[index+1]})
|
||||
return True
|
||||
|
||||
def prev_type(self, cr, uid, ids, *args):
|
||||
type_obj = self.pool.get('project.task.type')
|
||||
type_ids = type_obj.search(cr,uid,[])
|
||||
for typ in self.browse(cr, uid, ids):
|
||||
typeid = typ.type.id
|
||||
if typeid and type_ids.index(typeid) != 0 :
|
||||
index = type_ids.index(typeid)
|
||||
else:
|
||||
index = len(type_ids)
|
||||
self.write(cr, uid, typ.id, {'type': type_ids[index - 1]})
|
||||
return True
|
||||
|
||||
task()
|
||||
|
||||
|
|
|
@ -9,17 +9,21 @@
|
|||
<field name="project_time_mode_id" ref="product.uom_hour"></field>
|
||||
</record>
|
||||
|
||||
<record id="project_tt_analysis" model="project.task.type">
|
||||
<field name="name">Analysis</field>
|
||||
<record id="project_tt_specification" model="project.task.type">
|
||||
<field name="sequence">1</field>
|
||||
<field name="name">Specification</field>
|
||||
</record>
|
||||
<record id="project_tt_feature" model="project.task.type">
|
||||
<field name="name">New Feature</field>
|
||||
<record id="project_tt_development" model="project.task.type">
|
||||
<field name="sequence">2</field>
|
||||
<field name="name">Development</field>
|
||||
</record>
|
||||
<record id="project_tt_quote" model="project.task.type">
|
||||
<field name="name">Quotation</field>
|
||||
<record id="project_tt_testing" model="project.task.type">
|
||||
<field name="sequence">3</field>
|
||||
<field name="name">Testing</field>
|
||||
</record>
|
||||
<record id="project_tt_bug" model="project.task.type">
|
||||
<field name="name">Bug</field>
|
||||
<record id="project_tt_merge" model="project.task.type">
|
||||
<field name="sequence">4</field>
|
||||
<field name="name">Merge</field>
|
||||
</record>
|
||||
|
||||
<record id="project_project_9" model="project.project">
|
||||
|
@ -53,7 +57,7 @@
|
|||
<record id="project_task_116" model="project.task">
|
||||
<field name="planned_hours">38.0</field>
|
||||
<field name="remaining_hours">38.0</field>
|
||||
<field name="type" ref="project_tt_feature"/>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project_project_22"/>
|
||||
<field name="description">BoM, After sales returns, interventions. Tracability.</field>
|
||||
|
@ -62,7 +66,7 @@
|
|||
<record id="project_task_130" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_feature"/>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Data importation + Doc</field>
|
||||
|
@ -70,7 +74,7 @@
|
|||
<record id="project_task_131" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_feature"/>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_23"/>
|
||||
<field name="name">Modifications asked by the customer.</field>
|
||||
|
@ -78,7 +82,7 @@
|
|||
<record id="project_task_184" model="project.task">
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_feature"/>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="priority">0</field>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
|
@ -88,7 +92,7 @@
|
|||
<field name="sequence">15</field>
|
||||
<field name="planned_hours">8.0</field>
|
||||
<field name="remaining_hours">8.0</field>
|
||||
<field name="type" ref="project_tt_feature"/>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Internal testing + Software Install</field>
|
||||
|
@ -98,7 +102,7 @@
|
|||
<field name="sequence">17</field>
|
||||
<field name="planned_hours">16.0</field>
|
||||
<field name="remaining_hours">16.0</field>
|
||||
<field name="type" ref="project_tt_feature"/>
|
||||
<field name="type" ref="project_tt_development"/>
|
||||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="priority">2</field>
|
||||
<field name="state">open</field>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</group>
|
||||
</page>
|
||||
<page string="Tasks">
|
||||
<field name="tasks" nolabel="1" attrs="{'readonly':[('state','in',['cancelled','done'])]}">
|
||||
<field name="tasks" nolabel="1" attrs="{'readonly':[('state','in',['cancelled','done'])]}" colspan="4">
|
||||
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours<0;red:bool(date_deadline) and (date_deadline<current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
|
||||
<!-- <tree string="Tasks">-->
|
||||
<field name="sequence"/>
|
||||
|
@ -99,6 +99,8 @@
|
|||
<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>
|
||||
<page string="Notes">
|
||||
<field colspan="4" name="notes" nolabel="1"/>
|
||||
|
@ -351,7 +353,10 @@
|
|||
<field name="date_close" select="2"/>
|
||||
</group>
|
||||
<separator string="Miscelleanous" colspan="4"/>
|
||||
<field name="type" widget="selection"/>
|
||||
<field name="type" widget="selection" />
|
||||
<button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Type"/>
|
||||
<button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Type"/>
|
||||
<newline/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="active" select="2"/>
|
||||
<field name="partner_id" select="2"/>
|
||||
|
@ -375,6 +380,8 @@
|
|||
<field name="user_id"/>
|
||||
<field name="date_deadline"/>
|
||||
<field name="remaining_hours" widget="float_time"/>
|
||||
<field name="type"/>
|
||||
<button name="next_type" states="draft,open,pending" string="Change Type" type="object" icon="gtk-go-forward" help="Change Type"/>
|
||||
<field name="progress" widget="progressbar"/>
|
||||
<field name="state"/>
|
||||
<button name="do_open" states="pending,draft" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state"/>
|
||||
|
@ -480,6 +487,7 @@
|
|||
<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>
|
||||
|
@ -495,12 +503,13 @@
|
|||
</record>
|
||||
|
||||
<record id="action_view_task" model="ir.actions.act_window">
|
||||
<field name="name">All Tasks</field>
|
||||
<field name="name">Tasks</field>
|
||||
<field name="res_model">project.task</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,gantt,graph</field>
|
||||
<field eval="False" name="view_id"/>
|
||||
<field eval="True" name="filter"/>
|
||||
<field name="view_id" ref="view_task_tree2"/>
|
||||
<field name="search_view_id" ref="view_task_search_form"/>
|
||||
</record>
|
||||
<!--<menuitem action="action_view_task" id="menu_action_view_task" parent="project.menu_tasks"/> -->
|
||||
|
@ -613,7 +622,8 @@ menu_main
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Task type">
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="sequence"/>
|
||||
<field colspan="4" name="description" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -624,6 +634,7 @@ menu_main
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Task type">
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
|
|
@ -3,6 +3,5 @@
|
|||
<data>
|
||||
<wizard id="wizard_close_task" menu="False" model="project.task" name="project.task.close" string="Close Task"/>
|
||||
<wizard id="wizard_delegate_task" menu="False" model="project.task" name="project.task.delegate" string="Delegate Task"/>
|
||||
<!-- <wizard id="wizard_attachment_task" model="project.task" name="project.task.attachment" string="All Attachments"/> -->
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
import close_task
|
||||
import task_delegate
|
||||
import task_attachment
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
'''View the attachments of the parent + children tasks'''
|
||||
|
||||
def _show_attachment(self, cr, uid, data, context):
|
||||
task_obj = pooler.get_pool(cr.dbname).get('project.task')
|
||||
task_browse_id = task_obj.browse(cr, uid, [data['id']], context)[0]
|
||||
attachment_list = [child_id.id for child_id in task_browse_id.child_ids]
|
||||
attachment_list.extend([task_browse_id.parent_id.id])
|
||||
value = {
|
||||
'domain': [('res_model','=',data['model']),('res_id','in',attachment_list)],
|
||||
'name': 'Attachments',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'ir.attachment',
|
||||
'context': { },
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return value
|
||||
class wizard_attachment(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'action', 'action':_show_attachment, 'state': 'end'},
|
||||
},
|
||||
}
|
||||
wizard_attachment('project.task.attachment')
|
|
@ -45,7 +45,7 @@
|
|||
<field name="remaining_hours">38.0</field>
|
||||
<field name="timebox_id" ref="timebox_daily"/>
|
||||
<field name="context_id" ref="context_office"/>
|
||||
<field name="type" ref="project.project_tt_feature"/>
|
||||
<field name="type" ref="project.project_tt_development"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project.project_project_22"/>
|
||||
<field name="name">Specific adaptation to MRP</field>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<field name="remaining_hours">38.0</field>
|
||||
<field name="timebox_id" ref="timebox_daily"/>
|
||||
<field name="context_id" ref="context_office"/>
|
||||
<field name="type" ref="project.project_tt_feature"/>
|
||||
<field name="type" ref="project.project_tt_development"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="project_id" ref="project.project_project_22"/>
|
||||
<field name="name">Specific adaptation to MRP</field>
|
||||
|
|
Loading…
Reference in New Issue