Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

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

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
v8pythonpostgresql
5950 Widoki
Awatar
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
Awatar
Odrzuć
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 ?

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
modulo no crea tabla en postgresql odoo 17
python postgresql
Awatar
Awatar
Awatar
2
maj 24
2250
Error On Change Method
python postgresql
Awatar
Awatar
Awatar
2
mar 15
6660
Error Report: Odoo 17 Installation Issue
python postgresql odoo17
Awatar
0
sie 24
2611
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 Rozwiązane
python postgresql odoo16features
Awatar
Awatar
1
mar 23
3066
Creating many records in a loop sometimes does not work
v8 create postgresql
Awatar
Awatar
2
mar 20
5545
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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