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

Odoo v15: XMLRPC changed 'get_object_reference' shortcut to '_xmlid_lookup'

Subscriure's

Get notified when there's activity on this post

This question has been flagged
xmlrpcversionsmethodsir.model.data
2 Respostes
7635 Vistes
Avatar
Carlos Enrique

Hello, I need help to understand what has happened in Odoo v15 regarding the 'get_object_reference' method call is now called '_xmlid_lookup'


modifying my migration compiler when I use that method I can't call '_xmlid_lookup' because it is private


Is there another way to get to use the equivalent of self.env.ref('') but for XMLRPC?


In Odoo V13 and Odoo V14 I used:

self.ServerProxyObjects.execute_kw('db', '4', '12345','ir.model.data', 'get_object_reference', ['base.USD'])


In Odoo v15 would be similar:

self.ServerProxyObjects.execute_kw('db', '4', '12345','ir.model.data', '_xmlid_lookup', ['base.USD'])


But _xmlid_lookup is private, result in console:

xmlrpc.client.Fault:xmlrpc.client.Fault: Fault 4: 'Private methods (such as _xmlid_to_res_id) cannot be called remotely


2
Avatar
Descartar
Avatar
Carlos Enrique
Autor Best Answer

I found the solution, reviewing the odoo source code I could see that the check_object_reference method does the same thing by calling the _xmlid_lookup method in v15 and in v13 and v14 get_object_reference, so this method would only be called and returns what is desired for all those versions, I will close my question since I found the solution.

4
Avatar
Descartar
Kilian Melcher

Worked for me! thanks a lot.

Avatar
Jugert Mucoimaj
Best Answer

Hello bro, I needed to do the same thing. Although I'm getting a strange error. When I give two args it says me "3 were given" when I add only one it says "it needs two but 1 were given." how to solve this?


Thanks

0
Avatar
Descartar
Carlos Enrique
Autor

Hello bro,
in v13 to reference a record stored in the db in odoo via XMLRPC, internally odoo has this method

odoo>addons>base>models>ir_model.py line:1728 - 1744

@api.model
def get_object_reference(self, module, xml_id):
"""Returns (model, res_id) corresponding to a given module and xml_id (cached) or raise ValueError if not found"""
return self.xmlid_lookup("%s.%s" % (module, xml_id))[1:3]

which one can call internally via a module like this:

self.env['ir.model.data'].get_object_reference('base_setup', 'action_general_configuration')

with XMLRPC I can call it like this by calling the method that wraps the other called method (check_object_reference) and sending this data

from xmlrpc import client as xmlrpclib
xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format('url')).execute_kw(db, uid, password,
'ir.model.data', 'check_object_reference',
['base', 'user_admin']
)
note: if you want to search for a xml record like 'base.user_admin' you have to send it separately --> 'base', 'user_admin'

which would give you an output in an array with a dictionary of the id number and the model
example: [(1, 'res.partner')] - something like this

I hope my explanation has helped you, if you still have problems tell me the source code maybe it will solve it

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
Odoo v15: XMLRPC changed 'get_object_reference' shortcut to '_xmlid_lookup'
xmlrpc ir.model.data v15
Avatar
Avatar
1
de nov. 22
4775
export record programmatically, session_id mssing Solved
export session xmlrpc session_id ir.model.data
Avatar
1
d’abr. 16
5474
xmlrpc Error when attempting to connect to my local instance Solved
xmlrpc
Avatar
Avatar
Avatar
3
de jul. 25
4250
Cannot marshal None unless allow_none is enabled
xmlrpc
Avatar
1
d’oct. 24
3103
How to run a method from external api as the superuser
xmlrpc
Avatar
Avatar
1
d’abr. 24
3163
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