diff --git a/__pycache__/__init__.cpython-312.pyc b/__pycache__/__init__.cpython-312.pyc index 39e3b77..055a230 100644 Binary files a/__pycache__/__init__.cpython-312.pyc and b/__pycache__/__init__.cpython-312.pyc differ diff --git a/models/__pycache__/__init__.cpython-312.pyc b/models/__pycache__/__init__.cpython-312.pyc index 93ddb1c..986e170 100644 Binary files a/models/__pycache__/__init__.cpython-312.pyc and b/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/models/__pycache__/mrp_production.cpython-312.pyc b/models/__pycache__/mrp_production.cpython-312.pyc index a6a86fd..ea139dd 100644 Binary files a/models/__pycache__/mrp_production.cpython-312.pyc and b/models/__pycache__/mrp_production.cpython-312.pyc differ diff --git a/models/__pycache__/product_template.cpython-312.pyc b/models/__pycache__/product_template.cpython-312.pyc index 54df751..23d0013 100644 Binary files a/models/__pycache__/product_template.cpython-312.pyc and b/models/__pycache__/product_template.cpython-312.pyc differ diff --git a/models/__pycache__/stock_lot.cpython-312.pyc b/models/__pycache__/stock_lot.cpython-312.pyc index baabfd1..f8f212d 100644 Binary files a/models/__pycache__/stock_lot.cpython-312.pyc and b/models/__pycache__/stock_lot.cpython-312.pyc differ diff --git a/models/__pycache__/stock_move.cpython-312.pyc b/models/__pycache__/stock_move.cpython-312.pyc index c50dd49..b1eb428 100644 Binary files a/models/__pycache__/stock_move.cpython-312.pyc and b/models/__pycache__/stock_move.cpython-312.pyc differ diff --git a/models/__pycache__/stock_move_line.cpython-312.pyc b/models/__pycache__/stock_move_line.cpython-312.pyc index 6901acd..d0cc359 100644 Binary files a/models/__pycache__/stock_move_line.cpython-312.pyc and b/models/__pycache__/stock_move_line.cpython-312.pyc differ diff --git a/models/stock_picking.py b/models/stock_picking.py index e3b252a..aa0a1fb 100644 --- a/models/stock_picking.py +++ b/models/stock_picking.py @@ -39,13 +39,31 @@ class StockPicking(models.Model): subcontract_moves = self.move_ids.filtered('is_subcontract') lot_ids = subcontract_moves.move_line_ids.mapped('lot_id').ids + if not lot_ids: + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'No Lots Found', + 'message': 'No lots have been generated for subcontract moves yet.', + 'type': 'info', + 'sticky': False, + } + } + + # Create a simple action to view the lots return { - 'name': 'Generated Lots', + 'name': f'Generated Lots ({len(lot_ids)})', 'type': 'ir.actions.act_window', 'res_model': 'stock.lot', - 'view_mode': 'tree,form', + 'view_mode': 'list,form', + 'views': [(False, 'list'), (False, 'form')], 'domain': [('id', 'in', lot_ids)], - 'context': {'create': False}, + 'context': { + 'create': False, + 'edit': False, + }, + 'target': 'current', } def action_auto_generate_lots_subcontract(self):