From bd0c6a2b242107be49df6b220da5218eceaf91e3 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 4 Sep 2015 11:50:30 +0200 Subject: [PATCH] [FIX] website_crm and website_hr_recruitment tours * run tours as public users since these screens should be accessible to and used by public users * fix access rights issues in website_crm tour (default value of team_id when creating a crm.lead requiring read access on crm.team, which the public user does not have) * remove duplicated crm.lead field (phone declared as char(size=64) then as char() a few lines below, removed first instance) --- addons/crm/crm_lead.py | 5 ++--- addons/website_crm/tests/test_website_crm.py | 2 +- .../tests/test_website_hr_recruitment.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index d88c63d42c5..7970a2c933b 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -61,7 +61,7 @@ class crm_lead(format_address, osv.osv): def _get_default_stage_id(self, cr, uid, context=None): """ Gives default stage_id """ - team_id = self.pool['crm.team']._get_default_team_id(cr, uid, context=context) + team_id = self.pool['crm.team']._get_default_team_id(cr, SUPERUSER_ID, context=context, user_id=uid) return self.stage_find(cr, uid, [], team_id, [('fold', '=', False)], context=context) def _resolve_type_from_context(self, cr, uid, context=None): @@ -197,7 +197,6 @@ class crm_lead(format_address, osv.osv): # Only used for type opportunity 'probability': fields.float('Probability', group_operator="avg"), 'planned_revenue': fields.float('Expected Revenue', track_visibility='always'), - 'phone': fields.char("Phone", size=64), 'date_deadline': fields.date('Expected Closing', help="Estimate of the date on which the opportunity will be won."), # CRM Actions 'last_activity_id': fields.many2one("crm.activity", "Last Activity", select=True), @@ -237,7 +236,7 @@ class crm_lead(format_address, osv.osv): 'type': lambda s, cr, uid, c: 'lead' if s.pool['res.users'].has_group(cr, uid, 'crm.group_use_lead') else 'opportunity', 'user_id': lambda s, cr, uid, c: uid, 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c), - 'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, uid, context=c), + 'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, SUPERUSER_ID, context=c, user_id=uid), 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c), 'priority': lambda *a: crm_stage.AVAILABLE_PRIORITIES[0][0], 'probability': 10, diff --git a/addons/website_crm/tests/test_website_crm.py b/addons/website_crm/tests/test_website_crm.py index 1f684478b81..d97cee5f55d 100644 --- a/addons/website_crm/tests/test_website_crm.py +++ b/addons/website_crm/tests/test_website_crm.py @@ -4,7 +4,7 @@ import openerp.tests @openerp.tests.common.post_install(True) class TestWebsiteCrm(openerp.tests.HttpCase): def test_tour(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('website_crm_tour', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.website_crm_tour", login='admin') + self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('website_crm_tour', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.website_crm_tour") # need environment using the test cursor as it's not committed cr = self.registry.cursor() diff --git a/addons/website_hr_recruitment/tests/test_website_hr_recruitment.py b/addons/website_hr_recruitment/tests/test_website_hr_recruitment.py index 96753811766..9cf70411ec3 100644 --- a/addons/website_hr_recruitment/tests/test_website_hr_recruitment.py +++ b/addons/website_hr_recruitment/tests/test_website_hr_recruitment.py @@ -4,7 +4,7 @@ import openerp.tests @openerp.tests.common.post_install(True) class TestWebsiteHrRecruitmentForm(openerp.tests.HttpCase): def test_tour(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('website_hr_recruitment_tour', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.website_hr_recruitment_tour", login="admin") + self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('website_hr_recruitment_tour', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.website_hr_recruitment_tour") # get test cursor to read from same transaction browser is writing to cr = self.registry.cursor()