From 533023c32d1e102a80bded4d8f5992a777474940 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 20 May 2025 14:25:02 +0200 Subject: [PATCH] [IMP] base_partner_one2many_phone: improve mig script --- .../migrations/10.0.2.0.0/post-migration.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base_partner_one2many_phone/migrations/10.0.2.0.0/post-migration.py b/base_partner_one2many_phone/migrations/10.0.2.0.0/post-migration.py index 85c1c6c..6d49abe 100644 --- a/base_partner_one2many_phone/migrations/10.0.2.0.0/post-migration.py +++ b/base_partner_one2many_phone/migrations/10.0.2.0.0/post-migration.py @@ -24,6 +24,9 @@ def migrate(cr, version): env = api.Environment(cr, SUPERUSER_ID, {}) rppo = env['res.partner.phone'] + # ondelete='cascade' was missing in previous versions + cr.execute('DELETE FROM res_partner_phone WHERE partner_id is null') + wdict = {} # key = partnerID, values = {id: {'type': '1_home', 'phone': '+33'}} for rec in rppo.search_read([('type', '!=', False)], ['type', 'phone', 'partner_id', 'note']): if rec['partner_id'][0] not in wdict: