Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
automatedcreaterecordBug
2 Răspunsuri
2480 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Yatrik Chauhan
Cel mai bun răspuns

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
Imagine profil
Abandonează
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!

Imagine profil
Mathesh
Cel mai bun răspuns

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
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Auto generated quotation
automated create quotation record sales.order
Imagine profil
0
iul. 21
5535
Create co-record on create(self,vals) model
create mrp record
Imagine profil
Imagine profil
1
ian. 20
6265
Set Deadline in 14 days when task is created in specific project
action automated create
Imagine profil
1
ian. 17
5318
how to change the order who one2many create new records with editable=“bottom”?
one2many create record
Imagine profil
0
sept. 15
4671
On Creation Automated Action not Triggering
action automated create studio
Imagine profil
0
dec. 24
6113
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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