summaryrefslogtreecommitdiff
path: root/addons/project_long_term
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-04-10 16:51:31 +0200
committerGery Debongnie <ged@openerp.com>2014-04-10 16:51:31 +0200
commit2e9ee9c76e7eae0a98af773ad8abd7585d4ea0ec (patch)
tree7bff96787a2521001e88f9a985f07c584b85516f /addons/project_long_term
parentac2f58ce68481dfbc05ca8bb496c94c59b137565 (diff)
parent4c0f7b1be8d188734b44856f093fa525f6837489 (diff)
[MERGE] merge from rma branch
bzr revid: ged@openerp.com-20140410145131-fj17mdpi13wa5a9m
Diffstat (limited to 'addons/project_long_term')
-rw-r--r--addons/project_long_term/project_long_term.py10
-rw-r--r--addons/project_long_term/project_long_term_view.xml13
2 files changed, 18 insertions, 5 deletions
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index 29e94591094..3bb78892994 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -98,7 +98,14 @@ class project_phase(osv.osv):
else:
res[phase.id] = round(100.0 * done / tot, 2)
return res
-
+ def _tasks_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,0), ids))
+ try:
+ for task in self.browse(cr, uid, ids, context=context):
+ res[task.id] = len(task.task_ids)
+ except:
+ pass
+ return res
_columns = {
'name': fields.char("Name", size=64, required=True),
'date_start': fields.datetime('Start Date', select=True, help="It's computed by the scheduler according the project date or the end date of the previous phase.", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
@@ -119,6 +126,7 @@ class project_phase(osv.osv):
help='If the phase is created the status \'Draft\'.\n If the phase is started, the status becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' status.\
\n If the phase is over, the status is set to \'Done\'.'),
'progress': fields.function(_compute_progress, string='Progress', help="Computed based on related tasks"),
+ 'tasks_count': fields.function(_tasks_count, string='# Related Tasks', type='integer'),
}
_defaults = {
'state': 'draft',
diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml
index 36fb83000ce..4af0a7aed0a 100644
--- a/addons/project_long_term/project_long_term_view.xml
+++ b/addons/project_long_term/project_long_term_view.xml
@@ -102,9 +102,10 @@
<label for="use_phases"/>
</xpath>
<xpath expr="//div[@name='buttons']" position='inside'>
- <button name="%(act_project_phases)d"
- string="Phases" type="action"
- attrs="{'invisible':[('use_phases','=', 0)]}"/>
+ <button class="oe_inline oe_stat_button" type="action"
+ attrs="{'invisible':[('use_phases','=', 0)]}" name="%(act_project_phases)d" icon="fa-qrcode">
+ <field string="Phases" name="phase_count" widget="statinfo"/>
+ </button>
</xpath>
</field>
</record>
@@ -151,7 +152,11 @@
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
</header>
<sheet>
- <button name="%(project_phase_task_list)d" string="Related Tasks" type="action" class="oe_right"/>
+ <div class="oe_button_box oe_right">
+ <button class=" oe_inline oe_stat_button " name= "%(project_phase_task_list)d" type="action" icon="fa-tasks">
+ <field string="Tasks" name="tasks_count" widget="statinfo"/>
+ </button>
+ </div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>