[19.0][MIG] im_livechat: chatbot_only_if_no_operator -> chatbot_enabled_condition#5642
Open
dnplkndll wants to merge 2 commits into
Open
[19.0][MIG] im_livechat: chatbot_only_if_no_operator -> chatbot_enabled_condition#5642dnplkndll wants to merge 2 commits into
dnplkndll wants to merge 2 commits into
Conversation
…ed_condition 19.0 replaces the boolean chatbot_only_if_no_operator on im_livechat.channel.rule with a selection chatbot_enabled_condition (values: always / only_if_no_operator / only_if_operator). Pre-migration preserves the legacy boolean via rename_columns; post-migration maps TRUE -> 'only_if_no_operator'. FALSE rows keep the default 'always' set by ORM init. Per-module tests/data_im_livechat_migration.py seeds 18.0 demo by setting the boolean TRUE on at least one rule so the migration UPDATEs fire on the OCA seed. Test asserts: at least one rule has condition='only_if_no_operator' after migration + legacy column survives for database_cleanup. Other 19.0 changes in this module are additive (new tracking fields on discuss.channel, new models im_livechat.channel.member.history / conversation.tag / expertise) or DEL leftovers (anonymous_name, livechat_active, image_128, input_placeholder) — all left to database_cleanup per pedrobaeza policy.
Self-review fixes before OCA review: - post-migration: defensive UPDATE on chatbot_enabled_condition IS NULL before the TRUE->only_if_no_operator mapping. Cheap insurance against rows that pre-date the ORM-init backfill (e.g. created via partial schema). Trim verbose docstring. - data seed: replace UPDATE-by-MIN(id) with ORM create() on the demo im_livechat.channel.rule. The original silently no-ops if no rules exist in the seed DB; explicit create() guarantees the post-migration UPDATE has rows to fire on. Drops the AI-style preamble comment.
080fc41 to
cf341e0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
19.0 replaces the boolean
im_livechat.channel.rule.chatbot_only_if_no_operatorwith a selection fieldchatbot_enabled_condition(always/only_if_no_operator/only_if_operator).Migration
openupgrade.rename_columnsto preserve the legacy boolean column past ORM init.UPDATE im_livechat_channel_rule SET chatbot_enabled_condition = 'only_if_no_operator' WHERE <legacy column> IS TRUE. FALSE rows keep the ORM-set default ofalways.database_cleanupto pick up post-migration (per pedrobaeza policy on OpenUpgrade preserving information).Test coverage
openupgrade_scripts/scripts/im_livechat/19.0.1.0/tests/test_im_livechat_migration.py:chatbot_enabled_condition='only_if_no_operator'after migrationdatabase_cleanupcan clear it)openupgrade_scripts/scripts/im_livechat/tests/data_im_livechat_migration.py— 18.0 demo seed: setschatbot_only_if_no_operator=Trueon at least one channel.rule so the post-migration UPDATE has rows to fire on.What this PR does NOT touch
Per pedrobaeza policy ("OpenUpgrade preserves information; database_cleanup handles residuals"), these 19.0 changes in
im_livechatare intentionally left alone:discuss.channel(auto-populate at ORM init)im_livechat.channel.member.history,conversation.tag,expertise(additive)anonymous_name,livechat_active,image_128,input_placeholder— left fordatabase_cleanupFork CI
Validated on fork's `Test OpenUpgrade migration` workflow (both base + enriched seeds passed): 2026-05-16T01:58Z.
docsource
docsource/modules180-190.rstupdated — `im_livechat` marked Done so OCA CI's `Test OpenUpgrade migration` job includes the module in `$MODULES_NEW`.