Skip to content
Permalink
Browse files

TEST

  • Loading branch information
Feyensv committed Mar 25, 2020
1 parent 24e549d commit 903be7923bcc77aa7487e66d15c2726d4a3cbe89
Showing with 8 additions and 1 deletion.
  1. +4 −1 odoo/fields.py
  2. +4 −0 odoo/modules/registry.py
@@ -896,7 +896,10 @@ def update_db_notnull(self, model, column):
model.flush([self.name])

if self.required and not has_notnull:
model.pool.post_constraint(sql.set_not_null, model._cr, model._table, self.name)
model.pool.post_constraint(
sql.set_not_null, model._cr, model._table,
self.name, postpone=bool(self.compute)
)
elif not self.required and has_notnull:
sql.drop_not_null(model._cr, model._table, self.name)

@@ -311,6 +311,10 @@ def post_init(self, func, *args, **kwargs):

def post_constraint(self, func, *args, **kwargs):
""" Call the given function, and delay it if it fails during an upgrade. """
postpone = kwargs.pop("postpone", False)
if postpone:
self._constraint_queue.append(partial(func, *args, **kwargs))
return
try:
func(*args, **kwargs)
except Exception as e:

0 comments on commit 903be79

Please sign in to comment.
You can’t perform that action at this time.