Creation of a subcontracting portal to let the subcontractor register himself all the components that were used for the production. The portal is reusing the backend view of the stock picking where components were registered before. closes odoo/odoo#83465 Task: 2645298 Community-pr: https://github.com/odoo/odoo/pull/83465 Enterprise-pr: https://github.com/odoo/enterprise/pull/24647 Related: odoo/upgrade#3402 Related: odoo/enterprise#24647 Signed-off-by: Arnold Moyaux <arm@odoo.com>
26 lines
866 B
Python
26 lines
866 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from . import models
|
|
from . import report
|
|
from . import wizard
|
|
from . import controllers
|
|
|
|
from odoo import SUPERUSER_ID, api
|
|
|
|
|
|
def uninstall_hook(cr, registry):
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
warehouses = env["stock.warehouse"].search([])
|
|
subcontracting_routes = warehouses.mapped("subcontracting_route_id")
|
|
warehouses.write({"subcontracting_route_id": False})
|
|
operations_type_to_remove = (warehouses.subcontracting_resupply_type_id | warehouses.subcontracting_type_id)
|
|
operations_type_to_remove.active = False
|
|
# 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.
|
|
try:
|
|
with env.cr.savepoint():
|
|
subcontracting_routes.unlink()
|
|
operations_type_to_remove.unlink()
|
|
except:
|
|
pass
|