Skip to content

Commit

Permalink
[FIX] models: add warning for inconsistent compute_sudo on fields (#…
Browse files Browse the repository at this point in the history
…15184)

Check that fields using the same compute method have the same value for
parameter `compute_sudo`.
  • Loading branch information
rco-odoo committed Feb 24, 2017
1 parent 65c1926 commit 1f77c2d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openerp/models.py
Expand Up @@ -3077,6 +3077,11 @@ def _setup_fields(self, partial):
if field.compute:
cls._field_computed[field] = group = groups[field.compute]
group.append(field)
for fields in groups.itervalues():
compute_sudo = fields[0].compute_sudo
if not all(field.compute_sudo == compute_sudo for field in fields):
_logger.warning("%s: inconsistent 'compute_sudo' for computed fields: %s",
self._name, ", ".join(field.name for field in fields))

@api.model
def _setup_complete(self):
Expand Down

0 comments on commit 1f77c2d

Please sign in to comment.