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

bzr revid: mba@tinyerp.com-20140107131134-fho22izhbw86w1w5
This commit is contained in:
Mahendra Barad (OpenERP) 2014-01-07 18:41:34 +05:30
parent 0562d90529
commit 8eb7fb82de
11 changed files with 66 additions and 92 deletions

View File

@ -28,11 +28,11 @@ from openerp.osv import fields
from openerp.osv import osv
AVAILABLE_PRIORITIES = [
('1', 'Highest'),
('2', 'High'),
('3', 'Normal'),
('4', 'Low'),
('5', 'Lowest'),
('0', 'Lowest'),
('1', 'Low'),
('2', 'Normal'),
('3', 'High'),
('4', 'Highest'),
]
class crm_case_channel(osv.osv):

View File

@ -445,19 +445,7 @@ class crm_lead(format_address, osv.osv):
return True
def set_priority(self, cr, uid, ids, priority, context=None):
""" Set lead priority
"""
return self.write(cr, uid, ids, {'priority': priority}, context=context)
def set_high_priority(self, cr, uid, ids, context=None):
""" Set lead priority to high
"""
return self.set_priority(cr, uid, ids, '1', context=context)
def set_normal_priority(self, cr, uid, ids, context=None):
""" Set lead priority to normal
"""
return self.set_priority(cr, uid, ids, '3', context=context)
return self.write(cr, uid, ids, {'priority': str(priority)}, context=context)
def _merge_get_result_type(self, cr, uid, opps, context=None):
"""

View File

@ -174,7 +174,7 @@ Contact: +1 813 494 5005</field>
<field name="type_id" ref="type_lead8"/>
<field name="categ_ids" eval="[(6, 0, [categ_oppor4])]"/>
<field name="channel_id" ref=""/>
<field name="priority">5</field>
<field name="priority">4</field>
<field name="section_id" ref="crm_case_section_2"/>
<field name="user_id" ref="base.user_root"/>
<field name="stage_id" ref="stage_lead1"/>
@ -525,7 +525,7 @@ Andrew</field>
<field name="type_id" ref="type_lead5"/>
<field name="categ_ids" eval="[(6, 0, [categ_oppor3])]"/>
<field name="channel_id" ref="crm_case_channel_direct"/>
<field name="priority">5</field>
<field name="priority">4</field>
<field name="section_id" ref="section_sales_department"/>
<field name="user_id" ref="base.user_demo"/>
<field name="stage_id" ref="crm.stage_lead5"/>
@ -543,7 +543,7 @@ Andrew</field>
<field name="type_id" ref="type_lead8"/>
<field name="categ_ids" eval="[(6, 0, [categ_oppor7])]"/>
<field name="channel_id" ref="crm_case_channel_website"/>
<field name="priority">5</field>
<field name="priority">4</field>
<field eval="time.strftime('%Y-%m-6')" name="date_deadline"/>
<field name="section_id" ref="section_sales_department"/>
<field name="user_id" ref="base.user_root"/>

View File

@ -302,9 +302,16 @@
<field name="title_action"/>
</div>
<div class="oe_kanban_bottom_right">
<a t-if="record.priority.raw_value == 1" type="object" name="set_normal_priority" class="oe_e oe_star_on">7</a>
<a t-if="record.priority.raw_value != 1" type="object" name="set_high_priority" class="oe_e oe_star_off">7</a>
<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" t-if="record.user_id.value"/>
<table>
<tr>
<td groups="base.group_user">
<field name="priority" class="oe_inline" widget="legend" options="{'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">
<t t-raw="record.message_summary.raw_value"/>
@ -394,6 +401,7 @@
name="action_makeMeeting"
context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
</div>
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
@ -422,7 +430,6 @@
<field name="title_action" class="oe_inline" nolabel="1" placeholder="e.g. Call for proposal"/>
</div>
<field name="date_deadline"/>
<field name="priority"/>
</group>
<group>

View File

@ -27,12 +27,11 @@ from openerp.tools.translate import _
from openerp.tools import html2plaintext
AVAILABLE_PRIORITIES = [
('', ''),
('5', 'Not Good'),
('4', 'On Average'),
('3', 'Good'),
('2', 'Very Good'),
('1', 'Excellent')
('0', 'Not Good'),
('1', 'On Average'),
('2', 'Good'),
('3', 'Very Good'),
('4', 'Excellent')
]
class hr_recruitment_source(osv.osv):
@ -467,7 +466,7 @@ class hr_applicant(osv.Model):
def set_priority(self, cr, uid, ids, priority, *args):
"""Set applicant priority
"""
return self.write(cr, uid, ids, {'priority': priority})
return self.write(cr, uid, ids, {'priority': str(priority)})
def set_high_priority(self, cr, uid, ids, *args):
"""Set applicant priority to high

View File

@ -85,6 +85,7 @@
attrs="{'invisible':[('survey','=',False)]}"/>
<button name="action_get_attachment_tree_view" string="Documents" type="object"/>
</div>
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
@ -113,7 +114,6 @@
<field name="date_action"/>
<field name="title_action" class="oe_inline" placeholder="e.g. Call for interview"/>
</div>
<field name="priority"/>
<field name="source_id"/>
<field name="reference"/>
</group>
@ -277,21 +277,16 @@
</div>
<div style="width:240px"><field name="categ_ids"/></div>
<div class="oe_kanban_right">
<t t-set="priority" t-value="record.priority.raw_value || 5"/>
<a type="object" name="set_priority" args="['3']" t-if="priority gt 3">
<img src="/web/static/src/img/icons/star-off.png" width="16" height="16" title="Good"/>
</a>
<a type="object" name="set_priority" args="['5']" t-if="priority lte 3">
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 3 ? 'on' : 'off'}.png" width="16" height="16" title="Good"/>
</a>
<a type="object" name="set_priority" args="['2']">
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 2 ? 'on' : 'off'}.png" width="16" height="16" title="Very Good"/>
</a>
<a type="object" name="set_priority" args="['1']">
<img t-attf-src="/web/static/src/img/icons/star-#{priority == 1 ? 'on' : 'off'}.png" width="16" height="16" title="Excellent"/>
</a>
<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="priority" class="oe_inline" widget="legend" options="{'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" style="margin-top:5px;">
<t t-raw="record.message_summary.raw_value"/>

View File

@ -764,7 +764,7 @@ class task(osv.osv):
" * Normal is the default situation\n"
" * Blocked indicates something is preventing the progress of this task\n"
" * Ready for next stage indicates the task is ready to be pulled to the next stage",
readonly=True, required=False),
required=False),
'create_date': fields.datetime('Create Date', readonly=True, select=True),
'write_date': fields.datetime('Last Modification Date', readonly=True, select=True), #not displayed in the view but it might be useful with base_action_rule module (and it needs to be defined first for that)
'date_start': fields.datetime('Starting Date',select=True),
@ -823,6 +823,8 @@ class task(osv.osv):
_order = "priority, sequence, date_start, name, id"
def set_kanban_state(self, cr, uid, ids, state, context=None):
print 'state>>>>>>>>>>',ids
print 'state>>>>>>>>>>',state
self.write(cr, uid, ids, {'kanban_state': state }, context=context);
def set_priority(self, cr, uid, ids, priority, context=None):

View File

@ -375,8 +375,8 @@
<h1>
<field name="name" placeholder="Task summary..." class="oe_inline"/>
<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'}"/>
<field name="kanban_state" class="oe_inline" widget="legend" options="{'action':'set_kanban_state'}" />
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/>
</div>
</h1>
<group>
@ -513,10 +513,10 @@
<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'}" />
<field name="kanban_state" class="oe_inline" widget="legend" options="{'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'}"/>
<field name="priority" class="oe_inline" widget="legend" options="{'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"/>

View File

@ -250,7 +250,7 @@ class project_issue(osv.Model):
" * Normal is the default situation\n"
" * Blocked indicates something is preventing the progress of this issue\n"
" * Ready for next stage indicates the issue is ready to be pulled to the next stage",
readonly=True, required=False),
required=False),
'email_from': fields.char('Email', size=128, help="These people will receive email.", select=1),
'email_cc': fields.char('Watchers Emails', size=256, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'date_open': fields.datetime('Opened', readonly=True,select=True),
@ -308,17 +308,10 @@ class project_issue(osv.Model):
def set_priority(self, cr, uid, ids, priority, *args):
"""Set lead priority
"""
return self.write(cr, uid, ids, {'priority' : priority})
return self.write(cr, uid, ids, {'priority' : str(priority)})
def set_high_priority(self, cr, uid, ids, *args):
"""Set lead priority to high
"""
return self.set_priority(cr, uid, ids, '1')
def set_normal_priority(self, cr, uid, ids, *args):
"""Set lead priority to normal
"""
return self.set_priority(cr, uid, ids, '3')
def set_kanban_state(self, cr, uid, ids, state, context=None):
self.write(cr, uid, ids, {'kanban_state': state }, context=context);
def copy(self, cr, uid, id, default=None, context=None):
issue = self.read(cr, uid, id, ['name'], context=context)

View File

@ -35,7 +35,7 @@
<!-- Issues -->
<record id="crm_case_buginaccountsmodule0" model="project.issue">
<field eval="time.strftime('%Y-%m-08 10:15:00')" name="date"/>
<field name="priority">5</field>
<field name="priority">4</field>
<field name="user_id" ref="base.user_root"/>
<field name="partner_id" ref="base.res_partner_2"/>
<field name="section_id" ref="crm.section_sales_department"/>

View File

@ -55,10 +55,10 @@
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" 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="{'action':'set_kanban_state'}" />
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/>
</div>
</h1>
<label for="categ_ids" class="oe_edit_only"/>
<field name="categ_ids" widget="many2many_tags"/>
@ -78,7 +78,6 @@
<group>
<field name="id"/>
<field name="version_id" groups="base.group_user"/>
<field name="priority" groups="base.group_user"/>
<label for="task_id" groups="base.group_user"/>
<div groups="base.group_user">
<field name="task_id" on_change="onchange_task_id(task_id)" class="oe_inline" context="{'default_project_id':project_id}"/>
@ -219,28 +218,19 @@
<div class="oe_kanban_footer_left">
<field name="categ_ids"/>
<div class="oe_right">
<span class="oe_kanban_highlight" 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>
<t t-set="priority" t-value="record.priority.raw_value || 5"/>
<a type="object" name="set_priority" args="['3']" t-if="priority gt 3" title="Normal Priority">
<img src="/web/static/src/img/icons/star-off.png" width="16" height="16"/>
</a>
<a type="object" name="set_priority" args="['5']" t-if="priority lte 3" title="Normal Priority">
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 3 ? 'on' : 'off'}.png" width="16" height="16"/>
</a>
<a type="object" name="set_priority" args="['2']" title="High Priority">
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 2 ? 'on' : 'off'}.png" width="16" height="16"/>
</a>
<a type="object" name="set_priority" args="['1']" title="Highest Priority">
<img t-attf-src="/web/static/src/img/icons/star-#{priority == 1 ? 'on' : 'off'}.png" width="16" height="16"/>
</a>
</span>
<t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())">
<span t-attf-class="oe_kanban_status oe_kaban_status_red"> </span>
</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="{'action':'set_kanban_state'}" />
</td>
<td groups="base.group_user">
<field name="priority" class="oe_inline" widget="legend" options="{'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>
<div class="oe_kanban_footer_left">