[FIX] models: check harder that default value is not NULL before setting it
authorOlivier Dony <odo@openerp.com>
Thu, 24 Jul 2014 10:22:20 +0000 (12:22 +0200)
committerOlivier Dony <odo@openerp.com>
Thu, 24 Jul 2014 13:47:34 +0000 (15:47 +0200)
commit6d2fb3e3ae326e7ed5b7f28c1833932d27e68054
treec6b48a52506e4f54e90d3c9a397c008f566cbdf4
parenteb08c12b090dc03f039f3a73020a97a1cead3b37
[FIX] models: check harder that default value is not NULL before setting it

When computing defaults we may end up with
a falsy value that is not None (e.g. '' or False)
That value will be cast to None when being
saved in the database, depending on the column type
(e.g. saving False on a many2one actually stores NULL).

Improve the test to consider the value being written
*after* that conversion, to *really* avoid nonsensical
and expensive queries such as:

    UPDATE table set col = NULL WHERE col IS NULL;
openerp/models.py