[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
AVAILABLE_PRIORITIES = [
('0', 'Normal'),
('1', 'High'),
('2', 'Highest'),
('0', 'Very Low'),
('1', 'Low'),
('2', 'Normal'),
('3', 'High'),
('4', 'Very High'),
]
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)
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):
"""
Define the type of the result of the merge. If at least one of the

View File

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

View File

@ -61,7 +61,7 @@ class crm_phonecall(osv.osv):
('object_id.model', '=', 'crm.phonecall')]"),
'partner_phone': fields.char('Phone', 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': fields.datetime('Date'),
'opportunity_id': fields.many2one ('crm.lead', 'Lead/Opportunity'),
@ -74,7 +74,7 @@ class crm_phonecall(osv.osv):
_defaults = {
'date': fields.datetime.now,
'priority': crm.AVAILABLE_PRIORITIES[2][0],
'priority': '1',
'state': _get_default_state,
'user_id': lambda self, cr, uid, ctx: uid,
'active': 1

View File

@ -42,7 +42,7 @@ class crm_phonecall_report(osv.osv):
_columns = {
'user_id':fields.many2one('res.users', 'User', 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),
'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=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', \
domain="[('section_id','=',section_id),\
('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'),
'user_id': fields.many2one('res.users', 'Responsible'),
'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),
'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),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
'priority': '1',
'active': lambda *a: 1,
'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
AVAILABLE_PRIORITIES = [
('5', 'Lowest'),
('4', 'Low'),
('3', 'Normal'),
('2', 'High'),
('1', 'Highest')
('0', 'Low'),
('1', 'Normal'),
('2', 'High')
]

View File

@ -59,7 +59,7 @@ class crm_helpdesk(osv.osv):
'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel."),
'planned_revenue': fields.float('Planned Revenue'),
'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 (%)'),
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="['|',('section_id','=',False),('section_id','=',section_id),\
@ -83,7 +83,7 @@ class crm_helpdesk(osv.osv):
'state': lambda *a: 'draft',
'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),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
'priority': '1',
}
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 = [
('0', 'On Average'),
('1', 'Good'),
('2', 'Very Good'),
('3', 'Excellent')
('0', 'Bad'),
('1', 'Below Average'),
('2', 'Average'),
('3', 'Good'),
('4', 'Excellent')
]
class hr_recruitment_source(osv.osv):
@ -474,21 +475,6 @@ class hr_applicant(osv.Model):
dict_act_window['view_mode'] = 'form,tree'
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):
context['empty_list_help_model'] = 'hr.job'
context['empty_list_help_id'] = context.get('default_job_id', None)

View File

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

@ -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."),
'name': fields.char('Task Summary', size=128, required=True, select=True),
'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."),
'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange',
domain="[('project_ids', '=', project_id)]"),
@ -811,7 +811,7 @@ class task(osv.osv):
'project_id': _get_default_project_id,
'date_last_stage_update': fields.datetime.now,
'kanban_state': 'normal',
'priority': '2',
'priority': '1',
'progress': 0,
'sequence': 10,
'active': True,
@ -821,12 +821,6 @@ class task(osv.osv):
}
_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):
for id in ids:
visited_branch = set()

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

@ -48,7 +48,7 @@ class report_project_task_user(osv.osv):
help="Number of Days to Open the task"),
'delay_endings_days': fields.float('Overpassed Deadline', digits=(16,2), 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),
'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),

View File

@ -260,7 +260,7 @@ class project_issue(osv.Model):
'date_last_stage_update': fields.datetime('Last Stage Update', select=True),
'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel."),
'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'),
'stage_id': fields.many2one ('project.task.type', 'Stage',
track_visibility='onchange',
@ -295,7 +295,7 @@ class project_issue(osv.Model):
'active': 1,
'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),
'priority': crm.AVAILABLE_PRIORITIES[2][0],
'priority': '1',
'kanban_state': 'normal',
'date_last_stage_update': fields.datetime.now,
'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)})
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)
if not default:

View File

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

@ -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",
help="Number of Days to close the project issue"),
'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),
'version_id': fields.many2one('project.issue.version', 'Version'),
'user_id' : fields.many2one('res.users', 'Assigned to',readonly=True),