forked from it-projects-llc/odoo-saas-tools
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from kaerdsar/upstream
SaaS Portal Demo
- Loading branch information
Showing
25 changed files
with
315 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SaaS Base | ||
========= | ||
|
||
Base models to use in saas environment. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
'name': 'SaaS Base', | ||
'version': '0.0.1', | ||
'author': 'Cesar Lage', | ||
'category': 'SaaS', | ||
'website': 'https://it-projects.info', | ||
'depends': ['saas_utils'], | ||
'data': [], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import saas_base | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
from openerp import api, models, fields | ||
|
||
|
||
class SaasClient(models.AbstractModel): | ||
_name = 'saas_base.client' | ||
|
||
users_len = fields.Integer('Count users', readonly=True) | ||
file_storage = fields.Integer('File storage (MB)', readonly=True) | ||
db_storage = fields.Integer('DB storage (MB)', readonly=True) | ||
expiration_datetime = fields.Datetime('Expiration', track_visibility='onchange') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SaaS Portal Demo | ||
================ | ||
|
||
Module to create pages with plan description an a link to test a demo for a few hours. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import controllers | ||
import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
'name': 'SaaS Portal Demo', | ||
'version': '0.1', | ||
'author': 'Cesar Lage', | ||
'category': 'SaaS', | ||
'website': 'https://it-projects.info', | ||
'depends': ['saas_portal'], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'views/saas_portal.xml', | ||
'views/website.xml' | ||
], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
import werkzeug | ||
from openerp.addons.web import http | ||
from openerp.addons.web.http import request | ||
from openerp.addons.web.controllers.main import login_redirect | ||
from openerp.addons.saas_portal.controllers.main import SaasPortal | ||
|
||
|
||
def signup_redirect(): | ||
url = '/web/signup?' | ||
redirect_url = '%s?%s' % (request.httprequest.base_url, werkzeug.urls.url_encode(request.params)) | ||
return """<html><head><script> | ||
window.location = '%sredirect=' + encodeURIComponent("%s"); | ||
</script></head></html> | ||
""" % (url, redirect_url) | ||
|
||
|
||
class SaasPortalDemo(SaasPortal): | ||
|
||
@http.route(['/demo/<string:version>/<string:plan_url>'], type='http', auth='public', website=True) | ||
def show_plan(self, version, plan_url, **post): | ||
domain = [('odoo_version', '=', version), ('page_url', '=', plan_url), | ||
('state', '=', 'confirmed')] | ||
plan = request.env['saas_portal.plan'].sudo().search(domain) | ||
if not plan: | ||
# TODO: maybe in this case we can redirect to saas_portal_templates.select_template | ||
return request.website.render("saas_portal_demo.unavailable_plan") | ||
values = {'plan': plan[0]} | ||
return request.website.render("saas_portal_demo.show_plan", values) | ||
|
||
@http.route('/demo/new_database', type='http', auth='public', website=True) | ||
def new_demo_database(self, **post): | ||
if not request.session.uid: | ||
return signup_redirect() | ||
plan_id = int(post.get('plan_id')) | ||
|
||
return self.create_new_database(plan_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import saas_portal | ||
|
Oops, something went wrong.