Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

What is the Best Way to Migrate Data in a Custom Module?

Naroči se

Get notified when there's activity on this post

This question has been flagged
importmigration
1 Odgovori
7228 Prikazi
Avatar
Tyler K

I am doing a migration for a custom module that involves a significant schema change (e.g., merging tables together). I exported the data from the old version module of the module, processed it to match the new schema, and am now trying to figure out how to import it. I am curious if there is a suggested best way to solving this kind of problem. Based off of my current understanding, I have the following options.

  • Import via csv.

    • I actually tried this, but ran into an issue with not being able to import readonly fields. I can get past this by making these fields editable but I like to use the readonly attribute for fields that should only be set programmatically. I suppose I could just make the fields readonly in the view and not on the model, but I would prefer to set this on the model if possible.

  • Import via module data.

    • I assume importing data this way would bypass the readonly field restriction, but I am unsure how it would handle conversions. I have a binary field that when exported as csv is Base64 encoded and am not sure if it would properly decode that data when reading it from an xml file.

  • Import via Odoo migration script.

    • Seems like this option would require installing the old version alongside the new version and mapping data from the old models to the new models, which seems a bit clumsy.

  • Import via sql script.

    • This would certainly bypass all restrictions placed by the framework, but seems a little dangerous. If my assumption is correct, when importing data via any of the above methods the ORM is used to create your database records, which means all validation and/or computed properties will be properly processed. Thus it seems like importing data should probably go through the ORM.

0
Avatar
Opusti
Avatar
Ray Carnes (ray)
Best Answer

I would use module data.

You can copy the CSV  Base64 encoded string from the image field and use it directly in an XML file, like this:

<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record model="res.partner" id="1">
<field name="name">Odoo</field>
<field name="image_1920">iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAMAAAAL34HQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAAIdae4dcfYhae4lbfIldf4pefYpggIxhgo1igI9lhI9nhJBnhZJph5Vui5dwjJhwjZlxj5t1kZp2kJt3kZx1kp13k6F+maOAmaOCm6SCm6SCnKeIn6mHn62Npa2PpK6Ppa+Rp7KWq7OWrLWarbearrecr7qhs72jt76kt7+nub+ousCou8Cqu8GqvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHtU8wYAAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4xLjb9TgnoAAAFMElEQVR4Xs2c6ULqMBCFe0HcUNwBtSooiPv7v503bU+lLZnMpE3b+X4VnJwcS5s9iX6bs1o+zKeT8Wg0nkznD8sVvm5CI1ubeDL8Z2U4iTcIqkVtW+tzOHBwvkawN7VsvV0hXwFXb0jkRQ1bU2QoZoqEHvjaigfIy4tBjORS/GydIJsanEBChoetn2PkUJPjHwgJENt6P4J6A47eIcYitXUA5YYcQI5DZusCqgG4gKQbia0lFAOxhKwLga1DyAXjEMIOWFv30ArKPcRJOFsNSioXXCnmtvVFNBCaM/xCFnactm6h0Qq3yMSKy9YpBFriFNnYcNgK/gZWcbyRtK0RErfICFntQtqq1YDxZYDMdiBsfSNd63wjwwp2W525onzZbSFJJyDLMlZbnTxXOdbny2arg3ewiO19tNhqvbyqYim/dm21XLbb2C3vd2y1Wg9S7NSPVVufCOyYT2SfU7XVWkvGzRDZ51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W4yFTYkQ2Ft8lpteZb2zUCWZey2lG73Vro53tBJcU92pUhbXbyPdMeTtqX0mAqth3poPQLFtCdae/CH1Q3eZdy2lB6vY/Deai2hvInaAmurhTfS8QbmCGwpPejKoPJYsASVh6gZdB45Z1B5QF9Kg1KMK6nK+NlSevhjisajMlNUHiyasRYM0551ewxrjsJDawusFvEsP+J3Fi+aH/H7+/sfvHHUffPHK6UAAAAASUVORK5CYII=</field>
</record>
</odoo>
This imports a Contact like this:

​

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

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Odoo 18: Cannot import DB dump from cloud installation into a fresh on-prem installation
import database migration
Avatar
Avatar
1
sep. 25
847
Issue with import and comma in Excel File (odoo 19)
import
Avatar
0
sep. 25
234
Importacion de Atributos y Valores
import
Avatar
Avatar
Avatar
2
maj 25
2246
Import from Winbooks Solved
import
Avatar
Avatar
Avatar
Avatar
Avatar
4
maj 25
6605
odoo module migration from version 14 to 16 Solved
migration
Avatar
Avatar
1
maj 25
2990
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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