Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Selection Field Options Disappear from Database (PostgreSQL enum) on Module Upgrade

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
v17
1273 Tampilan
Avatar
Xi Ansen

Hello Odoo Community,

I'm encountering a very strange issue in Odoo 17 regarding a Selection field that loses its options in the database schema under specific upgrade scenarios. I would appreciate any insights or suggestions.

My Goal & Implementation

My goal is to add a consistent workflow state field (kanban_state) to many models that already use mail.thread and mail.activity.mixin (like sale.order, purchase.order, etc.).

To avoid creating a new mixin and manually adding it to dozens of models, I chose to inherit the core mail.activity.mixin and inject my new field there. This way, any model that is "chatter-enabled" automatically gets my workflow capabilities.

Here is the code for my mixin:

code

Python

# In my custom module: my_workflow_mixin/models/mail_activity_mixin.py


from odoo import fields, models


class MailActivityMixin(models.AbstractModel):

_name = 'mail.activity.mixin'

_inherit = 'mail.activity.mixin'

_description = 'Enhance native Activity Mixin with workflow capabilities'


kanban_state = fields.Selection([

('draft', 'Draft'),

('to_approve', 'To Approve'),

('approved', 'Approved'),

('rejected', 'Rejected')

], string='Kanban State', default='draft', tracking=True, copy=False,

help="A visual state field for use in kanban views and status bars.")

The Strange Problem

The issue arises with models that inherit this mixin, for example, sale.order.

Initial State: After installing my module (my_workflow_mixin), everything works correctly. The kanban_state field appears in the sale.order model, and in the PostgreSQL database, the sale_order table has a kanban_state column with the correct enum type and its four defined options.

Problem Occurs: After a server restart and an upgrade of another module (or sometimes after just upgrading my own module again after making a small change), I find that the selection options for kanban_state have disappeared from the sale_order table in the database. When I inspect the column type in PostgreSQL, the enum is empty. This causes errors in the UI as the values no longer match a valid selection.

Temporary Fix: If I run a full database update for all modules using the command line: ./odoo-bin -u all -d my_database, the selection options reappear correctly in the database schema for the sale_order table. The enum is repopulated.

Problem Reappears: However, if I then make a change to my my_workflow_mixin module and upgrade only this module (./odoo-bin -u my_workflow_mixin -d my_database), the problem comes back! The selection options are once again wiped from the sale_order table's enum type.

My Hypothesis and Questions

It seems like the module loading order and the scope of the update (-u my_module vs. -u all) are causing the Odoo ORM to incorrectly update the PostgreSQL enum type. When only my module is updated, the ORM seems to forget that other models like sale.order depend on this modified mixin, and it fails to propagate the schema changes correctly. The -u all command forces a re-evaluation of the entire model registry in the correct dependency order, which fixes it temporarily.

Has anyone encountered this behavior before?

Is inheriting a core Odoo mixin like mail.activity.mixin to add fields considered bad practice, and could it be the root cause of these ORM inconsistencies?

Is this a potential bug in the Odoo 17 ORM regarding how it handles schema updates for inherited models?

Any help would be greatly appreciated. Thank you!


0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Ya es posible hacer Upgrade de v17 a v17.1 ?
v17
Avatar
Avatar
1
Okt 25
1323
How to add a new Many2one field in res.config.settings? Diselesaikan
v17
Avatar
Avatar
Avatar
Avatar
4
Okt 25
3721
Add field to ALL models in Odoo
v17
Avatar
Avatar
Avatar
2
Sep 25
2396
How to disable Email notification - You have been assigned to Diselesaikan
v17
Avatar
Avatar
Avatar
Avatar
4
Sep 25
7786
How to get the active_id from get_view function in odoo 17?
v17
Avatar
Avatar
Avatar
Avatar
Avatar
4
Mei 25
4556
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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