Skip to content

Commit

Permalink
Migrate to 3.0 #3127
Browse files Browse the repository at this point in the history
  • Loading branch information
bernatnan authored and priyankarani committed Dec 11, 2013
1 parent add3495 commit 680a5fc
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 208 deletions.
10 changes: 6 additions & 4 deletions project.py
Expand Up @@ -37,7 +37,7 @@
from trytond.pyson import Eval
from trytond.config import CONFIG
from trytond.tools import get_smtp_server
from trytond.backend import TableHandler
from trytond import backend

__all__ = [
'WebSite', 'ProjectUsers', 'ProjectInvitation',
Expand Down Expand Up @@ -110,6 +110,7 @@ def __register__(cls, module_name):
Register class and update table name to new.
'''
cursor = Transaction().cursor
TableHandler = backend.get('TableHandler')
table = TableHandler(cursor, cls, module_name)
super(ProjectUsers, cls).__register__(module_name)
# Migration
Expand Down Expand Up @@ -361,13 +362,13 @@ def home(cls):
# Display all projects to project admin
projects = cls.search([
('type', '=', 'project'),
('parent', '=', False),
('parent', '=', None),
])
else:
projects = cls.search([
('participants', '=', request.nereid_user.id),
('type', '=', 'project'),
('parent', '=', False),
('parent', '=', None),
])
if request.is_xhr:
return jsonify({
Expand Down Expand Up @@ -831,7 +832,7 @@ def permissions(cls, project_id):

invitations = ProjectInvitation.search([
('project', '=', project.id),
('nereid_user', '=', False)
('nereid_user', '=', None)
])
return render_template(
'project/permissions.jinja', project=project,
Expand Down Expand Up @@ -2243,6 +2244,7 @@ def __register__(cls, module_name):
Register class and update table name to new.
'''
cursor = Transaction().cursor
TableHandler = backend.get('TableHandler')
table = TableHandler(cursor, cls, module_name)
super(TaskTags, cls).__register__(module_name)

Expand Down
10 changes: 8 additions & 2 deletions tests/test_company.py
Expand Up @@ -37,6 +37,7 @@ def setUp(self):
self.URLMap = POOL.get('nereid.url_map')
self.Language = POOL.get('ir.lang')
self.Website = POOL.get('nereid.website')
self.Locale = POOL.get('nereid.website.locale')

def get_template_source(self, name):
"""
Expand Down Expand Up @@ -93,12 +94,17 @@ def test_0010_is_project_admin(self):
# Create nereid project site
url_map, = self.URLMap.search([], limit=1)
en_us, = self.Language.search([('code', '=', 'en_US')])
self.locale_en_us, = self.Locale.create([{
'code': 'en_US',
'language': en_us.id,
'currency': currency.id,
}])
nereid_project_website, = self.Website.create([{
'name': 'localhost',
'url_map': url_map.id,
'company': company.id,
'application_user': USER,
'default_language': en_us.id,
'default_locale': self.locale_en_us.id,
'guest_user': guest_user.id,
}])
self.Company.write([company], {
Expand All @@ -112,7 +118,7 @@ def test_0010_is_project_admin(self):

app = self.get_app()
with app.test_client() as c:
rv = c.post('/en_US/login', data=login_data)
rv = c.post('/login', data=login_data)
self.assertEqual(rv.status_code, 302)

# Assert project admin.
Expand Down

0 comments on commit 680a5fc

Please sign in to comment.