Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 5 years ago
parent
commit
4c5e136ad9
  1. 2
      muk_utils/__manifest__.py
  2. 7
      muk_utils/models/base.py

2
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",

7
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
#----------------------------------------------------------

Loading…
Cancel
Save