diff --git a/lims_management/models/__pycache__/sale_order.cpython-312.pyc b/lims_management/models/__pycache__/sale_order.cpython-312.pyc index cb430ed..61dbebf 100644 Binary files a/lims_management/models/__pycache__/sale_order.cpython-312.pyc and b/lims_management/models/__pycache__/sale_order.cpython-312.pyc differ diff --git a/lims_management/models/__pycache__/stock_lot.cpython-312.pyc b/lims_management/models/__pycache__/stock_lot.cpython-312.pyc index c5edc30..49bcfe0 100644 Binary files a/lims_management/models/__pycache__/stock_lot.cpython-312.pyc and b/lims_management/models/__pycache__/stock_lot.cpython-312.pyc differ diff --git a/lims_management/models/stock_lot.py b/lims_management/models/stock_lot.py index dfe9ef6..8c7b8d9 100644 --- a/lims_management/models/stock_lot.py +++ b/lims_management/models/stock_lot.py @@ -145,74 +145,81 @@ class StockLot(models.Model): ) def action_collect(self): - """Mark sample as collected""" - old_state = self.state - self.write({'state': 'collected', 'collection_date': fields.Datetime.now()}) - self.message_post( - body='Muestra recolectada por %s' % self.env.user.name, - subject='Estado actualizado: Recolectada', - message_type='notification' - ) + """Mark sample(s) as collected""" + for record in self: + old_state = record.state + record.write({'state': 'collected', 'collection_date': fields.Datetime.now()}) + record.message_post( + body='Muestra recolectada por %s' % self.env.user.name, + subject='Estado actualizado: Recolectada', + message_type='notification' + ) def action_receive(self): - """Mark sample as received in laboratory""" - old_state = self.state - self.write({'state': 'received'}) - self.message_post( - body='Muestra recibida en laboratorio por %s' % self.env.user.name, - subject='Estado actualizado: Recibida', - message_type='notification' - ) + """Mark sample(s) as received in laboratory""" + for record in self: + old_state = record.state + record.write({'state': 'received'}) + record.message_post( + body='Muestra recibida en laboratorio por %s' % self.env.user.name, + subject='Estado actualizado: Recibida', + message_type='notification' + ) def action_start_analysis(self): """Start analysis process""" - old_state = self.state - self.write({'state': 'in_process'}) - self.message_post( - body='Análisis iniciado por %s' % self.env.user.name, - subject='Estado actualizado: En Proceso', - message_type='notification' - ) + for record in self: + old_state = record.state + record.write({'state': 'in_process'}) + record.message_post( + body='Análisis iniciado por %s' % self.env.user.name, + subject='Estado actualizado: En Proceso', + message_type='notification' + ) def action_complete_analysis(self): """Mark analysis as completed""" - old_state = self.state - self.write({'state': 'analyzed'}) - self.message_post( - body='Análisis completado por %s' % self.env.user.name, - subject='Estado actualizado: Analizada', - message_type='notification' - ) + for record in self: + old_state = record.state + record.write({'state': 'analyzed'}) + record.message_post( + body='Análisis completado por %s' % self.env.user.name, + subject='Estado actualizado: Analizada', + message_type='notification' + ) def action_store(self): - """Store the sample""" - old_state = self.state - self.write({'state': 'stored'}) - self.message_post( - body='Muestra almacenada por %s' % self.env.user.name, - subject='Estado actualizado: Almacenada', - message_type='notification' - ) + """Store the sample(s)""" + for record in self: + old_state = record.state + record.write({'state': 'stored'}) + record.message_post( + body='Muestra almacenada por %s' % self.env.user.name, + subject='Estado actualizado: Almacenada', + message_type='notification' + ) def action_dispose(self): - """Dispose of the sample""" - old_state = self.state - self.write({'state': 'disposed'}) - self.message_post( - body='Muestra desechada por %s. Motivo de disposición registrado.' % self.env.user.name, - subject='Estado actualizado: Desechada', - message_type='notification' - ) + """Dispose of the sample(s)""" + for record in self: + old_state = record.state + record.write({'state': 'disposed'}) + record.message_post( + body='Muestra desechada por %s. Motivo de disposición registrado.' % self.env.user.name, + subject='Estado actualizado: Desechada', + message_type='notification' + ) 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' - ) + """Cancel the sample(s)""" + 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"""