Skip to content

Commit bfa129c

Browse files
anhbtitphamgiang2510
authored andcommitted
[FIX] base: The partner's type can't be set to 'contact' when the name is null.
1 parent 853f6bb commit bfa129c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

openupgrade_scripts/scripts/base/17.0.1.3/pre-migration.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,13 @@ def _update_partner_private_type(cr):
123123
openupgrade.logged_query(
124124
cr,
125125
"""
126-
UPDATE res_partner
127-
SET type = 'contact'
128-
WHERE type = 'private'
126+
UPDATE res_partner
127+
SET type = CASE
128+
WHEN name IS NOT NULL THEN 'contact'
129+
WHEN name IS NULL THEN 'other'
130+
ELSE type
131+
END
132+
WHERE type = 'private';
129133
""",
130134
)
131135

0 commit comments

Comments
 (0)