Browse Source
Merge pull request #1231 from bealdav/patch-5
FIX remove old api parameters in base_exception
pull/1091/head
Pedro M. Baeza
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
13 additions and
6 deletions
-
base_exception/README.rst
-
base_exception/models/base_exception.py
|
|
@ -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 |
|
|
|
------ |
|
|
|
|
|
|
|
|
|
@ -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 |
|
|
@ -161,18 +163,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): |
|
|
|