diff --git a/muk_converter/__manifest__.py b/muk_converter/__manifest__.py index 97683a8..ff349d5 100644 --- a/muk_converter/__manifest__.py +++ b/muk_converter/__manifest__.py @@ -20,7 +20,7 @@ { "name": "MuK Converter", "summary": """Universal Converter""", - "version": '11.0.1.1.4', + "version": '11.0.1.1.5', "category": 'Extra Tools', "license": "AGPL-3", "website": "https://www.mukit.at", @@ -31,12 +31,14 @@ ], "depends": [ "muk_utils", + "muk_autovacuum", "muk_fields_lobject", ], "data": [ "security/ir.model.access.csv", "views/convert.xml", "data/params.xml", + "data/autovacuum.xml", ], "qweb": [ "static/src/xml/*.xml", diff --git a/muk_converter/data/autovacuum.xml b/muk_converter/data/autovacuum.xml new file mode 100644 index 0000000..297b5da --- /dev/null +++ b/muk_converter/data/autovacuum.xml @@ -0,0 +1,32 @@ + + + + + + + + Delete all converted files that exceed the store size + size + + parameter + + used_date desc + + + + \ No newline at end of file diff --git a/muk_converter/models/__init__.py b/muk_converter/models/__init__.py index 98523d6..7b5786b 100644 --- a/muk_converter/models/__init__.py +++ b/muk_converter/models/__init__.py @@ -18,5 +18,4 @@ ################################################################################### from . import converter -from . import store -from . import ir_autovacuum \ No newline at end of file +from . import store \ No newline at end of file diff --git a/muk_converter/models/ir_autovacuum.py b/muk_converter/models/ir_autovacuum.py deleted file mode 100644 index d48832a..0000000 --- a/muk_converter/models/ir_autovacuum.py +++ /dev/null @@ -1,29 +0,0 @@ -################################################################################### -# -# Copyright (C) 2018 MuK IT GmbH -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -################################################################################### - -from odoo import api, models - -class AutoVacuum(models.AbstractModel): - - _inherit = 'ir.autovacuum' - - @api.model - def power_on(self, *args, **kwargs): - self.env['muk_converter.store'].garbage_collector() - return super(AutoVacuum, self).power_on(*args, **kwargs) diff --git a/muk_converter/models/store.py b/muk_converter/models/store.py index 2c91968..ebece78 100644 --- a/muk_converter/models/store.py +++ b/muk_converter/models/store.py @@ -59,11 +59,3 @@ class Store(models.Model): def _compute_name(self): for record in self: record.name = "%s (%s)" % (record.content_fname, record.checksum) - - @api.model - def garbage_collector(self): - param = self.env['ir.config_parameter'].sudo() - max_store = param.get_param("muk_converter.max_store", default=20) - records = self.search([], order='used_date asc') - if len(records) > int(max_store): - records[max_store:].unlink()