fix smart button Generated Lots error
This commit is contained in:
parent
e912961a2d
commit
816bd3bd71
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user