Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

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

Naroči se

Get notified when there's activity on this post

This question has been flagged
automatedcreaterecordBug
2 Odgovori
2466 Prikazi
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
Opusti
Avatar
Yatrik Chauhan
Best Answer

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
Opusti
Johnny Solas
Avtor

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
Best Answer

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

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Auto generated quotation
automated create quotation record sales.order
Avatar
0
jul. 21
5525
Create co-record on create(self,vals) model
create mrp record
Avatar
Avatar
1
jan. 20
6247
Set Deadline in 14 days when task is created in specific project
action automated create
Avatar
1
jan. 17
5281
how to change the order who one2many create new records with editable=“bottom”?
one2many create record
Avatar
0
sep. 15
4651
On Creation Automated Action not Triggering
action automated create studio
Avatar
0
dec. 24
6085
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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