[FIX] mrp: removed operation types and stock rules

When user uninstall the module 'Manufacturing' the relevant records are not
deleted from the Operation Types, Transfers and Stock Rules.

To produce in sass-16.2:

- Install 'Manufacturing' module
- Create mrp order and validate it.
- Now uninstall 'Manufacturing' module.
- Operation Type 'Manufactuing' is still showing. (14.0 to master)
- Go to 'Inventory' and click on 'Receipts' and remove all the filters.
- Another way > Create a new 'stock.picking' with 'Operation Type' as
'Manufacturing'
Error: A traceback appears: 'Wrong value for stock.picking.picking_type_code:
Manufacturing'

Fixed this issue by updating the code of the picking type and archiving it after
uninstallation of module using 'ondelete' function.

sentry-4167898386
task-3318858

closes odoo/odoo#131725

X-original-commit: 0b400d33ed9ad15d539306ff7ba8519afc63234c
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Preksha Chouhan
2023-08-11 15:53:19 +02:00
parent 72cd1669af
commit 9716d90b3f
+1 -1
View File
@@ -9,7 +9,7 @@ class StockPickingType(models.Model):
code = fields.Selection(selection_add=[
('mrp_operation', 'Manufacturing')
], ondelete={'mrp_operation': 'cascade'})
], ondelete={'mrp_operation': lambda recs: recs.write({'code': 'incoming', 'active': False})})
count_mo_todo = fields.Integer(string="Number of Manufacturing Orders to Process",
compute='_get_mo_count')
count_mo_waiting = fields.Integer(string="Number of Manufacturing Orders Waiting",