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

Procurement pre-migration fails when stock is not installed. #191

Closed
mvaled opened this issue Jan 2, 2015 · 8 comments
Closed

Procurement pre-migration fails when stock is not installed. #191

mvaled opened this issue Jan 2, 2015 · 8 comments

Comments

@mvaled
Copy link

mvaled commented Jan 2, 2015

State of the DB:

$ psql -d mercurio8 -c "SELECT name, state FROM ir_module_module WHERE state='installed'" | grep "\(pro\|sto\)"
 product                | installed

This is: Neither procurement nor stock are installed.

When running the migration with OpenUpgrade, it fails with:

  File "/home/manu/src/merchise/pgi/openupgrade/addons/procurement/migrations/8.0.1.0/pre-migration.py", line 53, in migrate
    openupgrade.rename_columns(cr, column_renames)
  File "/home/manu/src/merchise/pgi/openupgrade/openerp/openupgrade/openupgrade.py", line 153, in rename_columns
    'ALTER TABLE "%s" RENAME "%s" TO "%s"' % (table, old, new,))
  File "/home/manu/src/merchise/pgi/openupgrade/openerp/sql_db.py", line 158, in wrapper
    return f(self, *args, **kwargs)
  File "/home/manu/src/merchise/pgi/openupgrade/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
ProgrammingError: relation "stock_warehouse_orderpoint" does not exist
@mvaled
Copy link
Author

mvaled commented Jan 2, 2015

BTW, Why does the procurement pre-migration is ran if it's not installed in my DB. Is this normal?

@mvaled
Copy link
Author

mvaled commented Jan 2, 2015

Well, I took a peek in the loading.py module to see why and now I know:

$ psql -d mercurio8 -c "SELECT name, state FROM ir_module_module WHERE state!='uninstalled'" | grep "\(pro\|sto\)"
 project                      | to upgrade
 procurement                  | to install
 project_issue                | to upgrade
 product                      | installed
 process                      | to upgrade
 crm_profiling                | to upgrade

Procurement, which is auto-installabled, now depends solely on base and product, and since their both installed, it is automatically marked to be installed. I removed the 8.0-procurement-fixes branch for the moment till I know for sure how to deal with this.

@StefanRijnhart
Copy link
Member

Strange thing is, that the migrate decorator from openerp/openupgrade/openupgrade.py checks for version and does not run the migration if it is not set. That should be the case for a new installation. Can you check what it gets at that point?

@mvaled
Copy link
Author

mvaled commented Jan 5, 2015

Hi @StefanRijnhart,

I see no check about this in the decorator. Currently the migrate decorator simply calls the decorated function. No questions asked.

@mvaled
Copy link
Author

mvaled commented Jan 5, 2015

I have reworked the branch which moves this past this issue: https://github.com/mvaled/OpenUpgrade/tree/8.0-procurement-fixes

@mvaled
Copy link
Author

mvaled commented Jan 5, 2015

Opps. I didn't get you exactly. It checks the version, not the state.... Let's try to inspect this.

@mvaled
Copy link
Author

mvaled commented Jan 5, 2015

Well, now it simply does not get executed: version is None. It seems I did something I can't recall now that let the DB in an unstable state. Closing this now.

@mvaled mvaled closed this as completed Jan 5, 2015
@StefanRijnhart
Copy link
Member

Thanks for the follow-up!

GuillemCForgeFlow pushed a commit to ForgeFlow/OpenUpgrade that referenced this issue Oct 10, 2024
Signed-off-by pedrobaeza
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants