From 4c5e136ad95cf777006aa7cb9aef9e25c375d4bf Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Sat, 19 Jan 2019 15:06:41 +0000 Subject: [PATCH] publish muk_utils - 12.0 --- muk_utils/__manifest__.py | 2 +- muk_utils/models/base.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/muk_utils/__manifest__.py b/muk_utils/__manifest__.py index 3ce9ea6..a90dfc3 100644 --- a/muk_utils/__manifest__.py +++ b/muk_utils/__manifest__.py @@ -19,7 +19,7 @@ { "name": "MuK Utils", "summary": """Utility Features""", - "version": '12.0.1.4.12', + "version": '12.0.1.4.13', "category": 'Extra Tools', "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_utils/models/base.py b/muk_utils/models/base.py index 07f5751..b959de9 100644 --- a/muk_utils/models/base.py +++ b/muk_utils/models/base.py @@ -34,16 +34,21 @@ class Base(models.AbstractModel): # Helper Methods #---------------------------------------------------------- + @api.model def _check_parent_field(self): if self._parent_name not in self._fields: raise TypeError("The parent (%s) field does not exist." % self._parent_name) - + @api.model def _build_search_childs_domain(self, parent_id, domain=[]): self._check_parent_field() parent_domain = [[self._parent_name, '=', parent_id]] return expression.AND([parent_domain, domain]) if domain else parent_domain + @api.model + def _check_context_bin_size(self, field): + return any(key in self.env.context for key in ['bin_size', 'bin_size_%s' % (field)]) + #---------------------------------------------------------- # Security #----------------------------------------------------------