Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Still looking to connect the dots (Related field) need help !

Subscriure's

Get notified when there's activity on this post

This question has been flagged
v8relatedpurchase_order
3 Respostes
5627 Vistes
Avatar
Christian Parent

I am trying to get the purchase form to show my product manufacturer. I did managed to get the manufacturer code to show with :

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

I am also trying to get the manufacturer related to this manufacturer_pref.

both fields are in the product.product table, (manufacturer and manufacturer_pref). Only thing that looks to be tricky, is that manufacturer is a mny2one field taken from res.partner :

'manufacturer' : fields.many2one('res.partner', 'Manufacturer'),

I have tried many ways but still, I cannot get the "Name" of the partner to show up. I do have the integer(id) related to the partner table in the product.product table under manufacturer field. But, I cannot get it to show and or being added in the purchase.order.line tableor form/report.

Can anyone help me dig it?

0
Avatar
Descartar
Avatar
Prakash
Best Answer

just modify your comment typed code type='char' into type='many2one' Example, 'manufacturer':fields.related('product_id', 'manufacturer', type='many2one', relation='product.product', string='manufacturer', store=True); same as sudhir arya but change relation res.partner into product.product.

1
Avatar
Descartar
Stone

hi, the problem u had is caused by "relation", the field u created on product_product is many2one and the object is res.partner. So on field related in purchase.order.line, u need to link it to res.partner instead of product.product

please try this code : 'manufacturer_pref': fields.related('product_id', 'manufacturer', type="many2one", relation="res.partner", string="Manufacturer Code", store=True),

Christian Parent
Autor

Yes. finaly, Maybe we had tried this earlier but I had a typos in, fields.related('product_id', 'manufacturer', type="many2one", relation="res.partner", string="Manufacturier", store=True),

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

Hello Christian Parent,

You just have to add another related field to get manufacturer.

Here it is:

fields.related('product_id', 'manufacturer', relation='res.partner', type='many2one', string='Manufacturer')

You can get more information about related and other fields: OpenERP Fields

Hope this will help you.

1
Avatar
Descartar
Christian Parent
Autor

I am receiving File "/opt/openerp/server/openerp/osv/fields.py", line 1285, in _fnct_read value = value[field] or False File "/opt/openerp/server/openerp/osv/orm.py", line 387, in __getitem__ raise KeyError(error_msg) KeyError: "Field 'manufacturer' does not exist in object 'browse_record(purchase.order, 8)'"

When creating a new record. I will try to use existing records and add manufacturer to my view see if it at least links.

Christian Parent
Autor

I have modified the line a couple time... I am at 'manufacturer': fields.related('product_id', 'manufacturer', type="char", relation="product.product", string="Manufacturier", store=True), this at least gives me something in the DB : browse_record(res.partner, 1654) 1654 is the right manufacturer, so getting close but just not there yet !!!

Avatar
Christian Parent
Autor Best Answer

I dont know if it is the way we are doing it but, it does not seem to work. The manufacturer of the product already exist in the product.product table, it is his id number from res.partner. The things tried so far does not work, see my comment above.

Remember, I want to add the field manufacturer to purchase.order.line table. The line in this table consist of each individual product ordered in an invoice.

I have managed to add the manufacturer reference code thru :

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

So, I use the product_id from purchase_order_line which is the primary key (ID) in the table product.product. with that, I can get the manufacturer_pref which is already in the product.product table.

When I try to do similar to this for manufacturer name (manufacturer) It gives me errors.

I have all the logic :

Product_id in purchase_order_line is related to id in product.product. Each product in product.product has a field manufacturer which contains the id (Primary Key) of the res.partner table.

What I need to get in purchase_order_line is the field "name" from res.partner .... Is this more clear ?

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Related field not saving
v8 related related_fields
Avatar
Avatar
Avatar
2
d’abr. 24
9779
Send Purchase Order as CSV
v8 csv purchase_order
Avatar
Avatar
1
de març 18
4480
Void Field (product.template.seller_id) Many2one related to a One2many field
v8 one2many related
Avatar
2
de des. 15
4264
Error confirming Purchase RFQ
v8 error purchase_order
Avatar
0
de març 15
4146
Purchase order: add order line programmatically
v8 product order purchase_order
Avatar
Avatar
Avatar
2
de nov. 16
8578
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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