credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #06015
[Bug 1355054] [NEW] Migration script for stock_location
Public bug reported:
Find attached a migration script for stock_location based on stock's
migration scripts. The only difference found in the analysis is the
change from address_id (res.partner.address) to partner_id which is
reflected in these migration scripts.
For reference, here is the error the migration attempt will throw
without this patch:
2014-08-11 08:14:14,077 2836 ERROR xxxxx openerp.sql_db: bad query: ALTER TABLE "product_pulled_flow" ADD FOREIGN KEY ("partner_address_id") REFERENCES "res_partner" ON DELETE set null
Traceback (most recent call last):
File "/opt/openerp/openupgrade-server/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "product_pulled_flow" violates foreign key constraint "product_pulled_flow_partner_address_id_fkey"
DETAIL: Key (partner_address_id)=(78) is not present in table "res_partner".
2014-08-11 08:14:14,077 2836 ERROR xxxxx openerp: Failed to initialize database `xxxxx`.
Traceback (most recent call last):
File "/opt/openerp/openupgrade-server/openerp/cli/server.py", line 98, in preload_registry
db, registry = openerp.pooler.get_db_and_pool(dbname,update_module=update_module)
File "/opt/openerp/openupgrade-server/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module)
File "/opt/openerp/openupgrade-server/openerp/modules/registry.py", line 192, in get
update_module)
File "/opt/openerp/openupgrade-server/openerp/modules/registry.py", line 218, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/opt/openerp/openupgrade-server/openerp/modules/loading.py", line 378, in load_modules
processed_upgrade = load_marked_modules(cr, graph, states_to_load, force, status, report, loaded_modules, update_module, registry)
File "/opt/openerp/openupgrade-server/openerp/modules/loading.py", line 285, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks, registry=registry)
File "/opt/openerp/openupgrade-server/openerp/modules/loading.py", line 186, in load_module_graph
init_module_models(cr, package.name, models)
File "/opt/openerp/openupgrade-server/openerp/modules/module.py", line 381, in init_module_models
obj._auto_end(cr, {'module': module_name})
File "/opt/openerp/openupgrade-server/openerp/osv/orm.py", line 3243, in _auto_end
cr.execute('ALTER TABLE "%s" ADD FOREIGN KEY ("%s") REFERENCES "%s" ON DELETE %s' % (t, k, r, d))
File "/opt/openerp/openupgrade-server/openerp/sql_db.py", line 161, in wrapper
return f(self, *args, **kwargs)
File "/opt/openerp/openupgrade-server/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "product_pulled_flow" violates foreign key constraint "product_pulled_flow_partner_address_id_fkey"
DETAIL: Key (partner_address_id)=(78) is not present in table "res_partner".
** Affects: openupgrade-addons
Importance: Undecided
Status: New
** Attachment added: "stock_location_migration"
https://bugs.launchpad.net/bugs/1355054/+attachment/4174259/+files/stock_location_migration
--
You received this bug notification because you are a member of
OpenUpgrade Committers, which is subscribed to OpenUpgrade Addons.
https://bugs.launchpad.net/bugs/1355054
Title:
Migration script for stock_location
Status in OpenUpgrade Addons:
New
Bug description:
Find attached a migration script for stock_location based on stock's
migration scripts. The only difference found in the analysis is the
change from address_id (res.partner.address) to partner_id which is
reflected in these migration scripts.
For reference, here is the error the migration attempt will throw
without this patch:
2014-08-11 08:14:14,077 2836 ERROR xxxxx openerp.sql_db: bad query: ALTER TABLE "product_pulled_flow" ADD FOREIGN KEY ("partner_address_id") REFERENCES "res_partner" ON DELETE set null
Traceback (most recent call last):
File "/opt/openerp/openupgrade-server/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "product_pulled_flow" violates foreign key constraint "product_pulled_flow_partner_address_id_fkey"
DETAIL: Key (partner_address_id)=(78) is not present in table "res_partner".
2014-08-11 08:14:14,077 2836 ERROR xxxxx openerp: Failed to initialize database `xxxxx`.
Traceback (most recent call last):
File "/opt/openerp/openupgrade-server/openerp/cli/server.py", line 98, in preload_registry
db, registry = openerp.pooler.get_db_and_pool(dbname,update_module=update_module)
File "/opt/openerp/openupgrade-server/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module)
File "/opt/openerp/openupgrade-server/openerp/modules/registry.py", line 192, in get
update_module)
File "/opt/openerp/openupgrade-server/openerp/modules/registry.py", line 218, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/opt/openerp/openupgrade-server/openerp/modules/loading.py", line 378, in load_modules
processed_upgrade = load_marked_modules(cr, graph, states_to_load, force, status, report, loaded_modules, update_module, registry)
File "/opt/openerp/openupgrade-server/openerp/modules/loading.py", line 285, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks, registry=registry)
File "/opt/openerp/openupgrade-server/openerp/modules/loading.py", line 186, in load_module_graph
init_module_models(cr, package.name, models)
File "/opt/openerp/openupgrade-server/openerp/modules/module.py", line 381, in init_module_models
obj._auto_end(cr, {'module': module_name})
File "/opt/openerp/openupgrade-server/openerp/osv/orm.py", line 3243, in _auto_end
cr.execute('ALTER TABLE "%s" ADD FOREIGN KEY ("%s") REFERENCES "%s" ON DELETE %s' % (t, k, r, d))
File "/opt/openerp/openupgrade-server/openerp/sql_db.py", line 161, in wrapper
return f(self, *args, **kwargs)
File "/opt/openerp/openupgrade-server/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "product_pulled_flow" violates foreign key constraint "product_pulled_flow_partner_address_id_fkey"
DETAIL: Key (partner_address_id)=(78) is not present in table "res_partner".
To manage notifications about this bug go to:
https://bugs.launchpad.net/openupgrade-addons/+bug/1355054/+subscriptions
Follow ups
References