diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000000..5ab9299f14f7 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,64 @@ +language: python +sudo: false + +python: + - "2.7" + +addons: + apt: + packages: + - expect-dev # provides unbuffer utility + - python-lxml # because pip installation is slow + - python-simplejson + - python-serial + - python-yaml + postgresql: "9.4" + +env: + - DB=openupgrade ODOO=./odoo-bin + +# Need flake8 for pep8 testing +install: + - pip install flake8 coveralls + +# Test with flake for: +# * migration scripts +# * scripts/ directory +# * openerp/addons/openupgrade* directories +# * openerp/openupgrade/ directory +# use a max length of 120 +script: + - flake8 scripts --max-line-length=120 + - flake8 odoo/openupgrade --max-line-length=120 + - flake8 odoo/addons/openupgrade* --max-line-length=120 --filename=__init__.py --ignore=F401 + - flake8 odoo/addons/openupgrade* --max-line-length=120 --exclude=__init__.py +# only flake8 migration scripts from the openupgrade project, presumably +# identifyable by using the openupgrade helpers + - flake8 --max-line-length=120 $(find . \( -name 'pre-*.py' -or -name 'post-*.py' \) -exec grep -q openupgrade {} \; -print) + - flake8 odoo/addons/*/migrations/*/tests/ --max-line-length=120 + - flake8 addons/*/migrations/*/tests/ --max-line-length=120 + - npm install -g less less-plugin-clean-css + - createdb $DB + - wget -q -O- https://github.com/OCA/OpenUpgrade/releases/download/databases/9.0.psql | pg_restore -d $DB --no-owner + - cat odoo/addons/base/migrations/*/tests/*.yml addons/*/migrations/*/tests/*.yml > ../test_data90.yml || true + # Roundtrip to previous release to update the test database with additional test data + # Loading and committing test data without triggering post tests needs https://github.com/odoo/odoo/pull/13146. This is now included in OpenUpgrade. + - git fetch --depth 2 origin 9.0 + - git reset --hard `git ls-remote |grep refs/heads/9.0 |awk '{print $1}'` + - pip install -q -r requirements.txt + # this crashes if there is no test data + - if [ -s ../test_data90.yml ]; then ./openerp-server --database=$DB --test-file=`readlink -f ../test_data90.yml` --test-commit --stop-after-init; fi + - git reset -q --hard $TRAVIS_COMMIT + # Install Python requirements of target release + - pip install -q -r requirements.txt + # don't use pypi's openupgradelib, but the one from source to avoid choking + # on unreleased features in openupgradelib + - pip install --ignore-installed git+https://github.com/OCA/openupgradelib.git@master + # select modules and perform the upgrade + - MODULES=base,$(sed -n '/^+========/,$p' odoo/openupgrade/doc/source/modules90-100.rst | grep "Done\|Partial" | sed -n '/^|/ s/^|\([0-9a-z_]*\) *|.*$/\1/g p' | paste -d, -s) + - psql $DB -c "update ir_module_module set state='uninstalled' where name not in ('$(echo $MODULES | sed -e "s/,/','/g")')" + - echo Testing modules $MODULES + - OPENUPGRADE_TESTS=1 coverage run $ODOO --database=$DB --update=$MODULES --stop-after-init + +after_success: + coveralls diff --git a/odoo/addons/base/migrations/10.0.1.3/noupdate_changes.xml b/odoo/addons/base/migrations/10.0.1.3/noupdate_changes.xml new file mode 100644 index 000000000000..4a4f00bd0932 --- /dev/null +++ b/odoo/addons/base/migrations/10.0.1.3/noupdate_changes.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/odoo/addons/base/migrations/10.0.1.3/openupgrade_analysis_work.txt b/odoo/addons/base/migrations/10.0.1.3/openupgrade_analysis_work.txt index ff8ab7cf5a0a..e0794f338b2f 100644 --- a/odoo/addons/base/migrations/10.0.1.3/openupgrade_analysis_work.txt +++ b/odoo/addons/base/migrations/10.0.1.3/openupgrade_analysis_work.txt @@ -1,26 +1,26 @@ ---Fields in module 'base'--- base / ir.actions.act_window / auto_refresh (integer) : DEL base / ir.actions.act_window / target (selection) : selection_keys is now '['current', 'fullscreen', 'inline', 'main', 'new']' ('['current', 'inline', 'inlineview', 'new']') -# TODO: pre-migration: copy column -# TODO: post-migration: map values +# inlineview => inline base / ir.actions.client / target (selection) : NEW selection_keys: ['current', 'fullscreen', 'main', 'new'] # NOTHING TO DO base / ir.model.fields / store (boolean) : NEW -# NOTHING TO DO +# created in pre_migrate + base / ir.module.module / license (selection) : selection_keys is now '['AGPL-3', 'GPL-2', 'GPL-2 or any later version', 'GPL-3', 'GPL-3 or any later version', 'LGPL-3', 'OEEL-1', 'OPL-1', 'Other OSI approved licence', 'Other proprietary']' ('['AGPL-3', 'GPL-2', 'GPL-2 or any later version', 'GPL-3', 'GPL-3 or any later version', 'LGPL-3', 'OEEL-1', 'Other OSI approved licence', 'Other proprietary']') base / ir.ui.menu / active (boolean) : NEW # NOTHING TO DO base / ir.ui.view / type (selection) : selection_keys is now '['calendar', 'diagram', 'form', 'gantt', 'graph', 'kanban', 'pivot', 'qweb', 'search', 'tree']' ('['calendar', 'diagram', 'form', 'gantt', 'graph', 'kanban', 'pivot', 'qweb', 'sales_team_dashboard', 'search', 'tree']') -# TODO: pre-migration. Map the values that are obsolete to new valid ones. +# sales_team_dashboard => kanban base / res.company / bank_ids (one2many) : NEW relation: res.partner.bank base / res.company / sequence (integer) : NEW # NOTHING TO DO base / res.currency / symbol (char) : now required -# TODO: pre-migration: Use the value of name if symbol is blank +# Use the value of name if symbol is blank base / res.partner / birthdate (char) : DEL base / res.partner / company_name (char) : NEW base / res.partner / company_type (selection) : now a function diff --git a/odoo/addons/base/migrations/10.0.1.3/post-migration.py b/odoo/addons/base/migrations/10.0.1.3/post-migration.py new file mode 100644 index 000000000000..5281ffb2f9ec --- /dev/null +++ b/odoo/addons/base/migrations/10.0.1.3/post-migration.py @@ -0,0 +1,11 @@ +# coding: utf-8 +# © 2017 Opener BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + openupgrade.load_data( + env.cr, 'base', 'migrations/10.0.1.3/noupdate_changes.xml' + ) diff --git a/odoo/addons/base/migrations/10.0.1.3/pre-migration.py b/odoo/addons/base/migrations/10.0.1.3/pre-migration.py new file mode 100644 index 000000000000..da8152fc8d5f --- /dev/null +++ b/odoo/addons/base/migrations/10.0.1.3/pre-migration.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# © 2017 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(cr, version): + cr.execute( + # we rely on the ORM to write this value + 'alter table ir_model_fields add column store boolean' + ) + openupgrade.copy_columns(cr, { + 'ir_act_window': [ + ('target', None, None), + ], + }) + openupgrade.map_values( + cr, openupgrade.get_legacy_name('target'), 'target', + [ + ('inlineview', 'inline'), + ], + table='ir_act_window') + cr.execute( + "update ir_ui_view set type='kanban' where type='sales_team_dashboard'" + ) + cr.execute('update res_currency set symbol=name where symbol is null') + # create xmlids for installed languages + cr.execute( + '''insert into ir_model_data + (module, name, model, res_id) + select + 'base', + 'lang_' || + case + when char_length(code) > 2 then + case + when upper(substring(code from 1 for 2)) = + upper(substring(code from 4 for 2)) then + substring(code from 1 for 2) + else + code + end + else + code + end, + 'res.lang', id + from res_lang''') diff --git a/odoo/openupgrade/doc/source/conf.py b/odoo/openupgrade/doc/source/conf.py index c1300b4717ea..cd0f2baeef3e 100644 --- a/odoo/openupgrade/doc/source/conf.py +++ b/odoo/openupgrade/doc/source/conf.py @@ -204,6 +204,7 @@ def __getattr__(self, name): else: return Mock() + MOCK_MODULES = ['osv', 'pooler', 'tools'] for mod_name in MOCK_MODULES: sys.modules[mod_name] = Mock() diff --git a/odoo/openupgrade/doc/source/modules90-100.rst b/odoo/openupgrade/doc/source/modules90-100.rst index d605e65e7353..fc3685e1c9a2 100644 --- a/odoo/openupgrade/doc/source/modules90-100.rst +++ b/odoo/openupgrade/doc/source/modules90-100.rst @@ -58,7 +58,7 @@ Status : +-----------------------------------+-----------------------------------+ |barcodes | | +-----------------------------------+-----------------------------------+ -|base | | +|base | Done | +-----------------------------------+-----------------------------------+ |base_action_rule | | +-----------------------------------+-----------------------------------+ diff --git a/scripts/compare_noupdate_xml_records.py b/scripts/compare_noupdate_xml_records.py index 2af93a7d37ad..9530bf588994 100644 --- a/scripts/compare_noupdate_xml_records.py +++ b/scripts/compare_noupdate_xml_records.py @@ -192,5 +192,6 @@ def main(argv=None): print etree.tostring( document, pretty_print=True, xml_declaration=True, encoding='utf-8') + if __name__ == "__main__": main() diff --git a/scripts/migrate.py b/scripts/migrate.py index 1a4527a3ed45..bd8565d3e7ca 100644 --- a/scripts/migrate.py +++ b/scripts/migrate.py @@ -58,6 +58,7 @@ def copy_database(conn_parms): del os.environ['PGPASSWORD'] return db_new + migrations = { '10.0': { 'addons': {