diff --git a/muk_web_utils/__init__.py b/muk_web_utils/__init__.py
index 3a0a7c9..7c3419b 100644
--- a/muk_web_utils/__init__.py
+++ b/muk_web_utils/__init__.py
@@ -17,4 +17,5 @@
#
###################################################################################
-from . import models
\ No newline at end of file
+from . import models
+from . import controllers
\ No newline at end of file
diff --git a/muk_web_utils/__manifest__.py b/muk_web_utils/__manifest__.py
index b58687f..7fd7e47 100644
--- a/muk_web_utils/__manifest__.py
+++ b/muk_web_utils/__manifest__.py
@@ -20,7 +20,7 @@
{
"name": "MuK Web Utils",
"summary": """Utility Features""",
- "version": "12.0.2.8.0",
+ "version": "12.0.2.8.1",
"category": "Extra Tools",
"license": "AGPL-3",
"author": "MuK IT",
@@ -35,6 +35,7 @@
],
"data": [
"template/assets.xml",
+ "views/res_config_settings_view.xml",
],
"qweb": [
"static/src/xml/*.xml",
diff --git a/muk_web_utils/controllers/__init__.py b/muk_web_utils/controllers/__init__.py
new file mode 100644
index 0000000..4631769
--- /dev/null
+++ b/muk_web_utils/controllers/__init__.py
@@ -0,0 +1,20 @@
+###################################################################################
+#
+# Copyright (C) 2017 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 . import backend
diff --git a/muk_web_utils/controllers/backend.py b/muk_web_utils/controllers/backend.py
new file mode 100644
index 0000000..dd4c12a
--- /dev/null
+++ b/muk_web_utils/controllers/backend.py
@@ -0,0 +1,34 @@
+###################################################################################
+#
+# Copyright (C) 2017 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 .
+#
+###################################################################################
+
+import logging
+
+from odoo import http
+from odoo.http import request
+
+_logger = logging.getLogger(__name__)
+
+class BackendController(http.Controller):
+
+ @http.route('/params/muk_web_utils.binary_max_size', type='json', auth="user")
+ def max_upload_size(self, **kw):
+ params = request.env['ir.config_parameter'].sudo()
+ return {
+ 'max_upload_size': int(params.get_param("muk_dms.max_upload_size", default=25))
+ }
\ No newline at end of file
diff --git a/muk_web_utils/models/res_config_settings.py b/muk_web_utils/models/res_config_settings.py
index b657982..43febf3 100644
--- a/muk_web_utils/models/res_config_settings.py
+++ b/muk_web_utils/models/res_config_settings.py
@@ -30,11 +30,38 @@ _logger = logging.getLogger(__name__)
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
-
+
+ #----------------------------------------------------------
+ # Database
+ #----------------------------------------------------------
+
+ binary_max_size = fields.Integer(
+ string='File Size Limit',
+ required=True,
+ default=25,
+ help="""Maximum allowed file size in megabytes. Note that this setting only adjusts
+ the binary widgets accordingly. The maximum file size on your server can probably
+ be restricted in several places. Note that a large file size limit and therefore
+ large files in your system can significantly limit performance.""")
+
#----------------------------------------------------------
# Functions
#----------------------------------------------------------
+ @api.multi
+ def set_values(self):
+ res = super(ResConfigSettings, self).set_values()
+ param = self.env['ir.config_parameter'].sudo()
+ param.set_param('muk_web_utils.binary_max_size', self.binary_max_size)
+ return res
+
+ @api.model
+ def get_values(self):
+ res = super(ResConfigSettings, self).get_values()
+ params = self.env['ir.config_parameter'].sudo()
+ res.update(binary_max_size=int(params.get_param('muk_web_utils.binary_max_size', 25)))
+ return res
+
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
ret_val = super(ResConfigSettings, self).fields_view_get(
diff --git a/muk_web_utils/static/src/js/fields/binary.js b/muk_web_utils/static/src/js/fields/binary.js
new file mode 100644
index 0000000..3cd9e32
--- /dev/null
+++ b/muk_web_utils/static/src/js/fields/binary.js
@@ -0,0 +1,52 @@
+/**********************************************************************************
+*
+* Copyright (C) 2017 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 .
+*
+**********************************************************************************/
+
+odoo.define('muk_web_utils.binary', function(require) {
+"use strict";
+
+var core = require('web.core');
+var session = require('web.session');
+var fields = require('web.basic_fields');
+
+var _t = core._t;
+var QWeb = core.qweb;
+
+fields.FieldBinaryFile.include({
+ willStart: function () {
+ var def = this._rpc({
+ route: '/params/muk_web_utils.binary_max_size',
+ }).done(function(result) {
+ this.max_upload_size = result.max_upload_size * 1024 * 1024;
+ }.bind(this));
+ return this._super.apply(this, arguments);
+ },
+});
+
+fields.FieldBinaryImage.include({
+ willStart: function () {
+ var def = this._rpc({
+ route: '/params/muk_web_utils.binary_max_size',
+ }).done(function(result) {
+ this.max_upload_size = result.max_upload_size * 1024 * 1024;
+ }.bind(this));
+ return this._super.apply(this, arguments);
+ },
+});
+
+});
diff --git a/muk_web_utils/template/assets.xml b/muk_web_utils/template/assets.xml
index 74990df..95316ce 100644
--- a/muk_web_utils/template/assets.xml
+++ b/muk_web_utils/template/assets.xml
@@ -44,6 +44,7 @@
+
diff --git a/muk_web_utils/views/res_config_settings_view.xml b/muk_web_utils/views/res_config_settings_view.xml
new file mode 100644
index 0000000..2e3526f
--- /dev/null
+++ b/muk_web_utils/views/res_config_settings_view.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+ res.config.settings.view.form
+ res.config.settings
+
+
+