v 15.0 Third Party 3178
Download for v 15.0 Deploy on Odoo.sh
Lines of code 406
Technical Name ks_binary_file_preview
LicenseLGPL-3
Websitehttps://store.ksolves.com/
Also available in version v 13.0 v 14.0 v 12.0
You bought this module and need support? Click here!
Lines of code 406
Technical Name ks_binary_file_preview
LicenseLGPL-3
Websitehttps://store.ksolves.com/
Also available in version v 13.0 v 14.0 v 12.0
Community Enterprise

Document Preview

Document Preview saves time and storage of users as it allows them to preview the document without downloading it. This app can be used in all Odoo modules to display documents like PDF, image, video file format.

Hot Features

  • Supports Multiple Files such as images, PDFs, and Videos
  • Preview Files from Anywhere Inside the Odoo Module

Problems/Solutions

PROBLEM:

With the Odoo Module, no preview is available.

SOLUTION:

Document Preview offers a range of file formats such as image, PDF, audio, and Video to be displayed as a Preview.

PROBLEM:

The user had to view the preview in the Attachment (Technical) module.

SOLUTION:

This app lets the user preview in all Odoo modules.

Working of app

Note:

Extensively Tested on Odoo Vanilla with Ubuntu OS
  • Works with custom binary fields.
  • Support Multiple File Formats.
    • - File formats such as pdf, jpeg, gif, png, mp4.
HOW IT WORKS
  • arrow If you’re adding the Binary Field to a new code or already working code, then add attachmnt=True in python model wherever you wish to add the field.
    arrow
  • arrow A button like ( ) will be visible beside all binary fields like shown in the image.
    arrow
  • arrow Allow access to preview the attachments for the normal user.
    arrow

Frequently Asked Question

Is this app compatible with Odoo Enterprise?
Yes, our app works with Odoo Enterprise as well as Community.
Does the preview works with custom binary fields?
Yes, but you have to make the field Attachment = True.
What type of files does it support for preview?
It supports most of the file formats like pdf, jpeg, gif, png, mp4.
Need some customization in this app, whom to contact?
Please drop email at sales@ksolves.com or raise a ticket through Odoo store itself.
Will it preview if the field is modified (attachment=True changed to attachment=False)
You will be presented with the preview of last file that you have uploaded (when attachment=True).

Our Releases

11th April, 2022

Latest Release 1.0.2

Enhancement - Allow access to preview the attachments for the normal user.

7th February, 2022

Release 1.0.1

Minor code change related to the doc-preview..

Ksolves Odoo Services

ksolves
support
Odoo Implementation
apps
Odoo Community Apps
support2
Odoo Support & Maintenance
custom
Odoo Customization
integrated
Odoo Integration Services
develop
Odoo Developer Outsourcing
sales@ksolves.com
+91 120-4299799‬

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
Solve the issue as soon as possible or roll back to previous verssion
by
Dragan Vukosavljevic
on 4/11/22, 1:32 PM

Hello, 

last version for Odoo 14 completely screw the system. Here is the error report


Error:

Odoo Server Error


Traceback (most recent call last):

  File "/opt/odoo14/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch

    result = request.dispatch()

  File "/opt/odoo14/odoo/odoo/http.py", line 685, in dispatch

    result = self._call_function(**self.params)

  File "/opt/odoo14/odoo/odoo/http.py", line 361, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/opt/odoo14/odoo/odoo/service/model.py", line 94, in wrapper

    return f(dbname, *args, **kwargs)

  File "/opt/odoo14/odoo/odoo/http.py", line 349, in checked_call

    result = self.endpoint(*a, **kw)

  File "/opt/odoo14/odoo/odoo/http.py", line 914, in __call__

    return self.method(*args, **kw)

  File "/opt/odoo14/odoo/odoo/http.py", line 533, in response_wrap

    response = f(*args, **kw)

  File "/opt/odoo14/odoo/addons/web/controllers/main.py", line 1742, in load

    action = request.env[action_type].sudo().browse([action_id]).read()

  File "/opt/odoo14/odoo/odoo/addons/base/models/ir_actions.py", line 240, in read

    result = super(IrActionsActWindow, self).read(fields, load=load)

  File "/opt/odoo14/odoo/odoo/models.py", line 3022, in read

    return self._read_format(fnames=fields, load=load)

  File "/opt/odoo14/odoo/odoo/models.py", line 3042, in _read_format

    vals[name] = convert(record[name], record, use_name_get)

  File "/opt/odoo14/odoo/odoo/fields.py", line 2687, in convert_to_read

    return (value.id, value.sudo().display_name)

  File "/opt/odoo14/odoo/odoo/fields.py", line 1021, in __get__

    self.compute_value(recs)

  File "/opt/odoo14/odoo/odoo/fields.py", line 1177, in compute_value

    records._compute_field_value(self)

  File "/opt/odoo14/odoo/odoo/models.py", line 4070, in _compute_field_value

    getattr(self, field.compute)()

  File "/opt/odoo14/odoo/odoo/models.py", line 1728, in _compute_display_name

    names = dict(self.name_get())

  File "/opt/odoo14/odoo/odoo/models.py", line 1746, in name_get

    result.append((record.id, convert(record[name], record)))

  File "/opt/odoo14/odoo/odoo/models.py", line 5687, in __getitem__

    return self._fields[key].__get__(self, type(self))

  File "/opt/odoo14/odoo/odoo/fields.py", line 1021, in __get__

    self.compute_value(recs)

  File "/opt/odoo14/odoo/odoo/fields.py", line 1177, in compute_value

    records._compute_field_value(self)

  File "/opt/odoo14/odoo/odoo/models.py", line 4072, in _compute_field_value

    field.compute(self)

  File "/opt/odoo14/odoo/odoo/fields.py", line 543, in _compute_related

    values = [first(value[name]) for value in values]

  File "/opt/odoo14/odoo/odoo/fields.py", line 543, in <listcomp>

    values = [first(value[name]) for value in values]

  File "/opt/odoo14/odoo/odoo/models.py", line 5687, in __getitem__

    return self._fields[key].__get__(self, type(self))

  File "/opt/odoo14/odoo/odoo/fields.py", line 2485, in __get__

    return super().__get__(records, owner)

  File "/opt/odoo14/odoo/odoo/fields.py", line 998, in __get__

    recs._fetch_field(self)

  File "/opt/odoo14/odoo/odoo/models.py", line 3071, in _fetch_field

    self._read(fnames)

  File "/opt/odoo14/odoo/odoo/addons/base/models/res_users.py", line 448, in _read

    super(Users, self)._read(fields)

  File "/opt/odoo14/odoo/odoo/models.py", line 3138, in _read

    cr.execute(query_str, params + [sub_ids])

  File "<decorator-gen-3>", line 2, in execute

  File "/opt/odoo14/odoo/odoo/sql_db.py", line 101, in check

    return f(self, *args, **kwargs)

  File "/opt/odoo14/odoo/odoo/sql_db.py", line 298, in execute

    res = self._obj.execute(query, params)

Exception


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/opt/odoo14/odoo/odoo/http.py", line 641, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/opt/odoo14/odoo/odoo/http.py", line 317, in _handle_exception

    raise exception.with_traceback(None) from new_cause

psycopg2.errors.UndefinedColumn: column res_users.ks_allow_preview does not exist

LINE 1: ...sers"."notification_type" as "notification_type", "res_users...

                                                             ^

Re: Solve the issue as soon as possible or roll back to previous verssion
by
Ksolves
on 4/12/22, 3:32 AM Author

Hello Dragan!

Please find the below response to your query. In the latest release, we have added a new feature that non-admin users can also preview the documents. So with the same, we have added fields on the View level and python level. For the same after update the latest release zip you need to restart your server again and upgrade the Document Preview application from the Odoo Apps. Then your issue must be resolved. Module Updation Steps: Steps - 1. Download the latest zip file from Ksolves or Odoo app store, Extract it              2. Replace it with the one currently present in your addons with the same                       name.           

             3. Must Restart your server.              4. Upgrade the Document Preview module from Odoo Apps.              5. Now you are ready to go. Note: Firstly update and test the Latest release on Test Server or you must have the backup of the database, when everything is working fine on your Test server then perform the same to your Production or live database to avoid further issues.   If you have any other concerns or queries, please feel free to reach out to us odoo.helpdesk@ksolves.in. Thanks,
Team Ksolves!


Not Working
by
Mohammad AL-Omari
on 2/4/22, 1:09 AM
Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/odoo/odoo-server/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
  File "/odoo/odoo-server/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
KeyError: ('ir.model.data', <function IrModelData._xmlid_lookup at 0x7f855a0edd30>, 'web.assets_backend')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/tools/convert.py", line 680, in _tag_root
    f(rec)
  File "/odoo/odoo-server/odoo/tools/convert.py", line 658, in _tag_template
    return self._tag_record(record)
  File "/odoo/odoo-server/odoo/tools/convert.py", line 567, in _tag_record
    f_val = self.id_get(f_ref)
  File "/odoo/odoo-server/odoo/tools/convert.py", line 663, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
  File "/odoo/odoo-server/odoo/tools/convert.py", line 669, in model_id_get
    return self.env['ir.model.data']._xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
  File "/odoo/odoo-server/odoo/addons/base/models/ir_model.py", line 1935, in _xmlid_to_res_model_res_id
    return self._xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-35>", line 2, in _xmlid_lookup
  File "/odoo/odoo-server/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/odoo/odoo-server/odoo/addons/base/models/ir_model.py", line 1928, in _xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: web.assets_backend
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/odoo/odoo-server/odoo/http.py", line 688, in dispatch
    result = self._call_function(**self.params)
  File "/odoo/odoo-server/odoo/http.py", line 360, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/odoo/http.py", line 349, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 917, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 536, in response_wrap
    response = f(*args, **kw)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 1352, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 1340, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 464, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 451, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-74>", line 2, in button_immediate_install
  File "/odoo/odoo-server/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
  File "/odoo/odoo-server/odoo/addons/base/models/ir_module.py", line 483, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/odoo/odoo-server/odoo/addons/base/models/ir_module.py", line 600, in _button_immediate_function
    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/odoo/odoo-server/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/odoo/odoo-server/odoo/modules/loading.py", line 474, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/odoo/odoo-server/odoo/modules/loading.py", line 363, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/odoo/odoo-server/odoo/modules/loading.py", line 222, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package)
  File "/odoo/odoo-server/odoo/modules/loading.py", line 69, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
  File "/odoo/odoo-server/odoo/tools/convert.py", line 745, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate)
  File "/odoo/odoo-server/odoo/tools/convert.py", line 811, in convert_xml_import
    obj.parse(doc.getroot())
  File "/odoo/odoo-server/odoo/tools/convert.py", line 731, in parse
    self._tag_root(de)
  File "/odoo/odoo-server/odoo/tools/convert.py", line 693, in _tag_root
    raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/http.py", line 644, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 302, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing None:3, somewhere inside
<data name="board assets" inherit_id="web.assets_backend">
        <xpath expr="." position="inside">
            <script type="text/javascript" src="/ks_binary_file_preview/static/src/js/ks_binary_preview.js"/>
        </xpath>
    </data>
Re: Not Working
by
Ksolves
on 2/16/22, 1:21 AM Author

Hi Mohammad,

We have received your query. Kindly mark your query to odoo.helpdesk@ksolves.in for us to raise a ticket.

We'd take it up on priority and check with our tech development team on the possible solutions. We shall reply soon with the update Regards,

Team Ksolves


by
Ksolves
on 12/29/21, 8:53 AM Author

Hi Juan,

We have checked your concern and we will provide the fixes for the same in our next release and update you accordingly.

For any other concerns or queries, please feel free to reach out to us odoo.helpdesk@ksolves.in.

Thanks,

Team Ksolves !


error
by
Juan Jose Samayoa
on 12/20/21, 2:54 PM
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
KeyError: ('ir.model.data', <function IrModelData._xmlid_lookup at 0x7f55491a0430>, 'web.assets_backend')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 680, in _tag_root
    f(rec)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 658, in _tag_template
    return self._tag_record(record)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 567, in _tag_record
    f_val = self.id_get(f_ref)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 663, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 669, in model_id_get
    return self.env['ir.model.data']._xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1935, in _xmlid_to_res_model_res_id
    return self._xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-35>", line 2, in _xmlid_lookup
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1928, in _xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: web.assets_backend
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 687, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 348, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 916, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 535, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1339, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1327, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 464, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-74>", line 2, in button_immediate_install
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 483, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 600, in _button_immediate_function
    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 474, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 363, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 222, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 69, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 745, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 811, in convert_xml_import
    obj.parse(doc.getroot())
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 731, in parse
    self._tag_root(de)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 693, in _tag_root
    raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing None:3, somewhere inside
<data name="board assets" inherit_id="web.assets_backend">
        <xpath expr="." position="inside">
            <script type="text/javascript" src="/ks_binary_file_preview/static/src/js/ks_binary_preview.js"/>
        </xpath>
    </data>
Re: error
by
Ksolves
on 12/21/21, 12:47 AM Author

Hi Juan,

We have received your query. Kindly mark your query to sales@ksolves.com We will check with our tech development team on the possible solutions.

Regards,

Team Ksolves