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

[13.0] Последние изменения #120

Open
wants to merge 47 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
47 commits
Select commit Hold shift + click to select a range
0b3f5b5
:zap: saas: added ability to redefine mandatory modules
em230418 Mar 31, 2020
b90dc87
:zap: saas: added ability to get refresh info from build databases
em230418 Apr 9, 2020
e9b8add
:ambulance: saas: random_ready_operator does not throw exceptions if …
em230418 Apr 23, 2020
306bb3c
:ambulance: saas: no extra right required to read build's url
em230418 Apr 24, 2020
63c414a
:heart_eyes: saas: removed db_id variable from database name template
em230418 Apr 29, 2020
f77f315
:zap: saas: added execute_kw and xmlid_lookup on saas.db
em230418 May 12, 2020
14caf5d
:ambulance: saas: do not try to update global_url on draft builds
em230418 May 28, 2020
c0369d7
:heart_eyes: saas: added option to deploy database using draft databa…
em230418 Jun 5, 2020
eb6b2ef
:ambulance: saas: fix 'Connect to the Build' button when build admin'…
em230418 Jun 10, 2020
2b5a94e
:heart_eyes: saas: added "Operators" menu
em230418 Sep 21, 2020
b72ba19
:heart_eyes: saas.operator.name field is now mandatory
em230418 Nov 30, 2020
f29e82c
:heart_eyes: saas: reorganized saas_operator code for more comfortabl…
em230418 Nov 30, 2020
c0f1f2d
:ambulance: saas: turn off tests when installing modules and creating…
em230418 Dec 23, 2020
e78dba2
:heart_eyes: saas: add button_box to builds
em230418 Dec 25, 2020
7b5ba07
:heart_eyes: saas: added "Install missing mandatory modules" button i…
em230418 Jan 8, 2021
b12adbc
:shield: update oca_dependencies.txt
em230418 Dec 1, 2020
05c37d3
:tada: :one::three: saas_build_admin
em230418 Jun 9, 2020
5484ca3
:tada: :one::three: saas_database_limit
em230418 Jul 4, 2020
83634c3
:tada: :one::three: saas_operator_remote
em230418 Sep 16, 2020
a89f704
:book: saas_build_admin: add section about configurating SMTP server
em230418 Dec 21, 2020
dd98907
:book: saas_operator_remote: add missing README.rst
em230418 Dec 23, 2020
0d0be2e
:tada: :one::two: saas_expiration
em230418 Mar 31, 2020
b7a0284
:tada: :one::two: saas_limit_max_users
em230418 Apr 9, 2020
4c10009
:tada: :one::two: saas_access_apps
em230418 Apr 10, 2020
019111b
:tada: :one::two: saas_portal
em230418 Apr 24, 2020
6bdadf1
:arrow_up: :one::three: saas_access_apps
em230418 May 16, 2020
e9598d6
:arrow_up: :one::three: saas_expiration
em230418 May 16, 2020
aa8365f
:arrow_up: :one::three: saas_limit_max_users
em230418 May 16, 2020
f111969
:arrow_up: :one::three: saas_portal
em230418 May 16, 2020
5f61869
:tada: :one::three: saas_product
em230418 May 21, 2020
4c3988b
:book: saas_portal: added known bug about number of queue jobs
em230418 Jan 19, 2021
9dbbd4b
:tada: :one::three: saas_apps
em230418 Jan 19, 2021
a5fb218
:tada: :one::three: saas_contract
em230418 Jan 20, 2021
9aa4f94
:tada: :one::three: saas_apps_signup
em230418 Jan 20, 2021
d33f05c
:shield: saas_apps: disable js-empty-coverage
em230418 Apr 16, 2021
767f302
:shield: added missing server-auth repository for oca_depenencies
em230418 Apr 19, 2021
782ef07
:shield: added missing contract repository for oca_dependencies
em230418 Apr 19, 2021
f4d19b3
:ambulance: saas: flush job after writing it
em230418 Apr 30, 2021
827c090
:green_heart: saas: ignore odoo 13.0+ specific lint error
em230418 May 9, 2021
9739689
:green_heart: saas_apps_signup: ignore odoo 13.0+ specific lint error
em230418 May 9, 2021
3471aa6
:green_heart: saas_apps: remove duplicated view_mode field
em230418 May 9, 2021
c875c8d
:green_heart: saas_contract: allow to translate exception message
em230418 May 9, 2021
d73684e
:shield: travis: several fixes:
em230418 May 9, 2021
7c183b8
:green_heart: saas_apps_signup: add python-slugify to external-depend…
em230418 May 10, 2021
9230b7c
:ambulance: saas_public: fix 'Wrong token' return, when public user i…
em230418 May 14, 2021
eb9a048
:ambulance: saas_apps_signup: when build is made by contract, inappro…
em230418 Jun 9, 2021
c0899d9
:ambulance: saas_apps_signup: when build is made by contract, incorre…
em230418 Jun 9, 2021
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
21 changes: 10 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,21 @@ addons:

env:
global:
- OPTIONS="--log-db=openerp_test --load=web,queue_job"
- VERSION="13.0" TESTS="0" LINT_CHECK="0" UNIT_TEST="0"
- PYLINT_ODOO_JSLINTRC="/home/travis/maintainer-quality-tools/travis/cfg/.jslintrc"
- DISABLE_PYLINT='absent-index-html,manifest-image'
- VERSION="13.0" TESTS="0" LINT_CHECK="0" UNIT_TEST="0"
- OPTIONS="--log-db=openerp_test --load=web,queue_job"
- PYLINT_ODOO_JSLINTRC="/home/travis/maintainer-quality-tools/travis/cfg/.jslintrc"
- DISABLE_PYLINT='absent-index-html,manifest-image,manifest-name'

matrix:
- LINT_CHECK="1"
- CHECK_TAGS="1"
- MAKEPOT="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
# OCA/OCB doesn't have master branch. TODO: uncomment this in odoo 12
#- TESTS="1" ODOO_REPO="OCA/OCB"
- LINT_CHECK="1"
- CHECK_TAGS="1"
- MAKEPOT="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"

install:
- pip install anybox.testing.openerp
- git clone https://github.com/it-projects-llc/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- git clone https://github.com/em230418/maintainer-quality-tools.git -b saas-addons ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly

Expand Down
5 changes: 4 additions & 1 deletion oca_dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
queue https://github.com/OCA/queue.git
OCA_web https://github.com/OCA/web.git
web https://github.com/OCA/web.git
access-addons https://github.com/itpp-labs/access-addons.git
server-auth https://github.com/OCA/server-auth.git
contract https://github.com/OCA/contract.git
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
17 changes: 17 additions & 0 deletions saas/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
`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
- **Improvement:** Added "Operators" menu to show list of operators
- **Improvement:** saas.operator.name field is now mandatory
- **Fix:** Do not run tests when installing modules in builds
- **Improvement:** Added "Install missing mandatory modules" button in build and template operator views on developer mode

`2.4.3`
-------

Expand Down
1 change: 1 addition & 0 deletions saas/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
from . import saas_db
from . import saas_log
from . import auth_quick_master_token
from . import queue_job
10 changes: 10 additions & 0 deletions saas/models/queue_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import models


class QueueJob(models.Model):
_inherit = "queue.job"

def write(self, vals):
res = super(QueueJob, self).write(vals)
self.flush()
return res
36 changes: 35 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,36 @@ 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):
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)

def action_install_missing_mandatory_modules(self):
for build in self:
operator = build.operator_id
operator._install_modules(build.name, [('name', 'in', operator.get_mandatory_modules())])
Loading