From 72cd1669af2989c0a033ab297bbea524491d3116 Mon Sep 17 00:00:00 2001 From: Preksha Chouhan Date: Fri, 30 Jun 2023 08:44:59 +0000 Subject: [PATCH] [FIX] stock_dropshipping: archive data after uninstallation When user uninstall the module 'stock_dropshipping'. The value 'dropship' for selection field 'Type of Operation' does not get deleted and cause error. From version 14.0 when user uninstall the module 'stock_dropshipping', record does not get deleted. To reproduce the issue in sass-16.2: - Install 'stock_dropshipping' module - Go to 'inventory' module - Go to 'Dropship' and click on 'NEW' - Make sure 'Type of Operation' is 'Dropship' and save - Uninstall 'stock_dropshipping' module. - Go to 'Inventory' and click on 'Receipts' and remove all the filters - Another way--> Create a new 'stock.picking' with 'Operation Type' as 'Dropship' Error: A traceback appears: 'Wrong value for stock.picking.picking_type_code: 'dropship' Fixed this issue by updating the code of the picking type and archiving it after uninstallation of module using 'ondelete' function. sentry-4167898386 X-original-commit: ee281cf59d25e7e33f08022784f390e8eb798324 Part-of: odoo/odoo#131725 --- addons/stock_dropshipping/models/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_dropshipping/models/stock.py b/addons/stock_dropshipping/models/stock.py index 80b03ff415c..f139093964a 100644 --- a/addons/stock_dropshipping/models/stock.py +++ b/addons/stock_dropshipping/models/stock.py @@ -44,7 +44,7 @@ class StockPickingType(models.Model): _inherit = 'stock.picking.type' code = fields.Selection( - selection_add=[('dropship', 'Dropship')], ondelete={'dropship': 'cascade'}) + selection_add=[('dropship', 'Dropship')], ondelete={'dropship': lambda recs: recs.write({'code': 'outgoing', 'active': False})}) @api.depends('default_location_src_id', 'default_location_dest_id') def _compute_warehouse_id(self):