[IMP]added the legend widget for priority and kanban state

bzr revid: mba@tinyerp.com-20140106101643-q71iuge9zojl49s8
This commit is contained in:
Mahendra Barad (OpenERP) 2014-01-06 15:46:43 +05:30
parent ced63415b7
commit 0562d90529
2 changed files with 24 additions and 19 deletions

View File

@ -753,7 +753,7 @@ class task(osv.osv):
'active': fields.function(_is_template, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."),
'name': fields.char('Task Summary', size=128, required=True, select=True),
'description': fields.text('Description'),
'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True),
'priority': fields.selection([('0','Very Low'), ('1','Low'), ('2','Medium'), ('3','Important'), ('4','Very important')], 'Priority', select=True),
'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."),
'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange',
domain="[('project_ids', '=', project_id)]"),
@ -821,11 +821,12 @@ class task(osv.osv):
'partner_id': lambda self, cr, uid, ctx=None: self._get_default_partner(cr, uid, context=ctx),
}
_order = "priority, sequence, date_start, name, id"
def set_high_priority(self, cr, uid, ids, *args):
"""Set task priority to high
"""
return self.write(cr, uid, ids, {'priority' : '0'})
def set_kanban_state(self, cr, uid, ids, state, context=None):
self.write(cr, uid, ids, {'kanban_state': state }, context=context);
def set_priority(self, cr, uid, ids, priority, context=None):
return self.write(cr, uid, ids, {'priority' : str(priority)}, context=context)
def set_normal_priority(self, cr, uid, ids, *args):
"""Set task priority to normal

View File

@ -374,10 +374,10 @@
<sheet string="Task">
<h1>
<field name="name" placeholder="Task summary..." class="oe_inline"/>
<field name="kanban_state" invisible='1'/>
<button name="set_kanban_state_done" help="In Progress" attrs="{'invisible': [('kanban_state', 'in', ['done','blocked'])]}" type="object" icon="gtk-normal" class="oe_link oe_right"/>
<button name="set_kanban_state_blocked" help="Ready for Next Stage" attrs="{'invisible': [('kanban_state', 'in', ['normal','blocked'])]}" type="object" icon="gtk-yes" class="oe_link oe_right"/>
<button name="set_kanban_state_normal" help="Blocked" attrs="{'invisible': [('kanban_state', 'in', ['done','normal'])]}" type="object" icon="gtk-no" class="oe_link oe_right"/>
<div class="oe_right">
<field name="kanban_state" class="oe_inline" widget="legend" options="{'legend_field':'kanban_state','action':'set_kanban_state'}" />
<field name="priority" class="oe_inline" widget="legend" options="{'legend_field':'priority','action':'set_priority'}"/>
</div>
</h1>
<group>
<group>
@ -439,7 +439,6 @@
</page>
<page string="Extra Info">
<group col="4">
<field name="priority" groups="base.group_user"/>
<field name="sequence"/>
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
@ -511,14 +510,19 @@
<span t-attf-class="#{red || ''}"><i><field name="date_deadline"/></i></span>
</div>
<div class="oe_kanban_bottom_right">
<t groups="base.group_user">
<a t-if="record.kanban_state.raw_value === 'normal'" type="object" string="In Progress" name="set_kanban_state_done" class="oe_kanban_status"> </a>
<a t-if="record.kanban_state.raw_value === 'done'" type="object" string="Ready for next stage" name="set_kanban_state_blocked" class="oe_kanban_status oe_kanban_status_green"> </a>
<a t-if="record.kanban_state.raw_value === 'blocked'" type="object" string="Blocked" name="set_kanban_state_normal" class="oe_kanban_status oe_kanban_status_red"> </a>
<a t-if="record.priority.raw_value > 0" type="object" string="Normal" name="set_high_priority" class="oe_e oe_star_off">7</a>
<a t-if="record.priority.raw_value == 0" type="object" string="Very Important" name="set_normal_priority" class="oe_e oe_star_on">7</a>
</t>
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
<table>
<tr>
<td groups="base.group_user">
<field name="kanban_state" class="oe_inline" widget="legend" options="{'legend_field':'kanban_state','action':'set_kanban_state'}" />
</td>
<td groups="base.group_user">
<field name="priority" class="oe_inline" widget="legend" options="{'legend_field':'priority','action':'set_priority'}"/>
</td>
<td>
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
</td>
</tr>
</table>
</div>
<div class="oe_kanban_footer_left">
<span groups="project.group_time_work_estimation_tasks" title="Remaining hours">