Browse Source

FIX remove old api parameters in base_exception

pull/1231/head
David Beal 6 years ago
parent
commit
688c3cbb2e
  1. 5
      base_exception/README.rst
  2. 14
      base_exception/models/base_exception.py

5
base_exception/README.rst

@ -28,6 +28,11 @@ server-tools/issues/new?body=module:%20
base_exception%0Aversion:%20
10.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Roadmap
-------
Terms used in old api like `pool`, `cr`, `uid` must be removed porting this module in version 12.
Images
------

14
base_exception/models/base_exception.py

@ -56,7 +56,9 @@ class ExceptionRule(models.Model):
# base.exception line (ex rule_group = sale for sale order)
# - object: same as order or line, browse_record of the base.exception or
# base.exception line
# - pool: ORM model pool (i.e. self.pool)
# - pool: ORM model pool (i.e. self.pool, deprecated in new api)
# - obj: same as object
# - env: ORM model pool (i.e. self.env)
# - time: Python time module
# - cr: database cursor
# - uid: current user id
@ -160,18 +162,18 @@ class BaseException(models.AbstractModel):
@api.model
def _exception_rule_eval_context(self, obj_name, rec):
user = self.env['res.users'].browse(self._uid)
return {obj_name: rec,
'self': self.pool.get(rec._name),
'object': rec,
'obj': rec,
'pool': self.pool,
'cr': self._cr,
'uid': self._uid,
'user': user,
'env': self.env,
'cr': self.env.cr,
'uid': self.env.uid,
'user': self.env.user,
'time': time,
# copy context to prevent side-effects of eval
'context': self._context.copy()}
'context': self.env.context.copy()}
@api.model
def _rule_eval(self, rule, obj_name, rec):

Loading…
Cancel
Save