| Age | Commit message (Collapse) | Author |
|
Raphael Collet
|
|
and use it to determine if the constraint definition was changed. This prevents
endless readding of constraints that are reformatted by postgresql in an
unrecognizable way (in which e.g. "CHECK (credit*debit=0)" becomes
"CHECK ((credit * debit) = 0::numeric)")
|
|
|
|
This allow the use of tables defined in other schemas, like `domains`,
already defined in `information_schema`.
See #16651
|
|
|
|
|
|
|
|
At the end of registry loading, a check is made on every model to
verify its table exists in the database. Materialized views weren't
considered during this check.
Note that we can't use `information_schema` views in this case because
it does include materialized views on purpose [1].
Forward-port of 4ca6945256f9353ab7f9633552872fd1fa7fdaca
[1] http://www.postgresql-archive.org/Materialized-views-don-t-show-up-in-information-schema-tp5822643p5822644.html
|
|
Avoid `SELECT *` on `information_schema.columns` because specific access
right restrictions in the context of shared hosting (Heroku, OVH, ...)
might prevent a postgres user to read this field.
|
|
|
|
Before this revision, this is not possible to create a model
with a `_table` set to `domains`, for instance.
|
|
Problem: the update of custom models/fields is not fully transactional, and may
potentially lead to an inconsistent database. An other problem is creating two
custom fields by writing on a model: if the second one fails, the first one has
been committed without notice. Retrying the request will give an unexpected
error (duplicate field name).
Solution: never commit in the middle of a request. If the changes have an
impact on the registry, then mark it as invalid (with a new flag), and signal
registry invalidation after everything has been committed. If the request
fails, reset the registry. Both registry and cache invalidation are handled
the same way.
|
|
|
|
|
|
|
|
|
|
This helps factoring out a certain number of similar queries, and removing a
few methods from `BaseModel`.
|
|
The dictionary `_group_by_full` is replaced by a field parameter `group_expand`
that is assigned to the method name. The API of the method has been simplified
as well:
@api.multi
def _read_group_stage_ids(self, domain, read_group_order=None, access_rights_uid=None):
# the stages are given by self.ids (wrong model);
# read_group_order is the order given to read_group() on self;
# return stages.name_get(), {stage.id: stage.fold)
_group_by_full = {'stage_id': _read_group_stage_ids}
is now written:
stage_id = fields.Many2one(..., group_expand='_read_group_stage_ids')
@api.model
def _read_group_stage_ids(self, stages, domain, order):
# stages is a recordset;
# order is the order to use on stages' model;
# return a recordset which is a superset of stages
|
|
|