Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

[custom code] AttributeError: 'str' object has no attribute 'get' while creating new record

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
automatedcreaterecordBug
2 Respuestas
2454 Vistas
Avatar
Johnny Solas

So Im working on this code that creates new record in 'sign.send.request.signer' model. I currently use some test data

data = {
    "role_id" : 1,
    "partner_id" : 14,
    "mail_sent_order" : 1,
}


# Create the record in sign.send.request.signer
env['sign.send.request.signer'].create(data)


Whenever I run this manually an error shows up


Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 390, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "ir.actions.server(899,)", line 29, in <module>
  File "/mnt/enterprise_addons/sign/wizard/sign_send_request.py", line 230, in create
    if not vals.get('partner_id'):
           ^^^^^^^^
AttributeError: 'str' object has no attribute 'get'


I assume the error tells me I'm passing a string and not a dictionary when creating a record. However its pretty obvious that Im passing 'data' and its a dictionary. Did I skip something or do something wrong? Or is this a bug?  

0
Avatar
Descartar
Avatar
Yatrik Chauhan
Mejor respuesta

Hello Johnny Solas,

Please replace your code with the one below and give it a try:

data = [{
    "role_id": 1,
    "partner_id": 14,
    "mail_sent_order": 1,
}]

# Create the record in sign.send.request.signer
env['sign.send.request.signer'].create(data)

Let me know if this works for you.

Thanks!

0
Avatar
Descartar
Johnny Solas
Autor

Wow It works, but there is a new error message shows up

"odoo.exceptions.ValidationError: You must specify one signer for each role of your sign template"

After applying you solution this is my code

# Create the sign send request
send_request_data = {
"template_id": int(payload.get("template_id")),
"subject": "test Subject",
"filename": "test.pdf",
}

send_request = env["sign.send.request"].create(send_request_data)

signer_data = [{
"role_id": 1, # Assuming this is a required role ID in your case
"partner_id": int(payload.get("partner_id")),
"mail_sent_order": 1,
"sign_send_request_id": send_request.id
}]

signer = env["sign.send.request.signer"].create(signer_data)
send_request.send_request()

What could be the problem in this?

Yatrik Chauhan

Hello,

In Odoo, there's a method called _check_signers_roles_validity, which is triggered when the send_request() method is called. This method verifies that each signing role defined in a sign template has exactly one corresponding signer assigned when a sign request is created. If this condition is not met, a ValidationError is raised.

Example Scenarios:
- Valid Case:
The template includes 3 roles (Manager, HR, Employee).
The sign request has 3 signers, each correctly assigned to one of these roles.

- Invalid Case 1:
The template has 3 roles, but the sign request only includes 2 signers → Error raised.

- Invalid Case 2:
The template has no roles defined, but the sign request does not include at least one signer with the default role → Error raised.

I hope this will helpfull for you.

Thanks!

Avatar
Mathesh
Mejor respuesta

Hello Johnny Solas,

Try to put something like this:

def create_records(self):
data = {
"role_id": 1,
"partner_id": 14,
"mail_sent_order": 1,
}
self.env['sign.send.request.signer'].create(data)

  Make sure to call the function and verify that the model and field are available.

Thank you,

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Auto generated quotation
automated create quotation record sales.order
Avatar
0
jul 21
5519
Create co-record on create(self,vals) model
create mrp record
Avatar
Avatar
1
ene 20
6235
Set Deadline in 14 days when task is created in specific project
action automated create
Avatar
1
ene 17
5272
how to change the order who one2many create new records with editable=“bottom”?
one2many create record
Avatar
0
sept 15
4640
On Creation Automated Action not Triggering
action automated create studio
Avatar
0
dic 24
6060
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now