diff --git a/muk_utils/__manifest__.py b/muk_utils/__manifest__.py index 0579639..ac9b6c8 100644 --- a/muk_utils/__manifest__.py +++ b/muk_utils/__manifest__.py @@ -16,11 +16,10 @@ # along with this program. If not, see . # ################################################################################### - { "name": "MuK Utils", "summary": """Utility Features""", - "version": '12.0.1.1.15', + "version": '12.0.1.1.16', "category": 'Extra Tools', "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_utils/models/base.py b/muk_utils/models/base.py index 8fa554d..b7f5ab1 100644 --- a/muk_utils/models/base.py +++ b/muk_utils/models/base.py @@ -78,8 +78,6 @@ class Base(models.AbstractModel): index = {vals['id']: vals for vals in result} return [index[record.id] for record in records if record.id in index] - - @api.model def _search_parents(self, domain=[], order=None): self._check_parent_field() diff --git a/muk_utils/tools/file.py b/muk_utils/tools/file.py index 13ab100..f9a0f5e 100644 --- a/muk_utils/tools/file.py +++ b/muk_utils/tools/file.py @@ -45,6 +45,16 @@ def slugify(value): value = str(re.sub('[-\s]+', '-', value)) return value +def check_name(name): + tmp_dir = tempfile.mkdtemp() + try: + open(os.path.join(tmp_dir, name), 'a').close() + except IOError: + return False + finally: + shutil.rmtree(tmp_dir) + return True + def compute_name(name, suffix, escape_suffix): if escape_suffix: name, extension = os.path.splitext(name)