mirror of
https://github.com/bringout/oca-ocb-mrp.git
synced 2026-04-23 06:12:09 +02:00
Initial commit: Mrp packages
This commit is contained in:
commit
50d736b3bd
739 changed files with 538193 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
# -*- 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})
|
||||
companies = env["res.company"].search([])
|
||||
subcontracting_locations = companies.mapped("subcontracting_location_id")
|
||||
subcontracting_locations.active = False
|
||||
companies.write({"subcontracting_location_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
|
||||
Loading…
Add table
Add a link
Reference in a new issue