From 0637f0a9e33c514d09a69989e503ff0302ce275b Mon Sep 17 00:00:00 2001 From: Luis Ernesto Portillo Zaldivar Date: Wed, 16 Jul 2025 21:49:50 -0600 Subject: [PATCH] =?UTF-8?q?fix(#69):=20Corregir=20error=20'Expected=20sing?= =?UTF-8?q?leton'=20en=20m=C3=A9todos=20de=20acci=C3=B3n=20de=20stock.lot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modificar todos los métodos action_* para manejar múltiples registros - Usar bucle 'for record in self:' en lugar de acceder directamente a self - Afecta a: action_collect, action_receive, action_start_analysis, action_complete_analysis, action_store, action_dispose, action_cancel - Previene el error cuando se llaman estos métodos con múltiples muestras --- .../__pycache__/sale_order.cpython-312.pyc | Bin 17447 -> 17447 bytes .../__pycache__/stock_lot.cpython-312.pyc | Bin 24615 -> 24845 bytes lims_management/models/stock_lot.py | 115 ++++++++++-------- 3 files changed, 61 insertions(+), 54 deletions(-) diff --git a/lims_management/models/__pycache__/sale_order.cpython-312.pyc b/lims_management/models/__pycache__/sale_order.cpython-312.pyc index cb430ed31c536f04b3d94e0b4d5e9c424161ad6a..61dbebfcb053b878b2570f1f351871a699ce70e7 100644 GIT binary patch delta 21 bcmZ49!MMDGk?S-sFBbz4w0dvkl63(9La7Bt delta 21 bcmZ49!MMDGk?S-sFBbz49O2x^CF=qJLfHjF diff --git a/lims_management/models/__pycache__/stock_lot.cpython-312.pyc b/lims_management/models/__pycache__/stock_lot.cpython-312.pyc index c5edc30b6b09c5b762e62200ee4158633e75475c..49bcfe06999c89c72a2bcbd441bf3e5669768d70 100644 GIT binary patch delta 2246 zcmchYdraF^6vun$6KHuCTcFT5nBagG1_fcj6vn%d@u;N;th7JYN+0aD;2t&YrcSoF z%yCs%Oa}gi^AAJwn>O-?f{&1BVrXQx_78)P8U4r1%_U}L#(M`tG7Pe0@t50A&OP_` z-1EKX-rU&*IQKEceIb#=aL5-kc+_&S*B^H|UMe76F8SU3onVsV;nZ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>3CXq7@N;Ad($Au?AxXl z@Trp8T$Kiu%G%wxQo+TR?(u_{9o=&ds+AS(HrRsO9oO1?ZaTX|LZe$cv^pe_Sq1n< z^a;dfoT%SL0>mTxLlVV^dC6UH_&%igYCpk{RiixU$OuI 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"""