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

What is the recommended practice when updating models fieds ?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
updateodooV8schemaORM
2 Respostes
4229 Vistes
Avatar
Paraita Wohler

We are using Odoo v8 and we'd like to improve the deployment of our in-house modules into production.

What are the good practices when upgrading custom modules ? At the moment we copy the latest version of the module into the addons folder, and trigger the update of the said module from the web interface (I do restart the server whenever it's required).

I forsee problems when I'm going to update existing (stored) fields in some of my models. I understand the Odoo ORM is going to create new storable fields but it doesn't have any clue if the new field comes from a renamed field or if it's a legit new field, so in the end we have to update our tables and move the values of the old field columns to the new field columns.

At the moment we tend to avoid modifying existing fields of our modules, as renaming those would make them appear empty on the user side (thank god Odoo doesn't drop non used columns).

With Hibernate (Java) it's possible to use different ddl strategies so the update of the schema is either the ORM's responsibility or the DBA's. Hibernate recommends the latter, because the update is more predictable. Is there a similar mechanism with Odoo ?

1
Avatar
Descartar
Paraita Wohler
Autor

up !

Avatar
Mohammed Rida Yahla
Best Answer

Hi,

When you get a new stored field after renaming the old one, you can pass the values from the old field to the new using a SQL commande in PGAdmin database (and after that you can drop the old if you want), in condition both of the new and old fields have compatible types (CHAR -> CHAR ...), otherwise you will have to use SQL converting functions.

For example let say you have a Char field named "description" in the model "My_model", and you want to rename it as "features":

To pass the old values from "description" column to the new "features", you have to run this sql query in postegres (PGAdmin):

update My_model set   features = description where features ='';

And by this you can merge the old values without losing the new ones.

Please Vote if you find my answer usefull.

1
Avatar
Descartar
Paraita Wohler
Autor

Thank you for your answer :) that's exactly what we are doing at the moment but as a control gate we'd like to prevent Odoo's ORM to "update" the database schema automatically so that changes like moving values from the old column to the new one become more explicit (which is good for maintainability). The trade-off in doing so is that we'd have to manually alter tables for Odoo's ORM to accomodate with its models, which can be acceptable in our case.

In the Java world, ORMs like Hibernate have such features (you can have a look at the hibernate.hbm2ddl.auto parameter in https://docs.jboss.org/hibernate/orm/5.0/manual/en-US/html/ch03.html). SQLAlchemy also have such feature through its Alembic tool.

Do you think there is a similar feature with Odoo ?

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
Why odoo want to delete some items when update all module ? Solved
update odooV8
Avatar
Avatar
10
de maig 20
9699
How to start server with --update all
update odooV8
Avatar
Avatar
1
de gen. 16
7224
Developing new modules, KeyError: 'stock.picking' return self.models[model_name] Solved
module update odooV8
Avatar
Avatar
1
de gen. 25
24619
updating module from command line error
update postgresql9.2 odooV8
Avatar
Avatar
1
de maig 21
6595
Odoo v8 still good for use?
update odooV8 odoo9.0
Avatar
Avatar
Avatar
Avatar
5
de gen. 17
5271
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