Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Create Entry with specific XMLID in code.

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
xml_idtesting
2 Răspunsuri
4618 Vizualizări
Imagine profil
Nikolaus Weingartmair

I would like to create an entry (In this case for a test) but I want to use it with a specific XMLID which is used in another module. Is it possible to change the xml ID after the creation of the entry within the code. The second party module can or can not be installed.

The background is that I want to test it with and without other modules installed. As env.ref("XXXX") is used I need it to have a specific name.

So solutions with entries in the data folder or exporting with a random name are not applicable.

0
Imagine profil
Abandonează
Imagine profil
CandidRoot Solutions Private Limited
Cel mai bun răspuns

Hello,

In Odoo, External Identifiers (also known as XML IDs) are stored in the ir.model.data table.
This table acts as a central registry for mapping these human-readable string identifiers to their corresponding database record IDs.

Key Points:

  • Purpose: External IDs serve several crucial functions:
    • Data Import/Export: They simplify data exchange with external systems and between Odoo databases. You can reference records by their external IDs during import, allowing Odoo to efficiently create or update existing records.
    • Code Referencing: Developers can use external IDs in Python code to effortlessly access specific records without relying on internal database IDs. This enhances code readability and maintainability.
  • Generation:
    • Manual: You can define external IDs explicitly during data import using XML files. This grants you more control over record identification.
    • Export: During data export using XML files, Odoo automatically generates external IDs for the exported records if they weren't already defined.

Modification:

  • Recommended Approach: If you need to change an external ID, it's recommended to:
    1. Identify the Record: Go to Settings --> Technical --> Sequences & Identifiers --> External Identifiers
       Use the ir.model.data model's search methods or Odoo's developer tools to locate the record associated with the specific external ID you want to modify.

Thanks & Regards,

​


CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209

Email: info@candidroot.com

 


0
Imagine profil
Abandonează
Richard

The request was "in code", not through UI.

Imagine profil
Niyas Raphy (Walnut Software Solutions)
Cel mai bun răspuns

Hi,

Yes you can create a record with specify external id by passing value in the id column during the import of data. Or even from the python side, the external id is stored in a db table, you can see all the external id's from the External Identifiers menu under settings -> technical

So yes, programticaly it is possible to change the external id

Thanks

0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Odoo v11.0 testing
testing
Imagine profil
0
aug. 21
4
What does %(other_module.xml_id)d do?
xml_id
Imagine profil
Imagine profil
Imagine profil
2
mai 18
10568
How do I remove/undo/adjust/avoid a test transaction that I completed in a live database?
testing
Imagine profil
Imagine profil
3
mai 18
5603
database for production /tests
testing website
Imagine profil
Imagine profil
1
nov. 25
266
Feature Flag and its use in Software Testing
testing software
Imagine profil
0
iun. 25
3656
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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