Skip to content
Snippets Groups Projects
Commit 66d9dce9 authored by Arnold Moyaux's avatar Arnold Moyaux
Browse files

[FIX] mrp, mrp_subcontracting: traceback during unistall


The unlink fail in __init__.py uninstall hook is managed, however
when it fail, the error is catch but the cursor is not rollback and
do not accept additional transaction. That result in a traceback at
uninstall.

opw-2453939

closes odoo/odoo#66278

Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
parent 586451e3
No related branches found
No related tags found
No related merge requests found
...@@ -37,12 +37,13 @@ def _create_warehouse_data(cr, registry): ...@@ -37,12 +37,13 @@ def _create_warehouse_data(cr, registry):
def uninstall_hook(cr, registry): def uninstall_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {}) env = api.Environment(cr, SUPERUSER_ID, {})
warehouses = env["stock.warehouse"].search([]) warehouses = env["stock.warehouse"].search([])
subcontracting_routes = warehouses.mapped("pbm_route_id") pbm_routes = warehouses.mapped("pbm_route_id")
warehouses.write({"pbm_route_id": False}) warehouses.write({"pbm_route_id": False})
# Fail unlink means that the route is used somewhere (e.g. route_id on stock.rule). In this case # Fail unlink means that the route is used somewhere (e.g. route_id on stock.rule). In this case
# we don't try to do anything. # we don't try to do anything.
try: try:
subcontracting_routes.unlink() with env.cr.savepoint():
pbm_routes.unlink()
except: except:
pass pass
...@@ -14,6 +14,7 @@ def uninstall_hook(cr, registry): ...@@ -14,6 +14,7 @@ def uninstall_hook(cr, registry):
# Fail unlink means that the route is used somewhere (e.g. route_id on stock.rule). In this case # Fail unlink means that the route is used somewhere (e.g. route_id on stock.rule). In this case
# we don't try to do anything. # we don't try to do anything.
try: try:
subcontracting_routes.unlink() with env.cr.savepoint():
subcontracting_routes.unlink()
except: except:
pass pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment