Files
odoo_source/addons/stock/__init__.py
T
Mathieu Walravens 6a0952a5b1 [FIX] stock: clean-up sequences at uninstall
When stock is uninstalled, the sequences used in the warehouses for the
picking types are kept. However, since [1], picking types cannot be
duplicated anymore. When the module is re-installed, the picking types
are created with the same name, which is not allowed by [1].

[1]: https://github.com/odoo/odoo/commit/9034602a028fb22fbd139cf41a2f5c71d9d8d032

opw-3484352

closes odoo/odoo#135036

X-original-commit: 7b0f38fea8bc9a541972d29f289e6175ee15919b
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com>
2023-09-11 22:41:10 +00:00

31 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import controllers
from . import models
from . import report
from . import wizard
from . import populate
# TODO: Apply proper fix & remove in master
def pre_init_hook(env):
env['ir.model.data'].search([
('model', 'like', '%stock%'),
('module', '=', 'stock')
]).unlink()
def _assign_default_mail_template_picking_id(env):
company_ids_without_default_mail_template_id = env['res.company'].search([
('stock_mail_confirmation_template_id', '=', False)
])
default_mail_template_id = env.ref('stock.mail_template_data_delivery_confirmation', raise_if_not_found=False)
if default_mail_template_id:
company_ids_without_default_mail_template_id.write({
'stock_mail_confirmation_template_id': default_mail_template_id.id,
})
def uninstall_hook(env):
picking_type_ids = env["stock.picking.type"].with_context({"active_test": False}).search([])
picking_type_ids.sequence_id.unlink()