-
20muk_web_fields_lobject/__init__.py
-
55muk_web_fields_lobject/__manifest__.py
-
4muk_web_fields_lobject/doc/changelog.rst
-
47muk_web_fields_lobject/doc/index.rst
-
75muk_web_fields_lobject/i18n/de.po
-
74muk_web_fields_lobject/i18n/muk_web_fields_lobject.pot
-
BINmuk_web_fields_lobject/static/description/banner.png
-
BINmuk_web_fields_lobject/static/description/icon.png
-
51muk_web_fields_lobject/static/description/index.html
-
BINmuk_web_fields_lobject/static/description/logo.png
-
48muk_web_fields_lobject/static/src/js/field_utils.js
-
208muk_web_fields_lobject/static/src/js/lobject.js
-
41muk_web_fields_lobject/static/src/xml/lobject.xml
-
29muk_web_fields_lobject/template/assets.xml
-
20muk_web_preview_lobject/__init__.py
-
56muk_web_preview_lobject/__manifest__.py
-
4muk_web_preview_lobject/doc/changelog.rst
-
47muk_web_preview_lobject/doc/index.rst
-
16muk_web_preview_lobject/i18n/de.po
-
16muk_web_preview_lobject/i18n/muk_web_preview_lobject.pot
-
BINmuk_web_preview_lobject/static/description/banner.png
-
BINmuk_web_preview_lobject/static/description/icon.png
-
89muk_web_preview_lobject/static/description/index.html
-
BINmuk_web_preview_lobject/static/description/logo.png
-
66muk_web_preview_lobject/static/src/js/preview_widgets.js
-
28muk_web_preview_lobject/template/assets.xml
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
################################################################################### |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
@ -0,0 +1,55 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
################################################################################### |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
|
|||
{ |
|||
"name": "MuK Large Objects Field Widget", |
|||
"summary": """PGSQL Large Objects Field Widget""", |
|||
"version": '11.0.1.0.0', |
|||
"category": 'Extra Tools', |
|||
"license": "AGPL-3", |
|||
"website": "http://www.mukit.at", |
|||
"author": "MuK IT", |
|||
"contributors": [ |
|||
"Mathias Markl <mathias.markl@mukit.at>", |
|||
], |
|||
"depends": [ |
|||
"web", |
|||
"muk_fields_lobject", |
|||
], |
|||
"data": [ |
|||
"template/assets.xml" |
|||
], |
|||
"demo": [ |
|||
], |
|||
"qweb": [ |
|||
"static/src/xml/*.xml", |
|||
], |
|||
"images": [ |
|||
'static/description/banner.png' |
|||
], |
|||
"external_dependencies": { |
|||
"python": [], |
|||
"bin": [], |
|||
}, |
|||
"auto_install": True, |
|||
"application": False, |
|||
"installable": True, |
|||
} |
@ -0,0 +1,4 @@ |
|||
`1.0.0` |
|||
------- |
|||
|
|||
- Init version |
@ -0,0 +1,47 @@ |
|||
============================== |
|||
MuK Large Objects Field Widget |
|||
============================== |
|||
|
|||
This module allows the LargeObject Field to be used in different views. It is |
|||
installed automatically with the MuK Large Objects module. |
|||
|
|||
Installation |
|||
============ |
|||
|
|||
To install this module, you need to: |
|||
|
|||
Download the module and add it to your Odoo addons folder. Afterward, log on to |
|||
your Odoo server and go to the Apps menu. Trigger the debug modus and update the |
|||
list by clicking on the "Update Apps List" link. Now install the module by |
|||
clicking on the install button. |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
No additional configuration is needed to use this module. |
|||
|
|||
Usage |
|||
============= |
|||
|
|||
This module has no direct visible effect on the system. It allows LargeObejct |
|||
fields to display in XML views. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Mathias Markl <mathias.markl@mukit.at> |
|||
|
|||
Author & Maintainer |
|||
------------------- |
|||
|
|||
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_. |
|||
|
|||
MuK IT is an Austrian company specialized in customizing and extending Odoo. |
|||
We develop custom solutions for your individual needs to help you focus on |
|||
your strength and expertise to grow your business. |
|||
|
|||
If you want to get in touch please contact us via mail |
|||
(sale@mukit.at) or visit our website (https://mukit.at). |
@ -0,0 +1,75 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * muk_web_fields_lobject |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 11.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2018-04-25 16:17+0000\n" |
|||
"PO-Revision-Date: 2018-04-25 18:19+0200\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: \n" |
|||
"Language: de\n" |
|||
"X-Generator: Poedit 2.0.6\n" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:33 |
|||
#, python-format |
|||
msgid "Clear" |
|||
msgstr "Löschen" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:92 |
|||
#, python-format |
|||
msgid "File Upload" |
|||
msgstr "File Hochladen" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:72 |
|||
#, python-format |
|||
msgid "File upload" |
|||
msgstr "File Hochladen" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:31 |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:32 |
|||
#, python-format |
|||
msgid "Select" |
|||
msgstr "Auswählen" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:71 |
|||
#, python-format |
|||
msgid "The selected file exceed the maximum file size of %s." |
|||
msgstr "Die ausgewählte Datei überschreitet die maximale Dateigröße von %s." |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:92 |
|||
#, python-format |
|||
msgid "There was a problem while uploading your file" |
|||
msgstr "Es gab ein Problem beim Hochladen Ihrer Datei" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:31 |
|||
#, python-format |
|||
msgid "Upload your file" |
|||
msgstr "Laden Sie Ihre Datei hoch" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:34 |
|||
#, python-format |
|||
msgid "Uploading..." |
|||
msgstr "Hochladen...." |
@ -0,0 +1,74 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * muk_web_fields_lobject |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 11.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2018-04-25 16:16+0000\n" |
|||
"PO-Revision-Date: 2018-04-25 16:16+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:33 |
|||
#, python-format |
|||
msgid "Clear" |
|||
msgstr "" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:92 |
|||
#, python-format |
|||
msgid "File Upload" |
|||
msgstr "" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:72 |
|||
#, python-format |
|||
msgid "File Upload" |
|||
msgstr "" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:31 |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:32 |
|||
#, python-format |
|||
msgid "Select" |
|||
msgstr "" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:71 |
|||
#, python-format |
|||
msgid "The selected file exceed the maximum file size of %s." |
|||
msgstr "" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/js/lobject.js:92 |
|||
#, python-format |
|||
msgid "There was a problem while uploading your file" |
|||
msgstr "" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:31 |
|||
#, python-format |
|||
msgid "Upload your file" |
|||
msgstr "" |
|||
|
|||
#. module: muk_web_fields_lobject |
|||
#. openerp-web |
|||
#: code:addons/muk_web_fields_lobject/static/src/xml/lobject.xml:34 |
|||
#, python-format |
|||
msgid "Uploading..." |
|||
msgstr "" |
|||
|
After Width: 880 | Height: 440 | Size: 44 KiB |
After Width: 250 | Height: 250 | Size: 11 KiB |
@ -0,0 +1,51 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">MuK PGSQL Large Objects</h2> |
|||
<h3 class="oe_slogan">PGSQL Large Objects Support</h3> |
|||
<h4 class="oe_slogan" style="font-size: 23px;">MuK IT GmbH - |
|||
www.mukit.at</h4> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_picture"> |
|||
<h3 class="oe_slogan">Overview</h3> |
|||
<div class="oe_mt32" style="padding-bottom: 10px; text-align: justify;"> |
|||
<p>This module allows the LargeObject Field to be used in different views. It is |
|||
installed automatically with the MuK Large Objects module. It has no direct visible effect on the system, but allows LargeObejct |
|||
fields to display in XML views.</p> |
|||
</div> |
|||
<pre> |
|||
<code> |
|||
<record id="view_lobject" model="ir.ui.view"> |
|||
<field name="name">lobject.form</field> |
|||
<field name="model">lobject</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="LargeObjectModel"> |
|||
<group> |
|||
<field name="content_fname" /> |
|||
<field name="content" filename="content_fname" /> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
</code> |
|||
</pre> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<h3 class="oe_slogan">Help and Support</h3> |
|||
<div class="oe_slogan"> |
|||
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at"> |
|||
<i class="fa fa-envelope"></i> Email |
|||
</a> <a class="btn btn-primary btn-lg mt8" |
|||
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i> |
|||
Contact |
|||
</a> |
|||
</div> |
|||
<img src="logo.png" style="width: 200px; margin-bottom: 20px;" |
|||
class="center-block"> |
|||
</section> |
After Width: 500 | Height: 500 | Size: 37 KiB |
@ -0,0 +1,48 @@ |
|||
/********************************************************************************** |
|||
* |
|||
* 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 <http://www.gnu.org/licenses/>.
|
|||
* |
|||
**********************************************************************************/ |
|||
|
|||
odoo.define('muk_web_fields_lobject.field_utils', function(require) { |
|||
"use strict"; |
|||
|
|||
var core = require('web.core'); |
|||
var utils = require('web.utils'); |
|||
var field_utils = require('web.field_utils'); |
|||
|
|||
var _t = core._t; |
|||
var QWeb = core.qweb; |
|||
|
|||
function lobjectToBinsize(value) { |
|||
if (!utils.is_bin_size(value)) { |
|||
return utils.human_size(value.length); |
|||
} |
|||
return value; |
|||
} |
|||
|
|||
function formatLargeObject(value, field, options) { |
|||
if (!value) { |
|||
return ''; |
|||
} |
|||
return lobjectToBinsize(value); |
|||
} |
|||
|
|||
field_utils.format.lobject = formatLargeObject; |
|||
field_utils.parse.lobject = _.identity; |
|||
|
|||
|
|||
}); |
@ -0,0 +1,208 @@ |
|||
/********************************************************************************** |
|||
* |
|||
* 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 <http://www.gnu.org/licenses/>.
|
|||
* |
|||
**********************************************************************************/ |
|||
|
|||
odoo.define('muk_web_fields_lobject.lobject', function(require) { |
|||
"use strict"; |
|||
|
|||
var core = require('web.core'); |
|||
var utils = require('web.utils'); |
|||
var session = require('web.session'); |
|||
var framework = require('web.framework'); |
|||
var crash_manager = require('web.crash_manager'); |
|||
var registry = require('web.field_registry'); |
|||
var field_utils = require('web.field_utils'); |
|||
|
|||
var AbstractField = require('web.AbstractField'); |
|||
|
|||
var _t = core._t; |
|||
var QWeb = core.qweb; |
|||
|
|||
var AbstractFieldLargeObject = AbstractField.extend({ |
|||
events: _.extend({}, AbstractField.prototype.events, { |
|||
'change .o_input_file': 'on_file_change', |
|||
'click .o_select_file_button': function () { |
|||
this.$('.o_input_file').click(); |
|||
}, |
|||
'click .o_clear_file_button': 'on_clear', |
|||
}), |
|||
init: function (parent, name, record) { |
|||
this._super.apply(this, arguments); |
|||
this.fields = record.fields; |
|||
this.useFileAPI = !!window.FileReader; |
|||
this.max_upload_size = 25 * 1024 * 1024; |
|||
if (!this.useFileAPI) { |
|||
var self = this; |
|||
this.fileupload_id = _.uniqueId('o_fileupload'); |
|||
$(window).on(this.fileupload_id, function () { |
|||
var args = [].slice.call(arguments).slice(1); |
|||
self.on_file_uploaded.apply(self, args); |
|||
}); |
|||
} |
|||
}, |
|||
destroy: function () { |
|||
if (this.fileupload_id) { |
|||
$(window).off(this.fileupload_id); |
|||
} |
|||
this._super.apply(this, arguments); |
|||
}, |
|||
on_file_change: function (e) { |
|||
var self = this; |
|||
var file_node = e.target; |
|||
if ((this.useFileAPI && file_node.files.length) || (!this.useFileAPI && $(file_node).val() !== '')) { |
|||
if (this.useFileAPI) { |
|||
var file = file_node.files[0]; |
|||
if (file.size > this.max_upload_size) { |
|||
var msg = _t("The selected file exceed the maximum file size of %s."); |
|||
this.do_warn(_t("File Upload"), _.str.sprintf(msg, utils.human_size(this.max_upload_size))); |
|||
return false; |
|||
} |
|||
var filereader = new FileReader(); |
|||
filereader.readAsDataURL(file); |
|||
filereader.onloadend = function (upload) { |
|||
var data = upload.target.result; |
|||
data = data.split(',')[1]; |
|||
self.on_file_uploaded(file.size, file.name, file.type, data); |
|||
}; |
|||
} else { |
|||
this.$('form.o_form_binary_form input[name=session_id]').val(this.getSession().session_id); |
|||
this.$('form.o_form_binary_form').submit(); |
|||
} |
|||
this.$('.o_form_binary_progress').show(); |
|||
this.$('button').hide(); |
|||
} |
|||
}, |
|||
on_file_uploaded: function (size, name) { |
|||
if (size === false) { |
|||
this.do_warn(_t("File Upload"), _t("There was a problem while uploading your file")); |
|||
console.warn("Error while uploading file : ", name); |
|||
} else { |
|||
this.on_file_uploaded_and_valid.apply(this, arguments); |
|||
} |
|||
this.$('.o_form_binary_progress').hide(); |
|||
this.$('button').show(); |
|||
}, |
|||
on_file_uploaded_and_valid: function (size, name, content_type, file_base64) { |
|||
this.set_filename(name); |
|||
this._setValue(file_base64); |
|||
this._render(); |
|||
}, |
|||
set_filename: function (value) { |
|||
var filename = this.attrs.filename; |
|||
if (filename && filename in this.fields) { |
|||
var changes = {}; |
|||
changes[filename] = value; |
|||
this.trigger_up('field_changed', { |
|||
dataPointID: this.dataPointID, |
|||
changes: changes, |
|||
viewType: this.viewType, |
|||
}); |
|||
} |
|||
}, |
|||
on_clear: function () { |
|||
this.set_filename(''); |
|||
this._setValue(false); |
|||
this._render(); |
|||
}, |
|||
}); |
|||
|
|||
var FieldLargeObject = AbstractFieldLargeObject.extend({ |
|||
template: 'FieldLObjectFile', |
|||
events: _.extend({}, AbstractFieldLargeObject.prototype.events, { |
|||
'click': function (event) { |
|||
if (this.mode === 'readonly' && this.value && this.recordData.id) { |
|||
this.on_save_as(event); |
|||
} |
|||
}, |
|||
'click .o_input': function () { |
|||
this.$('.o_input_file').click(); |
|||
}, |
|||
}), |
|||
supportedFieldTypes: ['lobject'], |
|||
init: function () { |
|||
this._super.apply(this, arguments); |
|||
this.filename_value = this.recordData[this.attrs.filename]; |
|||
}, |
|||
_renderReadonly: function () { |
|||
this.do_toggle(!!this.value); |
|||
if (this.value) { |
|||
this.$el.empty().append($("<span/>").addClass('fa fa-download')); |
|||
if (this.recordData.id) { |
|||
this.$el.css('cursor', 'pointer'); |
|||
} else { |
|||
this.$el.css('cursor', 'not-allowed'); |
|||
} |
|||
if (this.filename_value) { |
|||
this.$el.append(" " + this.filename_value); |
|||
} |
|||
} |
|||
if (!this.res_id) { |
|||
this.$el.css('cursor', 'not-allowed'); |
|||
} else { |
|||
this.$el.css('cursor', 'pointer'); |
|||
} |
|||
}, |
|||
_renderEdit: function () { |
|||
if (this.value) { |
|||
this.$el.children().removeClass('o_hidden'); |
|||
this.$('.o_select_file_button').first().addClass('o_hidden'); |
|||
this.$('.o_input').eq(0).val(this.filename_value || this.value); |
|||
} else { |
|||
this.$el.children().addClass('o_hidden'); |
|||
this.$('.o_select_file_button').first().removeClass('o_hidden'); |
|||
} |
|||
}, |
|||
set_filename: function (value) { |
|||
this._super.apply(this, arguments); |
|||
this.filename_value = value; |
|||
this.$('.o_save_file_button').prop('disabled', true); |
|||
}, |
|||
on_save_as: function (ev) { |
|||
if (!this.value) { |
|||
this._super.apply(this, arguments); |
|||
} else if (this.res_id) { |
|||
framework.blockUI(); |
|||
var c = crash_manager; |
|||
var filename_fieldname = this.attrs.filename; |
|||
this.getSession().get_file({ |
|||
'url': '/web/lobject', |
|||
'data': { |
|||
'model': this.model, |
|||
'id': this.res_id, |
|||
'field': this.name, |
|||
'filename_field': filename_fieldname, |
|||
'filename': this.recordData[filename_fieldname] || null, |
|||
'download': true, |
|||
'data': utils.is_bin_size(this.value) ? null : this.value, |
|||
}, |
|||
'complete': framework.unblockUI, |
|||
'error': c.rpc_error.bind(c), |
|||
}); |
|||
ev.stopPropagation(); |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
registry.add('lobject', FieldLargeObject); |
|||
|
|||
return { |
|||
AbstractFieldLargeObject: AbstractFieldLargeObject, |
|||
FieldLargeObject: FieldLargeObject |
|||
}; |
|||
|
|||
}); |
@ -0,0 +1,41 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
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 <http://www.gnu.org/licenses/>. |
|||
--> |
|||
|
|||
<templates id="template" xml:space="preserve"> |
|||
|
|||
<t t-name="FieldLObjectFile"> |
|||
<a t-if="widget.mode === 'readonly'" href="javascript:void(0)" class="o_form_uri"/> |
|||
<div t-if="widget.mode !== 'readonly'" class="o_field_binary_file"> |
|||
<input type="text" class="o_input" |
|||
readonly="readonly" |
|||
t-att-name="widget.name" |
|||
t-att-tabindex="widget.attrs.tabindex" |
|||
t-att-autofocus="widget.attrs.autofocus"/> |
|||
<button type="button" class="btn btn-sm btn-primary o_select_file_button" title="Select">Upload your file</button> |
|||
<button type="button" class="btn btn-sm btn-default fa fa-pencil o_select_file_button" title="Select"/> |
|||
<button type="button" class="btn btn-sm btn-default fa fa-trash-o o_clear_file_button" title="Clear"/> |
|||
<span class="o_form_binary_progress">Uploading...</span> |
|||
<t t-call="HiddenInputFile"> |
|||
<t t-set="fileupload_id" t-value="widget.fileupload_id"/> |
|||
<t t-set="fileupload_style" t-translation="off">overflow-x: hidden</t> |
|||
</t> |
|||
</div> |
|||
</t> |
|||
|
|||
</templates> |
@ -0,0 +1,29 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
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 <http://www.gnu.org/licenses/>. |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<template id="assets_backend" name="muk_dms_assets" inherit_id="web.assets_backend"> |
|||
<xpath expr="//script[last()]" position="after"> |
|||
<script type="text/javascript" src="/muk_web_fields_lobject/static/src/js/field_utils.js" /> |
|||
<script type="text/javascript" src="/muk_web_fields_lobject/static/src/js/lobject.js" /> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</odoo> |
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
################################################################################### |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
@ -0,0 +1,56 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
################################################################################### |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
|
|||
{ |
|||
"name": "MuK Preview Large Object", |
|||
"summary": """PGSQL Large Object Preview Dialog""", |
|||
"version": "11.0.1.0.0", |
|||
"category": "Extra Tools", |
|||
"license": "AGPL-3", |
|||
"website": "http://www.mukit.at", |
|||
"author": "MuK IT", |
|||
"contributors": [ |
|||
"Mathias Markl <mathias.markl@mukit.at>", |
|||
], |
|||
"depends": [ |
|||
"muk_web_preview", |
|||
"muk_web_fields_lobject", |
|||
], |
|||
"data": [ |
|||
"template/assets.xml", |
|||
], |
|||
"demo": [ |
|||
], |
|||
"qweb": [ |
|||
"static/src/xml/*.xml", |
|||
], |
|||
"images": [ |
|||
'static/description/banner.png' |
|||
], |
|||
"external_dependencies": { |
|||
"python": [], |
|||
"bin": [], |
|||
}, |
|||
"auto_install": True, |
|||
"application": False, |
|||
"installable": True, |
|||
|
|||
} |
@ -0,0 +1,4 @@ |
|||
`1.0.0` |
|||
------- |
|||
|
|||
- Init version |
@ -0,0 +1,47 @@ |
|||
======================== |
|||
MuK Preview Large Object |
|||
======================== |
|||
|
|||
This module allows the LargeObject Field to be previewed by the Preview Dialog. |
|||
It is installed automatically with the MuK Preview Dialog module. |
|||
|
|||
Installation |
|||
============ |
|||
|
|||
To install this module, you need to: |
|||
|
|||
Download the module and add it to your Odoo addons folder. Afterward, log on to |
|||
your Odoo server and go to the Apps menu. Trigger the debug modus and update the |
|||
list by clicking on the "Update Apps List" link. Now install the module by |
|||
clicking on the install button. |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
No additional configuration is needed to use this module. |
|||
|
|||
Usage |
|||
============= |
|||
|
|||
This module has no direct visible effect on the system. It allows LargeObejct |
|||
fields to be previewed by the Preview Dialog. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Mathias Markl <mathias.markl@mukit.at> |
|||
|
|||
Author & Maintainer |
|||
------------------- |
|||
|
|||
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_. |
|||
|
|||
MuK IT is an Austrian company specialized in customizing and extending Odoo. |
|||
We develop custom solutions for your individual needs to help you focus on |
|||
your strength and expertise to grow your business. |
|||
|
|||
If you want to get in touch please contact us via mail |
|||
(sale@mukit.at) or visit our website (https://mukit.at). |
@ -0,0 +1,16 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 11.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2018-04-25 16:35+0000\n" |
|||
"PO-Revision-Date: 2018-04-25 16:35+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
@ -0,0 +1,16 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 11.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2018-04-25 16:34+0000\n" |
|||
"PO-Revision-Date: 2018-04-25 16:34+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
After Width: 880 | Height: 440 | Size: 44 KiB |
After Width: 250 | Height: 250 | Size: 8.5 KiB |
@ -0,0 +1,89 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">MuK PGSQL Large Objects</h2> |
|||
<h3 class="oe_slogan">PGSQL Large Objects Support</h3> |
|||
<h4 class="oe_slogan" style="font-size: 23px;">MuK IT GmbH - |
|||
www.mukit.at</h4> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_picture"> |
|||
<h3 class="oe_slogan">Overview</h3> |
|||
<div class="oe_mt32" |
|||
style="padding-bottom: 10px; text-align: justify;"> |
|||
<p>Provides a field to store bytes as PostgreSQL large objects. |
|||
PostgreSQL offers support for large objects, which provide |
|||
stream-style access to user data that is stored in a special |
|||
large-object structure. They are useful with data values too large |
|||
to be manipulated conveniently as a whole.</p> |
|||
<h5 style="padding-top: 10px;">Psycopg2 for Python</h5> |
|||
<p> |
|||
Psycopg allows access to the large object using the |
|||
<code>lobject</code> |
|||
class. Objects are generated using the |
|||
<code>connection.lobject()</code> |
|||
factory method. Data can be retrieved either as bytes or as Unicode |
|||
strings. |
|||
</p> |
|||
<p> |
|||
Psycopg large object support efficient import/export with file |
|||
system files using the |
|||
<code>lo_import()</code> |
|||
and |
|||
<code>lo_export()</code> |
|||
libpq functions. |
|||
</p> |
|||
<p>Changed in version 2.6: added support for large objects |
|||
greated than 2GB. Note that the support is enabled only if all the |
|||
following conditions are verified:</p> |
|||
<ul> |
|||
<li>the Python build is 64 bits;</li> |
|||
<li>the extension was built against at least libpq 9.3;</li> |
|||
<li>the server version is at least PostgreSQL 9.3 |
|||
(server_version must be >= 90300).</li> |
|||
</ul> |
|||
<p> |
|||
If Psycopg was built with 64 bits large objects support (i.e. the |
|||
first two contidions above are verified), the |
|||
<code>psycopg2.__version__</code> |
|||
constant will contain the lo64 flag. If any of the contition is not |
|||
met several lobject methods will fail if the arguments exceed 2GB. |
|||
</p> |
|||
</div> |
|||
|
|||
<pre> |
|||
<code> |
|||
from odoo.addons.muk_fields_lobject import fields as lobject_fields |
|||
|
|||
class LargeObjectModel(models.Model): |
|||
|
|||
data_content = lobject_fields.LargeObject(string="Data") |
|||
|
|||
@api.multi |
|||
def data(self): |
|||
for record in self: |
|||
bytes = record.data_content |
|||
oid = record.with_context({'oid': True}).data_content |
|||
size = record.with_context({'bin_size': True}).data_content |
|||
stream = record.with_context({'stream': True}).data_content |
|||
</code> |
|||
</pre> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark" style="margin-top: 450px;"> |
|||
<h3 class="oe_slogan">Help and Support</h3> |
|||
<div class="oe_slogan"> |
|||
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at"> |
|||
<i class="fa fa-envelope"></i> Email |
|||
</a> <a class="btn btn-primary btn-lg mt8" |
|||
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i> |
|||
Contact |
|||
</a> |
|||
</div> |
|||
<img src="logo.png" style="width: 200px; margin-bottom: 20px;" |
|||
class="center-block"> |
|||
</section> |
After Width: 500 | Height: 500 | Size: 37 KiB |
@ -0,0 +1,66 @@ |
|||
/********************************************************************************** |
|||
* |
|||
* 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 <http://www.gnu.org/licenses/>.
|
|||
* |
|||
**********************************************************************************/ |
|||
|
|||
odoo.define('muk_preview_lobject.PreviewWidgets', function (require) { |
|||
"use strict"; |
|||
|
|||
var core = require('web.core'); |
|||
var utils = require('web.utils'); |
|||
var fields = require('muk_web_fields_lobject.lobject'); |
|||
|
|||
var PreviewHandler = require('muk_preview.PreviewHandler'); |
|||
var PreviewGenerator = require('muk_preview.PreviewGenerator'); |
|||
var PreviewDialog = require('muk_preview.PreviewDialog'); |
|||
|
|||
var QWeb = core.qweb; |
|||
var _t = core._t; |
|||
|
|||
fields.FieldLargeObject.include({ |
|||
_renderReadonly: function () { |
|||
this._super(); |
|||
var self = this; |
|||
var $el = this.$el; |
|||
var $wrapper = $('<div/>'); |
|||
var $button = $('<button type="button" class="o_binary_preview" aria-hidden="true"/>'); |
|||
$button.append($('<i class="fa fa-file-text-o"></i>')); |
|||
$button.click(function(e) { |
|||
e.preventDefault(); |
|||
e.stopPropagation(); |
|||
var value = self.get('value'); |
|||
var filename_fieldname = self.attrs.filename; |
|||
var filename = self.recordData[filename_fieldname] || null; |
|||
PreviewDialog.createPreviewDialog(self, '/web/lobject?' + $.param({ |
|||
'model': self.model, |
|||
'id': self.res_id, |
|||
'field': self.name, |
|||
'filename_field': filename_fieldname, |
|||
'filename': filename, |
|||
'download': true, |
|||
'data': utils.is_bin_size(value) ? null : value, |
|||
}), false, filename ? filename.split('.').pop() : false, filename); |
|||
}); |
|||
$wrapper.addClass($el.attr('class')); |
|||
$el.removeClass("o_field_widget o_hidden"); |
|||
this.replaceElement($wrapper); |
|||
$wrapper.append($button); |
|||
$wrapper.append($el); |
|||
}, |
|||
}); |
|||
|
|||
}); |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
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 <http://www.gnu.org/licenses/>. |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<template id="assets_backend" name="muk_dms_assets" inherit_id="web.assets_backend"> |
|||
<xpath expr="//script[last()]" position="after"> |
|||
<script type="text/javascript" src="/muk_web_preview_lobject/static/src/js/preview_widgets.js" /> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</odoo> |