From baf8f06d9c84dfe0e79a3c5415985e15c55ec2ee Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Wed, 13 Jan 2010 19:04:09 +0530 Subject: [PATCH] [REF]: Removed _links_get and AVAILABLE_PRIORITY from all files and added import crm. bzr revid: uco@tinyerp.co.in-20100113133409-ay3y74ys5n3qo5s0 --- addons/crm/crm_claim.py | 21 ++++----------------- addons/crm/crm_fundraising.py | 20 ++++---------------- addons/crm/crm_helpdesk.py | 20 ++++---------------- addons/crm/crm_lead.py | 20 ++++---------------- addons/crm/crm_opportunity.py | 20 ++++---------------- addons/crm/crm_phonecall.py | 10 ++-------- addons/crm_hr/crm_hr.py | 20 ++++---------------- addons/crm_project/crm_project_bug.py | 20 ++++---------------- addons/crm_project/crm_project_feature.py | 20 ++++---------------- 9 files changed, 34 insertions(+), 137 deletions(-) diff --git a/addons/crm/crm_claim.py b/addons/crm/crm_claim.py index 826f2da24d6..693e5aa1a22 100644 --- a/addons/crm/crm_claim.py +++ b/addons/crm/crm_claim.py @@ -25,20 +25,7 @@ import os import pooler import netsvc from tools.translate import _ - -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_claim_categ(osv.osv): _name = "crm.claim.categ" @@ -86,8 +73,8 @@ class crm_claim(osv.osv): _inherit = 'crm.case' _columns = { 'date_closed': fields.datetime('Closed', readonly=True), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'planned_revenue': fields.float('Planned Revenue'), @@ -96,7 +83,7 @@ class crm_claim(osv.osv): "the partner mentality in relation to our services.The scale has" \ "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), 'categ_id': fields.many2one('crm.claim.categ','Category', domain="[('section_id','=',section_id)]"), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'type_id': fields.many2one('crm.claim.type', 'Claim Type', domain="[('section_id','=',section_id)]"), 'partner_name': fields.char("Employee's Name", size=64), diff --git a/addons/crm/crm_fundraising.py b/addons/crm/crm_fundraising.py index 6079c8da9d6..30c01d5de2f 100644 --- a/addons/crm/crm_fundraising.py +++ b/addons/crm/crm_fundraising.py @@ -32,19 +32,7 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_fundraising_categ(osv.osv): _name = "crm.fundraising.categ" @@ -93,7 +81,7 @@ class crm_fundraising(osv.osv): _inherit ='crm.case' _columns = { 'date_closed': fields.datetime('Closed', readonly=True), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'categ_id': fields.many2one('crm.fundraising.categ','Category', domain="[('section_id','=',section_id)]"), 'planned_revenue': fields.float('Planned Revenue'), 'planned_cost': fields.float('Planned Costs'), @@ -105,8 +93,8 @@ class crm_fundraising(osv.osv): 'stage_id': fields.many2one ('crm.fundraising.stage', 'Stage', domain="[('section_id','=',section_id)]"), 'type_id': fields.many2one('crm.fundraising.type', 'Fundraising Type', domain="[('section_id','=',section_id)]"), 'duration': fields.float('Duration'), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \ diff --git a/addons/crm/crm_helpdesk.py b/addons/crm/crm_helpdesk.py index 47091e24bb3..cdf6d25f3bf 100644 --- a/addons/crm/crm_helpdesk.py +++ b/addons/crm/crm_helpdesk.py @@ -32,19 +32,7 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_helpdesk_categ(osv.osv): _name = "crm.helpdesk.categ" @@ -66,13 +54,13 @@ class crm_helpdesk(osv.osv): _inherit = 'crm.case' _columns = { 'date_closed': fields.datetime('Closed', readonly=True), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'planned_revenue': fields.float('Planned Revenue'), 'planned_cost': fields.float('Planned Costs'), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'probability': fields.float('Probability (%)'), 'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \ "the partner mentality in relation to our services.The scale has" \ diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index e90e591c136..9fe1b1c4236 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -32,19 +32,7 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_lead_categ(osv.osv): _name = "crm.lead.categ" @@ -99,11 +87,11 @@ class crm_lead(osv.osv): 'partner_name2': fields.char('Employee Email', size=64), 'partner_phone': fields.char('Phone', size=32), 'partner_mobile': fields.char('Mobile', size=32), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'probability': fields.float('Probability (%)'), 'date_closed': fields.datetime('Closed', readonly=True), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'planned_revenue': fields.float('Planned Revenue'), diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index 57105b3a99f..d0db5e3d614 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -32,19 +32,7 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_opportunity_categ(osv.osv): _name = "crm.opportunity.categ" @@ -93,7 +81,7 @@ class crm_opportunity(osv.osv): 'stage_id': fields.many2one ('crm.opportunity.stage', 'Stage', domain="[('section_id','=',section_id)]"), 'categ_id': fields.many2one('crm.opportunity.categ', 'Category', domain="[('section_id','=',section_id)]"), 'type_id': fields.many2one('crm.opportunity.type', 'Opportunity Type', domain="[('section_id','=',section_id)]"), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'probability': fields.float('Probability (%)'), 'planned_revenue': fields.float('Planned Revenue'), 'planned_cost': fields.float('Planned Costs'), @@ -102,8 +90,8 @@ class crm_opportunity(osv.osv): 'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \ "the partner mentality in relation to our services.The scale has" \ "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'date_closed': fields.datetime('Closed', readonly=True), 'phonecall_id':fields.many2one ('crm.phonecall', 'Phonecall'), } diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index ad449bf837a..50db660e1f0 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -30,13 +30,7 @@ import tools from tools.translate import _ -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] +import crm class crm_phonecall_categ(osv.osv): _name = "crm.phonecall.categ" @@ -79,7 +73,7 @@ class crm_phonecall(osv.osv): 'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \ "the partner mentality in relation to our services.The scale has" \ "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'probability': fields.float('Probability (%)'), diff --git a/addons/crm_hr/crm_hr.py b/addons/crm_hr/crm_hr.py index a104fc5ab61..08503757a9b 100644 --- a/addons/crm_hr/crm_hr.py +++ b/addons/crm_hr/crm_hr.py @@ -32,19 +32,7 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_job_categ(osv.osv): _name = "crm.job.categ" @@ -91,7 +79,7 @@ class crm_job(osv.osv): _inherit ='crm.case' _columns = { 'date_closed': fields.datetime('Closed', readonly=True), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'categ_id': fields.many2one('crm.job.categ', 'Category', domain="[('section_id','=',section_id)]"), 'planned_revenue': fields.float('Planned Revenue'), 'planned_cost': fields.float('Planned Costs'), @@ -104,8 +92,8 @@ class crm_job(osv.osv): 'type_id': fields.many2one('crm.job.type', 'Type Name', domain="[('section_id','=',section_id)]"), 'duration': fields.float('Duration'), 'case_id': fields.many2one('crm.case', 'Related Case'), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \ diff --git a/addons/crm_project/crm_project_bug.py b/addons/crm_project/crm_project_bug.py index 5897f702e00..8393695e13c 100644 --- a/addons/crm_project/crm_project_bug.py +++ b/addons/crm_project/crm_project_bug.py @@ -32,19 +32,7 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_bug_categ(osv.osv): _name = "crm.bug.categ" @@ -92,8 +80,8 @@ class crm_project_bug(osv.osv): _inherit = 'crm.case' _columns = { 'date_closed': fields.datetime('Closed', readonly=True), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'planned_revenue': fields.float('Planned Revenue'), @@ -102,7 +90,7 @@ class crm_project_bug(osv.osv): "the partner mentality in relation to our services.The scale has" \ "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), 'categ_id': fields.many2one('crm.bug.categ','Category', domain="[('section_id','=',section_id)]"), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'type_id': fields.many2one('crm.bug.type', 'Bug Type', domain="[('section_id','=',section_id)]"), 'partner_name': fields.char("Employee's Name", size=64), diff --git a/addons/crm_project/crm_project_feature.py b/addons/crm_project/crm_project_feature.py index f0a9cd6513e..375672789fc 100644 --- a/addons/crm_project/crm_project_feature.py +++ b/addons/crm_project/crm_project_feature.py @@ -32,19 +32,7 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm -AVAILABLE_PRIORITIES = [ - ('5','Lowest'), - ('4','Low'), - ('3','Normal'), - ('2','High'), - ('1','Highest') -] - -def _links_get(self, cr, uid, context={}): - obj = self.pool.get('res.request.link') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['object', 'name'], context) - return [(r['object'], r['name']) for r in res] +import crm class crm_project_future_request(osv.osv): _name = "crm.project.future" @@ -53,8 +41,8 @@ class crm_project_future_request(osv.osv): _inherit = 'crm.case' _columns = { 'date_closed': fields.datetime('Closed', readonly=True), - 'ref' : fields.reference('Reference', selection=_links_get, size=128), - 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), + 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), + 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \ " With each commercial opportunity, you can indicate the canall which is this opportunity source."), 'planned_revenue': fields.float('Planned Revenue'), @@ -63,7 +51,7 @@ class crm_project_future_request(osv.osv): "the partner mentality in relation to our services.The scale has" \ "to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."), 'categ_id': fields.many2one('crm.bug.categ','Category', domain="[('section_id','=',section_id)]"), - 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'type_id': fields.many2one('crm.bug.type', 'Bug Type', domain="[('section_id','=',section_id)]"), 'partner_name': fields.char("Employee's Name", size=64),