[IMP]improved priority and remove unused methods

bzr revid: mba@tinyerp.com-20140214114937-uzli19c8anu40lgn
This commit is contained in:
Mahendra Barad (OpenERP) 2014-02-14 17:19:37 +05:30
parent 0707b77f63
commit 3ed1c1b3a6
16 changed files with 38 additions and 64 deletions

View File

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

View File

@ -444,9 +444,6 @@ class crm_lead(format_address, osv.osv):
self.write(cr, uid, [case.id], data, context=context) self.write(cr, uid, [case.id], data, context=context)
return True return True
def set_priority(self, cr, uid, ids, priority, context=None):
return self.write(cr, uid, ids, {'priority': str(priority)}, context=context)
def _merge_get_result_type(self, cr, uid, opps, context=None): def _merge_get_result_type(self, cr, uid, opps, context=None):
""" """
Define the type of the result of the merge. If at least one of the Define the type of the result of the merge. If at least one of the

View File

@ -305,7 +305,7 @@
<table> <table>
<tr> <tr>
<td groups="base.group_user"> <td groups="base.group_user">
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <field name="priority" widget="priority"/>
</td> </td>
<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"/> <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"/>
@ -401,7 +401,7 @@
name="action_makeMeeting" name="action_makeMeeting"
context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/> context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
</div> </div>
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <field name="priority" class="oe_inline" widget="priority"/>
<div class="oe_title"> <div class="oe_title">
<label for="name" class="oe_edit_only"/> <label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1> <h1><field name="name"/></h1>

View File

@ -61,7 +61,7 @@ class crm_phonecall(osv.osv):
('object_id.model', '=', 'crm.phonecall')]"), ('object_id.model', '=', 'crm.phonecall')]"),
'partner_phone': fields.char('Phone', size=32), 'partner_phone': fields.char('Phone', size=32),
'partner_mobile': fields.char('Mobile', size=32), 'partner_mobile': fields.char('Mobile', size=32),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'),
'date_closed': fields.datetime('Closed', readonly=True), 'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'), 'date': fields.datetime('Date'),
'opportunity_id': fields.many2one ('crm.lead', 'Lead/Opportunity'), 'opportunity_id': fields.many2one ('crm.lead', 'Lead/Opportunity'),
@ -74,7 +74,7 @@ class crm_phonecall(osv.osv):
_defaults = { _defaults = {
'date': fields.datetime.now, 'date': fields.datetime.now,
'priority': crm.AVAILABLE_PRIORITIES[2][0], 'priority': '1',
'state': _get_default_state, 'state': _get_default_state,
'user_id': lambda self, cr, uid, ctx: uid, 'user_id': lambda self, cr, uid, ctx: uid,
'active': 1 'active': 1

View File

@ -42,7 +42,7 @@ class crm_phonecall_report(osv.osv):
_columns = { _columns = {
'user_id':fields.many2one('res.users', 'User', readonly=True), 'user_id':fields.many2one('res.users', 'User', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'),
'nbr': fields.integer('# of Cases', readonly=True), 'nbr': fields.integer('# of Cases', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True),
'create_date': fields.datetime('Create Date', readonly=True, select=True), 'create_date': fields.datetime('Create Date', readonly=True, select=True),

View File

@ -88,7 +88,7 @@ class crm_claim(osv.osv):
'categ_id': fields.many2one('crm.case.categ', 'Category', \ 'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\ domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.claim')]"), ('object_id.model', '=', 'crm.claim')]"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'),
'type_action': fields.selection([('correction','Corrective Action'),('prevention','Preventive Action')], 'Action Type'), 'type_action': fields.selection([('correction','Corrective Action'),('prevention','Preventive Action')], 'Action Type'),
'user_id': fields.many2one('res.users', 'Responsible'), 'user_id': fields.many2one('res.users', 'Responsible'),
'user_fault': fields.char('Trouble Responsible', size=64), 'user_fault': fields.char('Trouble Responsible', size=64),
@ -111,7 +111,7 @@ class crm_claim(osv.osv):
'section_id': lambda s, cr, uid, c: s._get_default_section_id(cr, uid, c), 'section_id': lambda s, cr, uid, c: s._get_default_section_id(cr, uid, c),
'date': fields.datetime.now, 'date': fields.datetime.now,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.case', context=c), 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.case', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], 'priority': '1',
'active': lambda *a: 1, 'active': lambda *a: 1,
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c) 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c)
} }

View File

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

View File

@ -59,7 +59,7 @@ class crm_helpdesk(osv.osv):
'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel."), 'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel."),
'planned_revenue': fields.float('Planned Revenue'), 'planned_revenue': fields.float('Planned Revenue'),
'planned_cost': fields.float('Planned Costs'), 'planned_cost': fields.float('Planned Costs'),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'),
'probability': fields.float('Probability (%)'), 'probability': fields.float('Probability (%)'),
'categ_id': fields.many2one('crm.case.categ', 'Category', \ 'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="['|',('section_id','=',False),('section_id','=',section_id),\ domain="['|',('section_id','=',False),('section_id','=',section_id),\
@ -83,7 +83,7 @@ class crm_helpdesk(osv.osv):
'state': lambda *a: 'draft', 'state': lambda *a: 'draft',
'date': fields.datetime.now, 'date': fields.datetime.now,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c), 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], 'priority': '1',
} }
def on_change_partner_id(self, cr, uid, ids, partner_id, context=None): def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):

View File

@ -25,10 +25,11 @@ from openerp.tools.translate import _
AVAILABLE_PRIORITIES = [ AVAILABLE_PRIORITIES = [
('0', 'On Average'), ('0', 'Bad'),
('1', 'Good'), ('1', 'Below Average'),
('2', 'Very Good'), ('2', 'Average'),
('3', 'Excellent') ('3', 'Good'),
('4', 'Excellent')
] ]
class hr_recruitment_source(osv.osv): class hr_recruitment_source(osv.osv):
@ -474,21 +475,6 @@ class hr_applicant(osv.Model):
dict_act_window['view_mode'] = 'form,tree' dict_act_window['view_mode'] = 'form,tree'
return dict_act_window return dict_act_window
def set_priority(self, cr, uid, ids, priority, *args):
"""Set applicant priority
"""
return self.write(cr, uid, ids, {'priority': str(priority)})
def set_high_priority(self, cr, uid, ids, *args):
"""Set applicant priority to high
"""
return self.set_priority(cr, uid, ids, '1')
def set_normal_priority(self, cr, uid, ids, *args):
"""Set applicant priority to normal
"""
return self.set_priority(cr, uid, ids, '3')
def get_empty_list_help(self, cr, uid, help, context=None): def get_empty_list_help(self, cr, uid, help, context=None):
context['empty_list_help_model'] = 'hr.job' context['empty_list_help_model'] = 'hr.job'
context['empty_list_help_id'] = context.get('default_job_id', None) context['empty_list_help_id'] = context.get('default_job_id', None)

View File

@ -85,7 +85,7 @@
attrs="{'invisible':[('survey','=',False)]}"/> attrs="{'invisible':[('survey','=',False)]}"/>
<button name="action_get_attachment_tree_view" string="Documents" type="object"/> <button name="action_get_attachment_tree_view" string="Documents" type="object"/>
</div> </div>
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <field name="priority" class="oe_inline" widget="priority"/>
<div class="oe_title"> <div class="oe_title">
<label for="name" class="oe_edit_only"/> <label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1> <h1><field name="name"/></h1>
@ -280,7 +280,7 @@
<table> <table>
<tr> <tr>
<td groups="base.group_user"> <td groups="base.group_user">
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <field name="priority" widget="priority"/>
</td> </td>
<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"/> <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

@ -752,7 +752,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."), '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), 'name': fields.char('Task Summary', size=128, required=True, select=True),
'description': fields.text('Description'), 'description': fields.text('Description'),
'priority': fields.selection([('0','Medium'), ('1','Important'), ('2','Very important')], 'Priority', select=True), 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority', select=True),
'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."), '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', 'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange',
domain="[('project_ids', '=', project_id)]"), domain="[('project_ids', '=', project_id)]"),
@ -811,7 +811,7 @@ class task(osv.osv):
'project_id': _get_default_project_id, 'project_id': _get_default_project_id,
'date_last_stage_update': fields.datetime.now, 'date_last_stage_update': fields.datetime.now,
'kanban_state': 'normal', 'kanban_state': 'normal',
'priority': '2', 'priority': '1',
'progress': 0, 'progress': 0,
'sequence': 10, 'sequence': 10,
'active': True, 'active': True,
@ -821,12 +821,6 @@ class task(osv.osv):
} }
_order = "priority, sequence, date_start, name, id" _order = "priority, sequence, date_start, name, id"
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 _check_recursion(self, cr, uid, ids, context=None): def _check_recursion(self, cr, uid, ids, context=None):
for id in ids: for id in ids:
visited_branch = set() visited_branch = set()

View File

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

@ -48,7 +48,7 @@ class report_project_task_user(osv.osv):
help="Number of Days to Open the task"), help="Number of Days to Open the task"),
'delay_endings_days': fields.float('Overpassed Deadline', digits=(16,2), readonly=True), 'delay_endings_days': fields.float('Overpassed Deadline', digits=(16,2), readonly=True),
'nbr': fields.integer('# of tasks', readonly=True), 'nbr': fields.integer('# of tasks', readonly=True),
'priority': fields.selection([('4', 'Very Low'), ('3', 'Low'), ('2', 'Medium'), ('1', 'Urgent'), ('0', 'Very urgent')], 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')],
string='Priority', readonly=True), string='Priority', readonly=True),
'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')],'Status', readonly=True), 'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')],'Status', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True), 'company_id': fields.many2one('res.company', 'Company', readonly=True),

View File

@ -260,7 +260,7 @@ class project_issue(osv.Model):
'date_last_stage_update': fields.datetime('Last Stage Update', select=True), 'date_last_stage_update': fields.datetime('Last Stage Update', select=True),
'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel."), 'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel."),
'categ_ids': fields.many2many('project.category', string='Tags'), 'categ_ids': fields.many2many('project.category', string='Tags'),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority', select=True),
'version_id': fields.many2one('project.issue.version', 'Version'), 'version_id': fields.many2one('project.issue.version', 'Version'),
'stage_id': fields.many2one ('project.task.type', 'Stage', 'stage_id': fields.many2one ('project.task.type', 'Stage',
track_visibility='onchange', track_visibility='onchange',
@ -295,7 +295,7 @@ class project_issue(osv.Model):
'active': 1, 'active': 1,
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c), 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c), 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
'priority': crm.AVAILABLE_PRIORITIES[2][0], 'priority': '1',
'kanban_state': 'normal', 'kanban_state': 'normal',
'date_last_stage_update': fields.datetime.now, 'date_last_stage_update': fields.datetime.now,
'user_id': lambda obj, cr, uid, context: uid, 'user_id': lambda obj, cr, uid, context: uid,
@ -310,9 +310,6 @@ class project_issue(osv.Model):
""" """
return self.write(cr, uid, ids, {'priority' : str(priority)}) return self.write(cr, uid, ids, {'priority' : str(priority)})
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): def copy(self, cr, uid, id, default=None, context=None):
issue = self.read(cr, uid, id, ['name'], context=context) issue = self.read(cr, uid, id, ['name'], context=context)
if not default: if not default:

View File

@ -56,8 +56,8 @@
<h1> <h1>
<field name="name" class="oe_inline"/> <field name="name" class="oe_inline"/>
<div class="oe_right"> <div class="oe_right">
<field name="kanban_state" class="oe_inline" widget="legend" options="{'action':'set_kanban_state'}" /> <field name="kanban_state" class="oe_inline" widget="dropdown_selection"/>
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <field name="priority" class="oe_inline" widget="priority"/>
</div> </div>
</h1> </h1>
<label for="categ_ids" class="oe_edit_only"/> <label for="categ_ids" class="oe_edit_only"/>
@ -221,10 +221,10 @@
<table> <table>
<tr> <tr>
<td groups="base.group_user"> <td groups="base.group_user">
<field name="kanban_state" class="oe_inline" widget="legend" options="{'action':'set_kanban_state'}" /> <field name="kanban_state" widget="dropdown_selection"/>
</td> </td>
<td groups="base.group_user"> <td groups="base.group_user">
<field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <field name="priority" widget="priority"/>
</td> </td>
<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"/> <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

@ -47,7 +47,7 @@ class project_issue_report(osv.osv):
'delay_close': fields.float('Avg. Delay to Close', digits=(16,2), readonly=True, group_operator="avg", 'delay_close': fields.float('Avg. Delay to Close', digits=(16,2), readonly=True, group_operator="avg",
help="Number of Days to close the project issue"), help="Number of Days to close the project issue"),
'company_id' : fields.many2one('res.company', 'Company'), 'company_id' : fields.many2one('res.company', 'Company'),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'),
'project_id':fields.many2one('project.project', 'Project',readonly=True), 'project_id':fields.many2one('project.project', 'Project',readonly=True),
'version_id': fields.many2one('project.issue.version', 'Version'), 'version_id': fields.many2one('project.issue.version', 'Version'),
'user_id' : fields.many2one('res.users', 'Assigned to',readonly=True), 'user_id' : fields.many2one('res.users', 'Assigned to',readonly=True),