Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Trying to get manufacturer,(partner name) getting TypeError: string indices must be integers

Odoberať

Get notified when there's activity on this post

This question has been flagged
v8pythonpostgresql
5955 Zobrazenia
Avatar
Christian Parent

I have managed to get the manufacturer product code into purchase order line, now, I would like to add the manufacturer name which is a many2one field. I have tried :

'manufacturer' : fields.related('manufacturer_pref','manufacturer',type="many2one", relation="res.partner", string="Manufacturer",store=True),

but I am getting TypeError: string indices must be integers.

anyone can point me out in the right direction ?

0
Avatar
Zrušiť
Jagdish Panchal

Have you define manufacturer_pref field in this object ?

Christian Parent
Autor

Yes, on the line just above:

'manufacturer_pref': fields.related('product_id', 'manufacturer_pref', type="char", relation="product.product", string="Manufacturer", store=True),
Jagdish Panchal

Hi tyr this 'manufacturer' : fields.related('manufacturer_pref','manufacturer',type="char", string="Manufacturer",store=True),

Christian Parent
Autor

wait, I have deleted the column manufacturer from db, Created a new line, no errors but no data for manufacturer, will tell you more in a sec as I just have restarted !

Jagdish Panchal

value of manufacturer_pref this field come in to manufacturer ? if there is value in manufacturer_pref then manufacturer field have value.

Christian Parent
Autor

No finaly, still getting TypeError: string indices must be integers

Christian Parent
Autor

both manufacturer_pref and manufacturer are from product.product table, only thing is that manufacter is the id number from res_partner table.

Jagdish Panchal

Then define many2one with res_partner

Christian Parent
Autor

I have tried it, did not work, may be I defined it wrong, will give it another try. If I put it in words, it would be:

I have an order line which has 1 product. I get the manufacturer_pref of that object from product.product table I need the name of the manufacturer of the manufacturer_pref from the table res.partner.

So the product 1482010000 (id 25781 in product_product) has a manufacturer "id 1654". In res.partner, id 1654 "Name" field is Micro Commercial Component <---- This is what I want to get in my field manufacturer in purchase.order.line.

Is that making more sense ?

Jagdish Panchal

'partner_id' : fields.many2one('res.partner', 'Partner',),

'manufacturer' : fields.related('partner_id','manufacturer' ,type="char", relation="res.partner", string="Manufacturer",store=True),

Christian Parent
Autor

Already had an object partner_id in that object that was causing a conflict, I have modified your lines to avoid conflicts.

        'manufacturer_id': fields.many2one('res.partner', 'ManufacturerID',),
    'manufacturer' : fields.related('manufacturer_id','manufacturer' ,type="char", relation="res.partner", string="Manufacturer",store=True),

I dont get errors anymore but, the manufacturer name still not showing up. when looking in the table with pgadmin3, the line gets value for every fields except manufacturer_id and manufacturer.

Christian Parent
Autor

Thing I dont get in your code, since I am only typing the default_code (from product_product table), and it has to gather the rest, where do you make the link between my product on that line, it's manufacturer(id) in product.product and the name in res.partner.

to be clear in my question, to get the manufacturer_pref, I had to tell him to use the product_id and get it's manufacturer_pref in product.product.

'manufacturer_pref': fields.related('product_id', 'manufacturer_pref', type="char",  relation="product.product", string="Manufacturer", store=True),

(follow)

Christian Parent
Autor

So, to get my manufacturer, I would need to use the product_id, get the manufacturer field in product.product (which has the id of the partner) and link id the the field name in res_partner table ?

Jagdish Panchal

'manufacturer' : fields.related('manufacturer_id','manufacturer' ,type="char", string="Manufacturer",store=True),

Christian Parent
Autor

Same behavior, but, should the manufacturer_id be the one from product_product table something in the line of

'manufacturer_id': fields.related('product_id', 'manufacturer', type="char",  relation="product.product", string="Manufacturer", store=True),

which would give the manufacturer id for that product then, we could link it to res.partner name field ?

Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
modulo no crea tabla en postgresql odoo 17
python postgresql
Avatar
Avatar
Avatar
2
máj 24
2251
Error On Change Method
python postgresql
Avatar
Avatar
Avatar
2
mar 15
6660
Error Report: Odoo 17 Installation Issue
python postgresql odoo17
Avatar
0
aug 24
2612
i want write a script that when i select table name the related column name of the table is show in the drop down in odoo Solved
python postgresql odoo16features
Avatar
Avatar
1
mar 23
3067
Creating many records in a loop sometimes does not work
v8 create postgresql
Avatar
Avatar
2
mar 20
5548
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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