Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saas apps v13 #107

Open
wants to merge 203 commits into
base: 13.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
a79f621
:zap: saas: added ability to redefine mandatory modules
em230418 Mar 31, 2020
43c465f
:zap: saas: added ability to get refresh info from build databases
em230418 Apr 9, 2020
b83335c
:ambulance: saas: random_ready_operator does not throw exceptions if …
em230418 Apr 23, 2020
8233360
:ambulance: saas: no extra right required to read build's url
em230418 Apr 24, 2020
d1fa91c
:heart_eyes: saas: removed db_id variable from database name template
em230418 Apr 29, 2020
56868c3
:zap: saas: added execute_kw and xmlid_lookup on saas.db
em230418 May 12, 2020
dea283f
:tada: :one::two: saas_expiration
em230418 Mar 31, 2020
f829d93
:tada: :one::two: saas_limit_max_users
em230418 Apr 9, 2020
171c570
:tada: :one::two: saas_access_apps
em230418 Apr 10, 2020
5620b1c
:tada: :one::two: saas_portal
em230418 Apr 24, 2020
a24d71f
:cherries: added OCA's server-auth to dependency list
em230418 May 6, 2020
0c50af2
:cherries: added itpp-labs' access-addons to dependency list
em230418 May 13, 2020
33e7c6f
:hammer_and_wrench: saas: take away api.multi on method write
em230418 May 16, 2020
9be2a4e
:arrow_up: :one::three: saas_access_apps
em230418 May 16, 2020
99206af
:arrow_up: :one::three: saas_expiration
em230418 May 16, 2020
5300e5a
:arrow_up: :one::three: saas_limit_max_users
em230418 May 16, 2020
43030f5
:arrow_up: :one::three: saas_portal
em230418 May 16, 2020
e277ecf
:tada: :one::two: saas_apps_signup
em230418 Apr 29, 2020
86d9168
:arrow_up: :one::three: saas_apps_signup
em230418 May 16, 2020
8d77802
:tada: first commit
Enigma228322 Feb 22, 2020
f3b8e34
:bomb: developing process
Enigma228322 Feb 24, 2020
7574fef
:bomb: Added Manage Apps view in website configuration
Enigma228322 Feb 28, 2020
9c02c2a
:bomb: Added 'Refresh' button
Enigma228322 Feb 29, 2020
e71789e
:bomb: started js low flexing
Enigma228322 Mar 2, 2020
1365e1f
:bomb: Added a little bit calculator logic
Enigma228322 Mar 3, 2020
8cedbf1
:bomb: Added apps choosing logic
Enigma228322 Mar 3, 2020
5da184f
:bomb: Added price window
Enigma228322 Mar 3, 2020
2392d7a
:bomb: made beautiful price window
Enigma228322 Mar 6, 2020
4ca6b82
:bomb: Added tree traversal in js and a little bit in python
Enigma228322 Mar 6, 2020
ad0d3fa
:bomb: Added tree
Enigma228322 Mar 7, 2020
0941c9c
:bomb: Added child_tree and onload func in js
Enigma228322 Mar 13, 2020
90d4482
:bomb: Made many2many instead one2many btw saas.lines and saas.module…
Enigma228322 Mar 17, 2020
97495c7
:bomb: Added pictures and fixied bug with :contains selector, when se…
Enigma228322 Mar 17, 2020
cceb939
:bomb: shifted block with modules in center
Enigma228322 Mar 17, 2020
5ae9abb
:bomb: Made frontend like pushka
Enigma228322 Mar 17, 2020
692e97b
:bomb: Changed allow_to_sell vars changing in overrided write functio…
Enigma228322 Mar 18, 2020
e85e8e9
:bomb: Made access lvl public for not autorized users
Enigma228322 Mar 19, 2020
5562345
:bomb: Added new template creating and redirecting to new db(Without …
Enigma228322 Mar 27, 2020
8bcaa04
:bomb: Added auto authorization
Enigma228322 Mar 28, 2020
1f6641e
:bomb: Added method that collects and sends all modules dependencies …
Enigma228322 Mar 29, 2020
dd3070b
:bomb: Fixed bug with 'default' named modules
Enigma228322 Mar 29, 2020
48e390f
:bomb: Now applications only is visible
Enigma228322 Mar 30, 2020
8118d5d
:bomb: Added loader and indent corrections
Enigma228322 Mar 31, 2020
00e7103
:green_heart:
Enigma228322 Mar 31, 2020
ae9e4b2
:bomb: Made fields editable
Enigma228322 Apr 2, 2020
073e241
:bomb: temporary
Enigma228322 Apr 6, 2020
b3742c9
:bomb: Corrected frontend
Enigma228322 Apr 6, 2020
cff6552
:green_heart:
Enigma228322 Apr 7, 2020
4e29087
:bomb: Added saas.line price changing
Enigma228322 Apr 7, 2020
8376803
:bomb: Added currency and fixed some bugs
Enigma228322 Apr 8, 2020
257c635
:bomb: Added currency linked to the company
Enigma228322 Apr 10, 2020
854d8c9
:bomb: now template doesn't creates every time, when build creates
Enigma228322 Apr 14, 2020
0f10c40
:bomb: Added 'set_as_base' field in saas_template and this field chec…
Enigma228322 Apr 15, 2020
a9c0e8b
:arrow_up::one::three:
Enigma228322 Apr 18, 2020
ec04d86
:bomb: added price blink in box, and divided apps price and users price
Enigma228322 Apr 20, 2020
26073b7
:bomb: added feature to integrate saas_apps with sign_up form
Enigma228322 Apr 21, 2020
88d37b3
:bomb: Fixed error with same saas.template.operator name creation
Enigma228322 Apr 21, 2020
53e6296
:bomb: added base_template record in demo data and docs
Enigma228322 Apr 21, 2020
c3e5f7d
:bomb: Added loader in the begining and choosen_modules saving in loc…
Enigma228322 Apr 22, 2020
6c38a13
:bomb: Changed 'Get Started' button, to 'Try trial' and 'Buy now'
Enigma228322 Apr 24, 2020
918c05d
:bomb: Added packages
Enigma228322 May 2, 2020
4e03256
:bomb: Added binary icons and corrected saas_apps form view
Enigma228322 May 7, 2020
3be4309
:bomb: Deleted unnecessary method and added website_sale dependence
Enigma228322 May 8, 2020
3d561e9
:bomb: fix
Enigma228322 May 9, 2020
7888217
:bomb: Added users changing buttons at /price page
Enigma228322 May 10, 2020
eba29fc
:bomb: Added apps and packages visibility properties in website settings
Enigma228322 May 11, 2020
a4efd44
:bomb: fixed bug, when price window is absent, values keep calculating
Enigma228322 May 11, 2020
5fa5c95
:bomb: fixed bug, when saas_apps installs, theres an error with packa…
Enigma228322 May 12, 2020
a72a131
:bomb: fixed bug, when saas_apps installs, theres an error with packa…
Enigma228322 May 12, 2020
1a3951d
:bomb: Changed saas_apps settings h2 body
Enigma228322 May 12, 2020
445475a
:base: Added app alingnment when they're less than 3
Enigma228322 May 12, 2020
c2ca1c8
:book: Added show apps and show packs instr
Enigma228322 May 15, 2020
2fa4758
:bomb: Now product.product 'website_published' field related to saas.…
Enigma228322 May 19, 2020
d63cbf4
:bomb: Changed product.product model relation to product.template
Enigma228322 May 20, 2020
5d52792
:bomb: Fixed bug. When /price loads button listeners didnt initialize…
Enigma228322 May 20, 2020
5714fc5
:bomb: Hide 'Choose your packages' when packages are absent
Enigma228322 May 22, 2020
fa950de
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 May 22, 2020
155dd57
Merge remote-tracking branch 'Eugene/13.0-saas_apps_signup' into 13.0…
Enigma228322 May 22, 2020
6cdb813
:bomb: saas_apps: use $(document).ready instead of web_editor.ready()
em230418 May 22, 2020
e8e0184
:bomb: saas_apps_signup: use document.ready instead of base.ready
em230418 May 22, 2020
c83d294
:bomb: saas_apps: make Base template without demo data
em230418 May 22, 2020
bf4e603
:tada: :one::three: saas_contract
em230418 May 21, 2020
32a090a
:tada: :one::three: saas_product
em230418 May 21, 2020
1f7505b
fixup! :tada: :one::three: saas_product
em230418 May 21, 2020
94e99dc
fixup! fixup! :tada: :one::three: saas_product
em230418 May 21, 2020
428abc8
Merge remote-tracking branch 'Eugene/13.0-saas_apps_signup' into 13.0…
Enigma228322 May 22, 2020
35ece3f
saas_apps_signup: указываю количество пользователей в регистрационную…
em230418 May 22, 2020
db8431a
saas_apps_signup: вынес заполнение данных в saas.db на этапе создания
em230418 May 22, 2020
4a2d34a
:bomb: Litle fix to avoid a huge error
Enigma228322 May 25, 2020
74ff8fa
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 May 26, 2020
73607de
saas_portal: Added link button in my builds list
em230418 May 26, 2020
6383a29
:bomb: Litle fix to avoid a huge error
Enigma228322 May 25, 2020
ff59293
:bomb: saas_apps: using saas_product.product_users
em230418 May 27, 2020
f866568
:bomb: saas_apps: add get_subscription_period for exporting
em230418 May 27, 2020
91bc8c4
:bomb: saas_apps_signup: use subscription period
em230418 May 27, 2020
e3a5fd7
:bomb: saas_apps_signup: add contract
em230418 May 27, 2020
cba2e0c
:bomb: saas_apps_signup: fix multiple error on signup
em230418 May 27, 2020
e8f976b
fixup! :tada: :one::two: saas_expiration
em230418 May 27, 2020
2978a4a
fixup! :bomb: saas_apps_signup: add contract
em230418 May 27, 2020
1f1b9e2
:bomb: saas_apps_signup: extend contract view
em230418 May 27, 2020
1690331
:bomb: saas_apps_signup: закончил реализовывать Try trial
em230418 May 27, 2020
f326d64
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 May 27, 2020
7ed49db
saas_expiration: добавил web_responsive как обязательный
em230418 May 27, 2020
7878a42
:ambulance: saas: do not try to update global_url on draft builds
em230418 May 28, 2020
b69552a
:bomb: Added show 'buy now' button option in settings
Enigma228322 May 28, 2020
86101af
saas_apps_signup: убрал ссылку на домен в письме
em230418 May 28, 2020
40e69be
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 May 28, 2020
49b6a30
saas_apps_signup: убрал хак для задания web_base_url
em230418 May 28, 2020
2c5678b
saas_apps_signup: начал разделять логику 'Try now' и 'Buy now'
em230418 May 28, 2020
ee7fd9d
saas_apps_signup: исправил текст ошибки при попытки регистрации сущес…
em230418 May 28, 2020
58e577e
saas_apps: берем продукт в зависимости от выбранного периода
em230418 May 28, 2020
9049fa2
saas_apps_signup: для buy now указываем sale_order
em230418 May 28, 2020
dfcee65
saas_product: anually -> annually
em230418 May 28, 2020
0dfc36b
saas_apps_signup: разбиваем логику try now и buy now
em230418 May 28, 2020
412ab15
saas_apps_signup: поправляем ссылки тем партнерам, у кого есть что-то…
em230418 May 28, 2020
a6008e5
saas_apps_signup: автоматическое создание контракта при оплате счета
em230418 May 29, 2020
5a4e17c
saas_product: added is_saas_product
em230418 May 29, 2020
e24682d
saas_contract: чтобы можно было как модуль использовать
em230418 May 29, 2020
bc27086
saas_apps_signup: when creating contract - filter out non-saas products
em230418 Jun 1, 2020
a7c1a7a
Merge remote-tracking branch 'Eugene/13.0-saas_apps_signup' into 13.0…
Enigma228322 Jun 1, 2020
b7f1de6
:bomb: Deleted unnecessary css classes
Enigma228322 Jun 1, 2020
862d747
:bomb: 'Try trial' and 'Buy now' are hiding when no application is se…
Enigma228322 Jun 1, 2020
d673b82
:bomb: Fixed bug when currency isn't visible when apps aren't selected
Enigma228322 Jun 1, 2020
63b7916
:bomb: rewrited cart clearing process
Enigma228322 Jun 2, 2020
15d6776
Revert ":bomb: Hide 'Choose your packages' when packages are absent"
Enigma228322 Jun 2, 2020
8b56597
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 Jun 2, 2020
effedfb
:bomb: Added 'is_saas_product' property in product.template
Enigma228322 Jun 2, 2020
dcc66ba
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 Jun 2, 2020
ce3a761
saas_product: make sure no taxes are used, when creating saas product
em230418 Jun 3, 2020
c5ad229
saas_apps_signup: if not public user - go to checkout
em230418 Jun 3, 2020
d95d82a
:bomb: Fixed bug in apps.js, classList, when packages and apps are ab…
Enigma228322 Jun 3, 2020
2437213
Merge remote-tracking branch 'Eugene/13.0-saas_apps_signup' into 13.0…
Enigma228322 Jun 3, 2020
129f615
:bomb: Fixed bug, which appears when 'Buy now' pressed
Enigma228322 Jun 3, 2020
2f6acf7
saas_portal: обрабатывать случай, когда база еще не готова
em230418 Jun 4, 2020
6010066
saas_apps_signup: /my/builds/create
em230418 Jun 4, 2020
3d4e3ab
saas_apps_signup: базовый функционал для создания базы пользователю
em230418 Jun 4, 2020
094196d
saas_apps_signup: после Buy now перенаправляется на станицу создания …
em230418 Jun 4, 2020
63f0b7f
saas_apps_signup: база создается теперь, как-то
em230418 Jun 5, 2020
1b7617a
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 Jun 5, 2020
e369c20
saas_apps_signup: fixed bug
em230418 Jun 5, 2020
d635a7f
:heart_eyes: saas: added option to deploy database using draft databa…
em230418 Jun 5, 2020
b0816fd
saas_apps_signup: база более менее нормально создается
em230418 Jun 5, 2020
8078b77
saas_portal: show only builds, not templates
em230418 Jun 8, 2020
f297e94
saas_apps_signup: correct searching for draft builds
em230418 Jun 8, 2020
4cddfbd
saas_apps_signup: search for builds, not templates to create database
em230418 Jun 8, 2020
c6dc3bc
saas_apps_signup: handle packages when buying
em230418 Jun 8, 2020
031a9b4
:tada: :one::three: saas_build_admin
em230418 Jun 9, 2020
210a3cd
saas_portal: take away admin_user field to saas_build_admin
em230418 Jun 9, 2020
9da239d
saas_apps_signup: take away duplicated functianlity in favor of saas_…
em230418 Jun 9, 2020
492540f
fixup! :tada: :one::three: saas_build_admin
em230418 Jun 9, 2020
f5e59dd
saas_apps_signup: signup enabled by default
em230418 Jun 9, 2020
d0040ec
saas_apps_signup: working fine
em230418 Jun 9, 2020
a2eb48c
fixup! fixup! :tada: :one::three: saas_build_admin
em230418 Jun 9, 2020
8abf017
saas_apps_signup: теперь при try now создается конракт, а после - база
em230418 Jun 9, 2020
d0aa83f
:ambulance: saas: fix 'Connect to the Build' button when build admin'…
em230418 Jun 10, 2020
a111819
saas_apps_signup: forgot to set max_user_limit
em230418 Jun 10, 2020
0b424d6
fixup! :hammer_and_wrench: saas: take away api.multi on method write
em230418 Jun 10, 2020
769e917
saas_apps_signup: поправил проверку для драфт баз
em230418 Jun 10, 2020
c91d65d
saas_apps_signup: не давать checkout если нету черновых баз
em230418 Jun 11, 2020
908f179
saas_build_admin: sending letter after admin is set
em230418 Jun 11, 2020
51c92f1
saas_apps: fastfix to calculate price
em230418 Jun 11, 2020
1972f0f
fixup! saas_build_admin: sending letter after admin is set
em230418 Jun 11, 2020
0a126f4
fixup! fixup! saas_build_admin: sending letter after admin is set
em230418 Jun 11, 2020
e9984c4
saas_apps: added get_chosen_package_id
em230418 Jun 15, 2020
94daed1
saas_apps_signup: moved contract for trial generatring to _create_saa…
em230418 Jun 15, 2020
9817fdb
saas_apps_signup: начал делать метод /make_database_for_trial
em230418 Jun 15, 2020
ff908c9
saas_apps_signup: try now теперь работает и для регистированных
em230418 Jun 16, 2020
f6cb339
Merge remote-tracking branch 'Eugene/13.0-saas_apps_signup' into 13.0…
Enigma228322 Jun 16, 2020
e0439ef
:bomb: Added 'Try trial' hiding option
Enigma228322 Jun 16, 2020
ecf36a5
saas_apps_signup: try now теперь работает в обоих случаях
em230418 Jun 16, 2020
f3b562a
Merge remote-tracking branch 'vildan/13.0-saas_apps-port' into 13.0-s…
em230418 Jun 16, 2020
584c3f4
saas_apps_signup: take away saas_contract stuff
em230418 Jun 17, 2020
42358ff
saas_contract: moved some logic from saas_apps_signup
em230418 Jun 17, 2020
d61cb1d
saas_apps_signup: removed build_id from saas_apps_signup
em230418 Jun 17, 2020
1f2c08b
saas_domain_operator init
em230418 Jun 18, 2020
296e24b
fixup! saas_domain_operator init
em230418 Jun 18, 2020
7e6c06e
fixup! fixup! saas_domain_operator init
em230418 Jun 18, 2020
88915d2
создал saas_client_custom
em230418 Jun 26, 2020
f4c90bd
saas_apps_signup: install saas_client_custom
em230418 Jun 26, 2020
018bd81
fixup! создал saas_client_custom
em230418 Jun 26, 2020
7c9b2a4
corrected saas_limit_max_users
em230418 Jun 26, 2020
3b2855f
saas_apps_signup: начал делать код по созданию счетов
em230418 Jul 1, 2020
076566a
saas_apps_signup: можно сразу билд указывать при создании контракта
em230418 Jul 2, 2020
636df0a
saas_apps_signup: вроде как теперь автоматом создаются счета на истеч…
em230418 Jul 2, 2020
a2961f7
saas: какая-то фигня, чтобы в билде не высчитывались поля из мастера
em230418 Jul 2, 2020
bb471bf
saas_portal: билды теперь имеют access_url
em230418 Jul 3, 2020
d8bc32f
fixup! saas_portal: билды теперь имеют access_url
em230418 Jul 3, 2020
5bd2ca2
saas_apps_signup: записываем ссылку, где детали, когда база истечет
em230418 Jul 3, 2020
df360f2
saas_apps_signup: более читабельное создание опубликованного счета
em230418 Jul 3, 2020
adcf7b4
saas_apps_signup: при создании конртакта, дать знать об этом билду
em230418 Jul 3, 2020
08ea7c6
saas_apps_signup: ссылка на плашке с истекающим билдом теперь направл…
em230418 Jul 3, 2020
00e4063
:tada: :one::three: saas_database_limit
em230418 Jul 4, 2020
0bab620
saas_apps_signup: задолбался с продлением подписки
em230418 Jul 6, 2020
fb19ba5
saas_apps_signup: пересчитываем следующую дату окончания
em230418 Jul 6, 2020
b8b99bb
saas_apps_signup: билды обновляем после изменения каких-то вещей в ко…
em230418 Jul 6, 2020
7593531
saas_apps_signup: исправили баг с кривыми product_id
em230418 Jul 7, 2020
d152dde
fixup! :tada: :one::three: saas_database_limit
em230418 Jul 7, 2020
092a900
saas_apps: correct package detection in /price/cart_update
em230418 Jul 9, 2020
3ec6760
saas_apps_signup: добавил указание ограничение базы по-умолчанию
em230418 Jul 9, 2020
9f2f9f5
saas_apps_signup: added database limit size to resconfigsettings
em230418 Jul 9, 2020
2ebe72b
saas_apps_signup: более приемлемое название менюшки
em230418 Jul 9, 2020
8ce4f1a
Merge remote-tracking branch 'Eugene/13.0-saas_apps_signup' into 13.0…
Enigma228322 Jul 13, 2020
ed11b33
:tv: Added website menu 'Pricing'
Enigma228322 Jul 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions oca_dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
queue https://github.com/OCA/queue.git
OCA_web https://github.com/OCA/web.git
OCA_server_auth https://github.com/OCA/server-auth
access_addons https://github.com/itpp-labs/access-addons
3 changes: 2 additions & 1 deletion saas/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018-2019 Denis Mudarisov <https://it-projects.info/team/mudarisov>
# Copyright 2019 Anvar Kildebekov <https://it-projects.info/team/kildebekov>
# Copyright 2020 Eugene Molotov <https://it-projects.info/team/em230418>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": """SaaS Base""",
"summary": """Base module for master SaaS instance""",
"category": "SaaS",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version=13.0",
"images": [],
"version": "13.0.2.4.3",
"version": "13.0.3.0.0",
"application": False,

"author": "IT-Projects LLC, Ivan Yelizariev",
Expand Down
4 changes: 3 additions & 1 deletion saas/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ class SaasController(odoo.http.Controller):
def auth_to_build(self, build_id=None, **kwargs):
if not build_id:
return False
build_url = request.env['saas.db'].browse(build_id).get_url() + '/auth_quick/login?build_login=admin'
build = request.env['saas.db'].browse(build_id)
_, _, build_admin_id = build.xmlid_lookup("base.user_admin")
build_url = request.env['saas.db'].browse(build_id).get_url() + '/auth_quick/login?build_user_id={}'.format(build_admin_id)
return build_redirection(build_url)
14 changes: 14 additions & 0 deletions saas/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- Copyright 2019 Denis Mudarisov <https://it-projects.info/team/trojikman>
Copyright 2020 Eugene Molotov <https://it-projects.info/team/em230418>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).-->
<odoo noupdate="1">
<record id="preparing_template_next_cron" model="ir.cron">
Expand All @@ -13,4 +14,17 @@
<field name="state">code</field>
<field name="code">model.preparing_template_next()</field>
</record>

<record id="refresh_saas_db_data" model="ir.cron">
<field name="name">SaaS: refresh data from build database</field>
<field name="model_id" ref="saas.model_saas_db"/>
<field name="active" eval="True" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall">1</field>
<field name="state">code</field>
<field name="code">model.search([('type','=','build'),('state','=','done')]).refresh_data()</field>
</record>
</odoo>
2 changes: 1 addition & 1 deletion saas/data/saas_operator_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<record id="local_operator" model="saas.operator">
<field name="name">Same Instance</field>
<field name="type">local</field>
<field name="db_url_template">http://{db_name}.{db_id}.127.0.0.1.nip.io</field>
<field name="db_url_template">http://{db_name}.127.0.0.1.nip.io</field>
<field name="db_name_template">fast_build_{unique_id}</field>
<!-- It works when db-filter=^%d$ -->
<field name="global_url" eval="'http://' + obj().env.cr.dbname + '.127.0.0.1.nip.io:8069'" model="saas.operator"/>
Expand Down
13 changes: 13 additions & 0 deletions saas/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
`3.0.0`
-------

- **Improvement:** mandatory modules can be redefined in dependent modules
- **New:** added "Refresh" in build view to get data from build database
- **Fix:** random_ready_operator does not throw exceptions if no operators are ready
- **Fix:** no extra rigths required to read build's URL
- **Improvement:** Removed {db_id} variable for generating database name
- **Improvement:** Added helper methods `execute_kw` and `xmlid_lookup` on `saas.db` model
- **Fix:** attempt to update global_url on draft builds
- **Improvement:** Added option to deploy database on draft builds
- **Fix:** "Connect to the Build" button now works even if admin user on build was renamed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

`2.4.3`
-------

Expand Down
32 changes: 31 additions & 1 deletion saas/models/saas_db.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2019 Denis Mudarisov <https://it-projects.info/team/trojikman>
# Copyright 2020 Eugene Molotov <https://it-projects.info/team/em230418>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
from odoo.addons.queue_job.job import job
Expand Down Expand Up @@ -44,7 +45,7 @@ def drop_db(self):
def get_url(self):
# TODO: need possibility to use custom domain
self.ensure_one()
return self.operator_id.get_db_url(self)
return self.sudo().operator_id.get_db_url(self)

def action_get_build_access(self):
auth_url = '/saas/auth-to-build/' + str(self.id)
Expand All @@ -53,3 +54,32 @@ def action_get_build_access(self):
'target': 'new',
'url': auth_url,
}

def write(self, vals):
res = super(SAASDB, self).write(vals)
if not self.env.context.get("writing_from_refresh_data"): # Do not run "refresh_data", if already running it
self.refresh_data()
return res

def refresh_data(self, should_read_from_build=True, should_write_to_build=True):
self.flush()
for record in self.filtered(lambda record: (record.type, record.state) == ("build", "done")).with_context(writing_from_refresh_data=True):
if should_read_from_build:
vals = record.read_values_from_build()
if vals:
record.write(vals)

if should_write_to_build:
record.write_values_to_build()

def write_values_to_build(self):
pass

def read_values_from_build(self):
return {}

def execute_kw(self, model, method, *args, **kwargs):
return self.operator_id.build_execute_kw(self, model, method, args, kwargs)

def xmlid_lookup(self, xmlid):
return self.execute_kw("ir.model.data", "xmlid_lookup", xmlid)
13 changes: 7 additions & 6 deletions saas/models/saas_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from odoo.addons.queue_job.job import job
from odoo.http import _request_stack

MANDATORY_MODULES = ['auth_quick']


class SAASOperator(models.Model):
_name = 'saas.operator'
Expand All @@ -25,10 +23,13 @@ class SAASOperator(models.Model):
global_url = fields.Char('Master URL (Server-to-Server)', required=True, help='URL for server-to-server communication ')
# host = fields.Char()
# port = fields.Char()
db_url_template = fields.Char('DB URLs', help='Avaialble variables: {db_id}, {db_name}')
db_url_template = fields.Char('DB URLs', help='Avaialble variables: {db_name}')
db_name_template = fields.Char('DB Names', required=True, help='Avaialble variables: {unique_id}')
template_operator_ids = fields.One2many('saas.template.operator', 'operator_id')

def get_mandatory_modules(self):
return ["auth_quick"]

def _create_db(self, template_db, db_name, demo, lang='en_US'):
"""Synchronous db creation"""
if self.type == 'local':
Expand Down Expand Up @@ -66,7 +67,7 @@ def _drop_db(self, db_name):
def install_modules(self, template_id, template_operator_id):
self.ensure_one()
modules = [module.name for module in template_id.template_module_ids]
modules = [('name', 'in', MANDATORY_MODULES + modules)]
modules = [('name', 'in', self.get_mandatory_modules() + modules)]
if self.type == 'local':
db = sql_db.db_connect(template_operator_id.operator_db_name)
with api.Environment.manage(), db.cursor() as cr:
Expand Down Expand Up @@ -110,7 +111,7 @@ def post_init(self, template_id, template_operator_id):
def get_db_url(self, db):
# TODO: use mako for url templating
self.ensure_one()
return self.db_url_template.format(db_id=db.id, db_name=db.name)
return self.db_url_template.format(db_name=db.name)

def generate_db_name(self):
self.ensure_one()
Expand Down Expand Up @@ -164,7 +165,7 @@ def _update_global_url(self, url):
'model_id': 1,
'code': code,
}
for build in builds:
for build in builds.filtered(lambda build: build.state == "done"):
action_ids = self.build_execute_kw(build, 'ir.actions.server', 'create', [action])
self.build_execute_kw(build, 'ir.actions.server', 'run', [action_ids])

Expand Down
31 changes: 22 additions & 9 deletions saas/models/saas_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,30 @@ def prepare_name(self, db_name):
self.ensure_one()
return slugify(db_name)

def create_db(self, key_values=None, db_name=None, with_delay=True):
def create_db(self, key_values=None, db_name=None, with_delay=True, draft_build_id=None):
self.ensure_one()
if not key_values:
key_values = {}
if not db_name:
db_name = self.operator_id.generate_db_name()

self.flush()
assert not (draft_build_id and db_name), "Both db_name and draft_build_id are given"

if draft_build_id:
build = self.env["saas.db"].browse(draft_build_id)
assert build.state == "draft", "Given build is not draft"
assert build.operator_id == self.operator_id, "Given build uses other operator"

else:
db_name = self.prepare_name(db_name)
build = self.env['saas.db'].create({
'name': db_name,
'operator_id': self.operator_id.id,
'type': 'build',
})
if not db_name:
db_name = self.operator_id.generate_db_name()
else:
db_name = self.prepare_name(db_name)

build = self.env['saas.db'].create({
'name': db_name,
'operator_id': self.operator_id.id,
'type': 'build',
})

self.env['saas.log'].log_db_creating(build, self.operator_db_id)
if with_delay:
Expand All @@ -226,4 +237,6 @@ def create_db(self, key_values=None, db_name=None, with_delay=True):

def random_ready_operator(self):
ready_operators = self.filtered(lambda r: r.state == 'done')
if not ready_operators:
return ready_operators
return random.choice(ready_operators)
1 change: 1 addition & 0 deletions saas/views/saas_db_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<form>
<header>
<button name="action_get_build_access" type="object" string="Connect to the Build" attrs="{'invisible':[('state', '!=', 'done')]}" class="oe_read_only" />
<button name="refresh_data" type="object" string="Refresh" attrs="{'invisible':[('state', '!=', 'done')]}" class="oe_read_only" />
<field name="state" widget="statusbar" nolabel="1"/>
</header>
<sheet>
Expand Down
47 changes: 47 additions & 0 deletions saas_access_apps/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

==============================
SaaS: Control access to Apps
==============================

This module disallows anyone to install apps on build and shows installed apps.

Credits
=======

Contributors
------------
* `Eugene Molotov <https://it-projects.info/team/em230418>`__:

Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__

Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__

To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/13.0/saas_access_apps/>`__.

Thank you for understanding!

`IT-Projects Team <https://www.it-projects.info/team>`__

Further information
===================

Demo: http://runbot.it-projects.info/demo/saas-addons/13.0

HTML Description: https://apps.odoo.com/apps/modules/13.0/saas_access_apps/

Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Notifications on updates: `via Atom <https://github.com/it-projects-llc/saas-addons/commits/13.0/saas_access_apps.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/saas-addons/commits/13.0/saas_access_apps.atom>`_

Tested on Odoo 12.0 6a57ad66b8374966ba7011e34cec20f6344f4f6d
3 changes: 3 additions & 0 deletions saas_access_apps/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
39 changes: 39 additions & 0 deletions saas_access_apps/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2020 Eugene Molotov <https://it-projects.info/team/em230418>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": """SaaS: Control access to Apps""",
"summary": """This module disallows anyone to install apps on build and shows installed apps.""",
"category": "Hidden",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version=13.0",
"images": [],
"version": "13.0.1.0.0",
"application": False,
"author": "IT-Projects LLC, Eugene Molotov",
"support": "[email protected]",
"website": "https://apps.odoo.com/apps/modules/13.0/saas_access_apps/",
"license": "AGPL-3",
# "price": 9.00,
# "currency": "EUR",
"depends": ["saas"],
"external_dependencies": {"python": [], "bin": []},
"data": ["views/saas_db.xml"],
"demo": [],
"qweb": [],
"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"uninstall_hook": None,
"auto_install": False,
"installable": True,
# "demo_title": "SaaS: access apps (master)",
# "demo_addons": [
# ],
# "demo_addons_hidden": [
# ],
# "demo_url": "DEMO-URL",
# "demo_summary": "SHORT DESC",
# "demo_images": [
# "images/MAIN_IMAGE",
# ]
}
4 changes: 4 additions & 0 deletions saas_access_apps/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
`1.0.0`
-------

- **Init version**
19 changes: 19 additions & 0 deletions saas_access_apps/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
====================================
SaaS: Disable User To Install Apps
====================================

Installation
============

* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way

Usage
=====

* Open menu ``[[ SaaS ]] >> Builds``
* Click on any build with state `Ready`
* Click on ``[Refresh]``
* RESULT: in field "Installed Apps" you will see installed apps on build
* Click on ``[Connect to the Build]```. You will be logged in as admin
* Click on main menu
* RESULT: you won't see Apps in main menu
4 changes: 4 additions & 0 deletions saas_access_apps/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import saas_operator
from . import saas_db
Loading