fix(#67): Corregir error 'Expected singleton' en action_cancel de stock.lot

- Modificar método action_cancel para manejar múltiples registros
- Usar bucle for para procesar cada registro individualmente
- Mantener la funcionalidad de registro de actividad para cada muestra cancelada
This commit is contained in:
Luis Ernesto Portillo Zaldivar 2025-07-16 19:16:24 -06:00
parent c03afb7f76
commit dcff505a4f
2 changed files with 8 additions and 7 deletions

View File

@ -206,13 +206,14 @@ class StockLot(models.Model):
def action_cancel(self):
"""Cancel the sample"""
old_state = self.state
self.write({'state': 'cancelled'})
self.message_post(
body='Muestra cancelada por %s' % self.env.user.name,
subject='Estado actualizado: Cancelada',
message_type='notification'
)
for record in self:
old_state = record.state
record.write({'state': 'cancelled'})
record.message_post(
body='Muestra cancelada por %s' % self.env.user.name,
subject='Estado actualizado: Cancelada',
message_type='notification'
)
def action_open_rejection_wizard(self):
"""Open the rejection wizard"""