Skip to content
Snippets Groups Projects
Commit b2bc7956 authored by Mathieu Walravens's avatar Mathieu Walravens
Browse files

[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#134032

Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
parent 8156d6a2
No related branches found
No related tags found
No related merge requests found
......@@ -29,3 +29,8 @@ def _assign_default_mail_template_picking_id(cr, registry):
company_ids_without_default_mail_template_id.write({
'stock_mail_confirmation_template_id': default_mail_template_id.id,
})
def uninstall_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
picking_type_ids = env["stock.picking.type"].with_context({"active_test": False}).search([])
picking_type_ids.sequence_id.unlink()
......@@ -93,6 +93,7 @@
'application': True,
'pre_init_hook': 'pre_init_hook',
'post_init_hook': '_assign_default_mail_template_picking_id',
'uninstall_hook': 'uninstall_hook',
'assets': {
'web.report_assets_common': [
# legacy reports (delete when all reports are converted)
......
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