[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
This commit is contained in:
Preksha Chouhan
2023-08-11 15:53:18 +02:00
parent ddab10955e
commit 72cd1669af
+1 -1
View File
@@ -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):