You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
5.2 KiB

  1. ===========
  2. MuK Preview
  3. ===========
  4. MuK Preview enables support to preview binary files directly in Odoo. It adds a
  5. button to the binary field, which opens a file preview dialog. The preview can
  6. be easily extended by adding new Handlers to the Preview Generator.
  7. Installation
  8. ============
  9. To install this module, you need to:
  10. Download the module and add it to your Odoo addons folder. Afterward, log on to
  11. your Odoo server and go to the Apps menu. Trigger the debug mode and update the
  12. list by clicking on the "Update Apps List" link. Now install the module by
  13. clicking on the install button.
  14. Another way to install this module is via the package management for Python
  15. (`PyPI <https://pypi.org/project/pip/>`_).
  16. To install our modules using the package manager make sure
  17. `odoo-autodiscover <https://pypi.org/project/odoo-autodiscover/>`_ is installed
  18. correctly. Then open a console and install the module by entering the following
  19. command:
  20. ``pip install --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>``
  21. The module name consists of the Odoo version and the module name, where
  22. underscores are replaced by a dash.
  23. **Module:**
  24. ``odoo<version>-addon-<module_name>``
  25. **Example:**
  26. ``sudo -H pip3 install --extra-index-url https://nexus.mukit.at/repository/odoo/simple odoo11-addon-muk-utils``
  27. Once the installation has been successfully completed, the app is already in the
  28. correct folder. Log on to your Odoo server and go to the Apps menu. Trigger the
  29. debug mode and update the list by clicking on the "Update Apps List" link. Now
  30. install the module by clicking on the install button.
  31. The biggest advantage of this variant is that you can now also update the app
  32. using the "pip" command. To do this, enter the following command in your console:
  33. ``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>``
  34. When the process is finished, restart your server and update the application in
  35. Odoo. The steps are the same as for the installation only the button has changed
  36. from "Install" to "Upgrade".
  37. You can also view available Apps directly in our `repository <https://nexus.mukit.at/#browse/browse:odoo>`_
  38. and find a more detailed installation guide on our `website <https://mukit.at/page/open-source>`_.
  39. For modules licensed under OPL-1, you will receive access data when you purchase
  40. the module. If the modules were not purchased directly from
  41. `MuK IT <https://www.mukit.at/>`_ please contact our support (support@mukit.at)
  42. with a confirmation of purchase to receive the corresponding access data.
  43. Upgrade
  44. ============
  45. To upgrade this module, you need to:
  46. Download the module and add it to your Odoo addons folder. Restart the server
  47. and log on to your Odoo server. Select the Apps menu and upgrade the module by
  48. clicking on the upgrade button.
  49. If you installed the module using the "pip" command, you can also update the
  50. module in the same way. Just type the following command into the console:
  51. ``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>``
  52. When the process is finished, restart your server and update the application in
  53. Odoo, just like you would normally.
  54. Configuration
  55. =============
  56. No additional configuration is needed to use this module.
  57. Usage
  58. =============
  59. To each Binary Field Widget a button is added, which opens the Preview Dialog.
  60. Framework
  61. =============
  62. he preview can be easily extended by adding new Preview to the registry.
  63. The following steps show the implementation of the PDF preview.
  64. PreviewContent
  65. --------------
  66. .. code-block:: javascript
  67. odoo.define('muk_preview.PreviewContentPDF', function (require) {
  68. "use strict";
  69. var core = require('web.core');
  70. var ajax = require('web.ajax');
  71. var utils = require('web.utils');
  72. var session = require('web.session');
  73. var registry = require('muk_preview.registry');
  74. var AbstractPreviewContent = require('muk_preview.AbstractPreviewContent');
  75. var QWeb = core.qweb;
  76. var _t = core._t;
  77. var PreviewContentPDF = AbstractPreviewContent.extend({
  78. template: "muk_preview.PreviewContentPDF",
  79. init: function(parent, url, mimetype, filename) {
  80. this._super.apply(this, arguments);
  81. this.viewer_url = '/web/static/lib/' +
  82. 'pdfjs/web/viewer.html?file=' +
  83. encodeURIComponent(this.url);
  84. },
  85. renderPreviewContent: function() {
  86. var def = $.Deferred();
  87. this.$('.mk_preview_pdf iframe').on('load', function () {
  88. $(this).contents().find('button#openFile').hide();
  89. def.resolve();
  90. });
  91. return def;
  92. },
  93. downloadable: false,
  94. printable: false,
  95. });
  96. registry.add('pdf', PreviewContentPDF);
  97. registry.add('.pdf', PreviewContentPDF);
  98. registry.add('application/pdf', PreviewContentPDF);
  99. return PreviewContentPDF;
  100. });
  101. Credits
  102. =======
  103. Contributors
  104. ------------
  105. * Mathias Markl <mathias.markl@mukit.at>
  106. Author & Maintainer
  107. -------------------
  108. This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_.
  109. MuK IT is an Austrian company specialized in customizing and extending Odoo.
  110. We develop custom solutions for your individual needs to help you focus on
  111. your strength and expertise to grow your business.
  112. If you want to get in touch please contact us via mail
  113. (sale@mukit.at) or visit our website (https://mukit.at).