Odoo Aide

0

[Solved] How to recover deleted attachment files from filestore folder [/.local/share/Odoo/filestore]

Par
deep
sur 18/01/2018 05:41 1 650 Vues

In my system, there were 2 Odoo packages, with one folder being named as 'odoo' while the other one named as 'odoo_live'.

My instance was running on the package directory 'odoo_live', thus I deleted the other package/directory ie odoo, since it was not in use.

However after the deletion, I was in for surprise!!, looks like my current database were storing its attachment files under the directory odoo-package, i.e "/opt/odoo/.local/share/Odoo/filestore..."
Now I wonder how to recover, because now my database is having trouble when it is unable to find those files/attachments.

Is there a way to recover, like by regenerating those files, and directing it to appropriate folder, please suggest.


0
--deep--

Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

deep
Le 19/01/2018 05:33

Found the solution, bit tedious work actually, but this solved my issue.

For anyone seeking the solution for the same, please refer the below link.

Bug when restore with the backup database not include filestore


Conclusion:

Was able to fix this problem with a workaround: manually going into the database and removing the entries pointing to the missing files from filestore

DELETE FROM ir_attachment WHERE store_fname LIKE '%<the ending hash>%'

For Example:

2016-05-06 09:07:25,787 1 INFO database-name openerp.addons.base.ir.ir_attachment: _read_file reading /var/lib/odoo/filestore/<database name>/82/825be0a9492aa429844218238d35347d6a3c9220
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_attachment.py", line 105, in _file_read
    r = open(full_path,'rb').read().encode('base64')
IOError: [Errno 2] No such file or directory: u'/var/lib/odoo/filestore/<database name>/82/825be0a9492aa429844218238d35347d6a3c9220'

So the above error would be fixed by doing

DELETE FROM ir_attachment WHERE store_fname LIKE'%825be0a9492aa429844218238d35347d6a3c9220%';

After doing this for every problematic file, Odoo re-compiled all the assets and the backend started working again.

P.S. For more detailed explanation, please refer the answer suggested by aisopuro in the above link.

A propos de cette communauté

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Outils de question

1 Abonné(e)s

Statistiques

Posée: 18/01/2018 05:41
Vu: 1650 temps
Dernière mise à jour: 19/01/2018 05:34