Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 64 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions odoo/addons/base/migrations/10.0.1.3/noupdate_changes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<record id="gw" model="res.country">
<field name="currency_id" ref="XOF"/>
</record>
<record id="tp" model="res.country">
<field name="currency_id" ref="USD"/>
</record>
<record id="tj" model="res.country">
<field name="currency_id" ref="TJS"/>
</record>
<record id="TRY" model="res.currency">
<field name="symbol">₺</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a good practice to rename these fields to None in case they are needed by other module. database_cleanup can later purge the column if you want.

base / res.partner / company_name (char) : NEW
base / res.partner / company_type (selection) : now a function
Expand Down
11 changes: 11 additions & 0 deletions odoo/addons/base/migrations/10.0.1.3/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# coding: utf-8
# © 2017 Opener BV <http://therp.nl>
# 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'
)
48 changes: 48 additions & 0 deletions odoo/addons/base/migrations/10.0.1.3/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
# 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''')
1 change: 1 addition & 0 deletions odoo/openupgrade/doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion odoo/openupgrade/doc/source/modules90-100.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Status :
+-----------------------------------+-----------------------------------+
|barcodes | |
+-----------------------------------+-----------------------------------+
|base | |
|base | Done |
+-----------------------------------+-----------------------------------+
|base_action_rule | |
+-----------------------------------+-----------------------------------+
Expand Down
1 change: 1 addition & 0 deletions scripts/compare_noupdate_xml_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions scripts/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def copy_database(conn_parms):
del os.environ['PGPASSWORD']
return db_new


migrations = {
'10.0': {
'addons': {
Expand Down