Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Нерухомість
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Консалтинг
    • Бухгалтерська компанія
    • Партнер Odoo
    • Агенція маркетингу
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Меблі
    • Їжа
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Системи сонячної енергії
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Інші
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Отримати демо
  • Ціни
  • Допомога

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

  • CRM
  • e-Commerce
  • Бухоблік
  • Склад
  • PoS
  • Проект
  • MRP
All apps
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

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

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
v17
1286 Переглядів
Аватар
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
Аватар
Відмінити
Enjoying the discussion? Don't just read, join in!

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

Реєстрація
Related Posts Відповіді Переглядів Дія
Ya es posible hacer Upgrade de v17 a v17.1 ?
v17
Аватар
Аватар
1
жовт. 25
1344
How to add a new Many2one field in res.config.settings? Вирішено
v17
Аватар
Аватар
Аватар
Аватар
4
жовт. 25
3764
Add field to ALL models in Odoo
v17
Аватар
Аватар
Аватар
2
вер. 25
2428
How to disable Email notification - You have been assigned to Вирішено
v17
Аватар
Аватар
Аватар
Аватар
4
вер. 25
7848
How to get the active_id from get_view function in odoo 17?
v17
Аватар
Аватар
Аватар
Аватар
Аватар
4
трав. 25
4578
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • Github
  • Runbot
  • Переклади
Послуги
  • Хостинг Odoo.sh
  • Підтримка
  • Оновлення
  • Кастомні доробки
  • Навчання
  • Знайдіть бухгалтера
  • Знайдіть партнера
  • Стати партнером
Про нас
  • Наша компанія
  • Торгові активи
  • Зв'яжіться з нами
  • Вакансії
  • Події
  • Подкаст
  • Блог
  • Клієнти
  • Юридичні документи • Конфіденційність
  • Безпека
الْعَرَبيّة 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 - це набір програм для роботи з відкритим кодом, які охоплюють всі ваші потреби компанії: CRM, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція 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