fix(#60): Corregir error en creación de actividades al rechazar muestra
- Agregar campo obligatorio res_model_id en mail.activity - Obtener ID del modelo stock.lot antes de crear actividad - Prevenir error de validación al rechazar muestras 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8d85d8c3ba
commit
1e079a896b
BIN
documents/logs/Screenshot_4.png
Normal file
BIN
documents/logs/Screenshot_4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
documents/logs/Screenshot_5.png
Normal file
BIN
documents/logs/Screenshot_5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -490,10 +490,14 @@ class StockLot(models.Model):
|
|||
if receptionist_group:
|
||||
receptionist_users = receptionist_group.users
|
||||
|
||||
# Get the model id for stock.lot
|
||||
model_id = self.env['ir.model'].search([('model', '=', 'stock.lot')], limit=1).id
|
||||
|
||||
# Create activities for receptionists
|
||||
for user in receptionist_users:
|
||||
self.env['mail.activity'].create({
|
||||
'res_model': 'stock.lot',
|
||||
'res_model_id': model_id, # Campo obligatorio
|
||||
'res_id': resample.id,
|
||||
'activity_type_id': self.env.ref('mail.mail_activity_data_todo').id,
|
||||
'summary': _('Nueva re-muestra pendiente de recolección'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user