[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)
This commit is contained in:
Xavier Morel
2015-09-04 12:59:27 +02:00
parent 4d44b33ffe
commit bd0c6a2b24
3 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -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,
+1 -1
View File
@@ -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()
@@ -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()