From bfa129c86bb4821bc58c82776c519eb20722f206 Mon Sep 17 00:00:00 2001 From: AnhBT Date: Mon, 1 Jul 2024 13:48:57 +0700 Subject: [PATCH] [FIX] base: The partner's type can't be set to 'contact' when the name is null. --- .../scripts/base/17.0.1.3/pre-migration.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openupgrade_scripts/scripts/base/17.0.1.3/pre-migration.py b/openupgrade_scripts/scripts/base/17.0.1.3/pre-migration.py index dcdcb7bb48c3..772a8e4bd188 100644 --- a/openupgrade_scripts/scripts/base/17.0.1.3/pre-migration.py +++ b/openupgrade_scripts/scripts/base/17.0.1.3/pre-migration.py @@ -123,9 +123,13 @@ def _update_partner_private_type(cr): openupgrade.logged_query( cr, """ - UPDATE res_partner - SET type = 'contact' - WHERE type = 'private' + UPDATE res_partner + SET type = CASE + WHEN name IS NOT NULL THEN 'contact' + WHEN name IS NULL THEN 'other' + ELSE type + END + WHERE type = 'private'; """, )