[IMP] project_issue: small code cleanup for project kanban view
bzr revid: rco@openerp.com-20120509065644-5piwp0fw4qqy434c
This commit is contained in:
parent
7dab19c32b
commit
0c1334bd62
|
@ -222,14 +222,6 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
}),
|
||||
}
|
||||
|
||||
def _get_project(self, cr, uid, context=None):
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.context_project_id:
|
||||
return user.context_project_id.id
|
||||
else:
|
||||
project_id = context.get('active_id',False)
|
||||
return project_id
|
||||
|
||||
def on_change_project(self, cr, uid, ids, project_id, context=None):
|
||||
return {}
|
||||
|
||||
|
@ -519,16 +511,15 @@ class project(osv.osv):
|
|||
|
||||
def _issue_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict.fromkeys(ids, 0)
|
||||
issue_pool = self.pool.get('project.issue')
|
||||
issue_ids = issue_pool.search(cr, uid, [('project_id', 'in', ids)])
|
||||
for issue in issue_pool.browse(cr, uid, issue_ids, context):
|
||||
issue_ids = self.pool.get('project.issue').search(cr, uid, [('project_id', 'in', ids)])
|
||||
for issue in self.pool.get('project.issue').browse(cr, uid, issue_ids, context):
|
||||
res[issue.project_id.id] += 1
|
||||
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),
|
||||
'use_issues' : fields.boolean('Issues',help = "If you check this field issues are appears in kanban view"),
|
||||
'use_issues' : fields.boolean('Use Issues', help="Check this field if this project manages issues"),
|
||||
'issue_count': fields.function(_issue_count, type='integer'),
|
||||
}
|
||||
|
||||
|
|
|
@ -335,14 +335,13 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
context="{'search_default_project_id': [active_id], 'default_project_id': active_id}"
|
||||
id="act_project_project_2_project_issue_all"
|
||||
<act_window id="act_project_project_2_project_issue_all"
|
||||
name="Issues"
|
||||
res_model="project.issue"
|
||||
src_model="project.project"
|
||||
res_model="project.issue"
|
||||
view_type="form"
|
||||
view_mode="kanban,tree,form,calendar,graph"
|
||||
view_type="form"/>
|
||||
context="{'search_default_project_id': [active_id], 'default_project_id': active_id}"/>
|
||||
|
||||
# ------------------------------------------------------
|
||||
# Project
|
||||
|
@ -354,9 +353,9 @@
|
|||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="project.edit_project"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='use_tasks']" position="after">
|
||||
<field name="use_tasks" position="after">
|
||||
<field name="use_issues"/>
|
||||
</xpath>
|
||||
</field>
|
||||
<field name="priority" position="before">
|
||||
<field name="project_escalation_id"/>
|
||||
<field name="reply_to"/>
|
||||
|
@ -375,9 +374,9 @@
|
|||
<field name="issue_count" invisible="1"/>
|
||||
</field>
|
||||
<xpath expr="//div[@id='list']" position="inside">
|
||||
<t t-if="record.use_issues.raw_value">
|
||||
<a id="2" name="%(act_project_project_2_project_issue_all)d" class="oe_project_buttons" type="action"><t t-if="record.issue_count.value <= 1">Issue</t><t t-if="record.issue_count.value > 1">Issues</t>(<t t-esc="record.issue_count.value"/>)</a>
|
||||
</t>
|
||||
<a t-if="record.use_issues.raw_value" class="oe_project_buttons"
|
||||
id="2" name="%(act_project_project_2_project_issue_all)d" type="action">
|
||||
Issues(<field name="issue_count"/>)</a>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue