Skip to content

Commit 6ebd97f

Browse files
robodooOdoo Online
authored andcommitted
[MERGE] saas~16.4 fixes 🚗
Part of odoo/upgrade#5284 Signed-off-by: Christophe Simonis (chs) <[email protected]>
2 parents 48de3cc + cd690c5 commit 6ebd97f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
from odoo.addons.base.maintenance.migrations import util
3+
4+
5+
def migrate(cr, version):
6+
# The `commercial_partner_id` field is expected to always be set. Although the column is not marked as `NOT NULL`.
7+
# Fight the Murphy's Law, and recompute the value on partners with a NULL value.
8+
cr.execute("SELECT id FROM res_partner WHERE commercial_partner_id IS NULL")
9+
if cr.rowcount:
10+
util.recompute_fields(cr, "res.partner", ["commercial_partner_id"], ids=[id_ for id_, in cr.fetchall()])

0 commit comments

Comments
 (0)