The rule may depend on indirect field written latter so it must be checked
after the storage of those fields.
On write, the rule must be checked before the modification but also after to
ensure users do not generate records that they can not modify after.
issue7403
review53301002
The exception message could contain non-ASCII errors for which standard
__str__ may fail, but as the database should always be in UTF-8 we may except
that unicode will not fail.
issue6128
review43971002
The call to Translation.delete_ids has a cost as it does search queries. So it
is better to not call it if we already know that there is nothing to delete.
issue7118
review37981003
This prevent to fill the cache of the instances created with wrong values for
left/right fields. And it ensure that the validation code has valid MPTT
values.
issue6591
review34211002
Some back-ends have constraint on the length of data name, they usually
silently truncate them, but this can create collision. The solution is to hash
the name when it is too long.
issue4620
issue6494
review37381003
There is no guarantee that the method will not raise a database error on the
first registration because it can rely on other tables being registered.
So the method must be called only when needed. This is when the table already
exists and has records. In this case other tables also already exist.
issue6409
The test was using the field name instead of the field instance.
It is better to keep the usual convention of using fname for name and field for
the instance.
issue6208
review33011002
We create the foreign table if needed before adding the foreign key constraint,
thus it is no more needed to order the registration of the ModelSQL.
issue5682
review32841002
The method is often called under a new transaction so the created/deleted
records properties are cleared which makes it raises the wrong message if the
foreign key was created during the same transaction.
issue6038
review29781002
id is an Integer field which does not cast to int the values in the opposite of
Many2One which could receive an record instance.
issue6068
review31751003
Badly written getter could return more values than requested. This can corrupt
the browse cache as it only filter on requested fields.
issue5805
review21221002
Two options are added on Binary field to define the column to use to store the
filestore id and the prefix to use.
Those options are used for Attachment and are configurable with conservative
default values.
issue5692
review25471003
Indeed we should count the number of nodes updated instead of the number of
queries.
rebuild: 1 write and 1 select on each node
update: (1 write + 3 select + 2 write on average ½ all nodes + 1 write on child
of id) on each ids
So the threshold is:
2 * count < (4 + 2 * count / 2 + 1 * x) * len(ids)
2 * count < (4 + count + x) * len(ids)
which can be approximated to
2 * count < count * len(ids)
2 < len(ids)
issue5399
review20861002
We need to loop to compare the values instead of using a dictionary because the
values are not necessary hashable. But it is still an improvement compared to
calling the set method for each record.
issue5398
review19111002
default values should be constant during the create transaction so we could
cache the result and avoid query it for each created record.
issue5397
review16121002