Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
17380 Widoki

I've started to use Maintenance module and noticed that files in filestore directory are not removed after deleting attachments. Is any simple method to make a cleanup of unused files or I need to write a script which will be doing it?

 I know, that using hash of files instead of real names is useful when the same files are attached many times and therefore is not so easy to delete file directly after removing attachment but I hope a cron script would be very desired.

Odoo v.11


Awatar
Odrzuć
Autor Najlepsza odpowiedź

Self-answer. I found that Odoo makes such cleanup  automatically (in my instalation twice a day) then described problem does not exist. A few houres later filestore directory was freed from unnecessary files.

Odoo v. 12 not 11 as noticed in previous post.

Awatar
Odrzuć
Najlepsza odpowiedź

Just to fill inn what I found out. The job that does this is called

Base: Auto-vacuum internal data

and lives here:


class AutoVacuum(models.AbstractModel):
""" Expose the vacuum method to the cron jobs mechanism. """
_name = 'ir.autovacuum'
_description = 'Automatic Vacuum'
.
.
.
@api.model
def power_on(self, *args, **kwargs):
if not self.env.user._is_admin():
raise AccessDenied()
self.env['ir.attachment']._file_gc()
self._gc_transient_models()
self._gc_user_logs()
return True
Awatar
Odrzuć
Najlepsza odpowiedź

Hi

I actually have a interesting case. I currently run v15 on odoo.sh and I'm exporting database to try to import it with filestore to different machine for testing and I get 'virus' warning on some file in the odoo db dump.

I was able to locate the phisical file with it's name from antivirus and tried to search for the file in ir.attachment table using the field "Stored Filename" (technical name of field 'store_fname'). Result is the file name that is physically in database dump is not found in the ir.attachment, but the file is physically in the filestore folder when doing db backup.

This is where it gets interesting... in pararel I'm tring to migrate to v17 and have my staging running with v17 version with the same database backup, and there I can find the file in ir.attachment based on it's "Stored Filename".

I want to remove the file from v15 to continue migration, but I cannot locate it.

any ideas?

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sty 21
7793
1
gru 17
8444
1
lut 25
1699
5
paź 24
10896
0
lip 24
978