[IMP]improved kanban view for project_issue.
bzr revid: kbh@tinyerp.com-20120328060812-narvwer99g5ywqsa
This commit is contained in:
parent
2fa091fe68
commit
c2e0268fad
|
@ -171,6 +171,7 @@
|
|||
<field name="effective_hours"/>
|
||||
<field name="total_hours"/>
|
||||
<field name="date"/>
|
||||
<field name="issues"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_module_vignette oe_kanban_box oe_kanban_color_border">
|
||||
|
@ -200,7 +201,7 @@
|
|||
</div>
|
||||
<table border="0" width="350px">
|
||||
<tr>
|
||||
<td align="right" valign="bottom">
|
||||
<td align="right" valign="bottom" class="tasks">
|
||||
<button name="open_tasks" class="oe_project_buttons" type="object"><i>Tasks ()</i></button>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -487,12 +487,59 @@ project_issue()
|
|||
|
||||
class project(osv.osv):
|
||||
_inherit = "project.project"
|
||||
|
||||
def _compute_issue(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res={}
|
||||
issue_pool=self.pool.get('project.issue')
|
||||
for project in self.browse(cr, uid, ids, context=context):
|
||||
issues = issue_pool.search(cr, uid, [('project_id','=',project.id)])
|
||||
res[project.id] = len(issues)
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'reply_to' : fields.char('Reply-To Email Address', size=256),
|
||||
'issues' : fields.boolean('Issues',help = "If you check this field issues are appears in kanban view")
|
||||
'issues' : fields.boolean('Issues',help = "If you check this field issues are appears in kanban view"),
|
||||
'open_issues': fields.function(_compute_issue , store=True,type='integer',string="Issue"),
|
||||
}
|
||||
|
||||
def open_issues(self, cr, uid, ids, context=None):
|
||||
#Open the View for the Tasks for the project
|
||||
"""
|
||||
This opens Issues views
|
||||
@return :Dictionary value for issue view
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
value = {}
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
for project in self.browse(cr, uid, ids, context=context):
|
||||
# Get Task views
|
||||
tree_view = data_obj.get_object_reference(cr, uid, 'project_issue', 'project_issue_tree_view')
|
||||
form_view = data_obj.get_object_reference(cr, uid, 'project_issue', 'project_issue_form_view')
|
||||
calander_view = data_obj.get_object_reference(cr, uid, 'project_issue', 'project_issue_calendar_view')
|
||||
search_view = data_obj.get_object_reference(cr, uid, 'project_issue', 'view_project_issue_filter')
|
||||
kanban_view = data_obj.get_object_reference(cr, uid, 'project_issue', 'project_issue_kanban_view')
|
||||
context.update({
|
||||
#'search_default_user_id': uid,
|
||||
'search_default_project_id':project.id
|
||||
})
|
||||
value = {
|
||||
'name': _('Issue'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'project.issue',
|
||||
'view_id': False,
|
||||
'domain':[('project_id','in',ids)],
|
||||
'context': context,
|
||||
'views': [(kanban_view and kanban_view[1] or False, 'kanban'),(tree_view and tree_view[1] or False, 'tree'),(calander_view and calander_view[1] or False, 'calendar'),(form_view and form_view[1] or False, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': search_view and search_view[1] or False,
|
||||
'nodestroy': True
|
||||
}
|
||||
return value
|
||||
|
||||
def _check_escalation(self, cr, uid, ids, context=None):
|
||||
project_obj = self.browse(cr, uid, ids[0], context=context)
|
||||
if project_obj.project_escalation_id:
|
||||
|
|
|
@ -380,5 +380,23 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_project_kanban_inherited" model="ir.ui.view">
|
||||
<field name="name">project.project.kanban.inherited</field>
|
||||
<field name="model">project.project</field>
|
||||
<field name="type">kanban</field>
|
||||
<field name="inherit_id" ref="project.view_project_kanban"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//td[@class='tasks']" position="replace">
|
||||
<td class="issues" align="right">
|
||||
<button name="open_tasks" class="oe_project_buttons" type="object"><i>Tasks ()</i></button>
|
||||
<t t-if="record.issues.raw_value == 1">
|
||||
<button name="open_issues" class="oe_project_buttons" type="object"><i>Issues (<field name="open_issues"/>)</i></button>
|
||||
</t>
|
||||
|
||||
</td>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue