Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

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

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
v8pythonpostgresql
5972 Tampilan
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
Buang
Jagdish Panchal

Have you define manufacturer_pref field in this object ?

Christian Parent
Penulis

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
Penulis

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
Penulis

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

Christian Parent
Penulis

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
Penulis

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
Penulis

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
Penulis

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
Penulis

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
Penulis

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 ?

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
modulo no crea tabla en postgresql odoo 17
python postgresql
Avatar
Avatar
Avatar
2
Mei 24
2255
Error On Change Method
python postgresql
Avatar
Avatar
Avatar
2
Mar 15
6667
Error Report: Odoo 17 Installation Issue
python postgresql odoo17
Avatar
0
Agu 24
2620
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 Diselesaikan
python postgresql odoo16features
Avatar
Avatar
1
Mar 23
3075
Creating many records in a loop sometimes does not work
v8 create postgresql
Avatar
Avatar
2
Mar 20
5556
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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