Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

Where are document Attachments stored?

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
attachmentdocumentv7
42 Ответы
130734 Представления
Аватар
Daniel Reis

Most forms allows you to add Attachments.

Where are these attachments stored? Somewhere in the database, or maybe somewhere in the server's file system?

28
Аватар
Отменить
Wael

I want to learn. Openerp what is the. First step?

Аватар
Antony Lesuisse (al)
Лучший ответ

In OpenERP v7, by default, attachments are stored in the database. You may choose to store them on the filesystem by setting an ir.config.parameter (Settings->Technical->Parameters-System parameters) named ir_attachment.location

Example if you set ir_attachment.location to file:///filestore

They will be stored in the filesystem at openerp root_path/filestore, the new system uses sha1 to generate the filename so that duplicate files don't take more space.

Only the file:/// scheme is implemented, modules can implement additional scheme like amazons3:///

In database mode the data is stored in ir_attachment.db_datas.
Filestore mode file name is stored in ir_attachment.db_datas_fname.

Those names suck but we kept them for backwards compatibility.

No automatic conversion mechanism exists.

If you set this parameter existing attachments remain stored in the database, only NEW ones will be stored in the filesystem. But the system will try both location so it's not a problem (db_datas is checked first then db_datas_fname).

If you remove this parameter you should manually store back the files in the database because the system will only look in the database.

62
Аватар
Отменить
Juan Cristobal Lopez

My documents where moved from filesystem to database, if I do set this parameter to filesyste are those attachments moved to filesystem and deleted from data base?

Ian Beardslee

Default tries to create 'filestore' in /usr/lib/pymodules/python2.7/openerp. For backups, we put our 'non-standard' files in /opt/openerp

mkdir /opt/openerp/filestore

ln -s /opt/openerp/filestore /usr/lib/pymodules/python2.7/openerp/filestore

ton123

I see the question is for v7. But I have read on several places on this forum and launchpad filestore is not available for v7. I assume your answer is for v6 series. Anyway for me as an v6.1 user it is very informative.

Antony Lesuisse (al)

No it's for v7 check the code

ton123

Thanks. Now I am puzzled. See bug report. https://bugs.launchpad.net/openobject-addons/+bug/1093977 . Anyway is the answer for v6.1 the same?

Roland Lautenbach

It works for V7 as Antony describes above. But it seems to corrupt the files when storing to the file system but not when using the database. I am testing this Windows 7. Am I missing something with the file system setup or is this a known problem.

Ian Beardslee

I recall something about v6.x, storing documents on file system and Windows being a bad combination. Not sure if that applies to v7 or if in fact I am correct about that being not recommended .. will see if I can track that reference down.

Roland Lautenbach

Thanks. I have now tried it on Linux but it doesn't work there either

Ian Beardslee

All file types? All sizes? Not a known problem that I am aware of (having it working fine myself with Linux)

Houssine BAKKALI

Yes all types of file and all sizes https://bugs.launchpad.net/openobject-addons/+bug/1131272

Pierre Soum

That's a complete answer ;-)

Giulio Marcon

Is there a way to migrate from database to filestore after doing this configuration?

Luca Donato

Thank you very much for the information, really helpful! I was wondering if it's possible to store the files on a remote location (e.g. a folder on the NAS). I tried to replace filestore with a mounted shared folder, but it didn't work. Did anybody accomplish that?

Houssine BAKKALI

Hi Luca, yes we did it on linux. you can't replace the filestore with a mounted shared folder. In fact we didn't succeed to place the folder anywere else than in the openerp folder install... which in cleary not god for many reason...

anyway, you could mount the folder you selected to a shared folder... that's all you can do...

sridhar

Is this possible to save same file name... example: i attached a ABC.txt file need to store as ABC.txt in that path.

OpenWorks

Is it possible to store file via CDN?

Аватар
Giulio Marcon
Лучший ответ

In case you need to migrate your attachments after changing the storage from database to filestore, you can use the following script (use only on OpenERP 7.x):

#!/usr/bin/python

import xmlrpclib

username = 'admin' #the user
pwd = 'password'      #the password of the user
dbname = 'database'    #the database

# Get the uid
sock_common = xmlrpclib.ServerProxy ('<URL>/xmlrpc/common')
uid = sock_common.login(dbname, username, pwd)
sock = xmlrpclib.ServerProxy('<URL>/xmlrpc/object')

def migrate_attachment(att_id):
    # 1. get data
    att = sock.execute(dbname, uid, pwd, 'ir.attachment', 'read', att_id, ['datas'])            

    data = att['datas']

    # Re-Write attachment
    a = sock.execute(dbname, uid, pwd, 'ir.attachment', 'write', [att_id], {'datas': data})

# SELECT attachments:
att_ids = sock.execute(dbname, uid, pwd, 'ir.attachment', 'search', [('store_fname','=',False)])

cnt = len(att_ids)        
i = 0
for id in att_ids:
    att = sock.execute(dbname, uid, pwd, 'ir.attachment', 'read', id, ['datas','parent_id'])

    migrate_attachment(id)
    print 'Migrated ID %d (attachment %d of %d)' % (id,i,cnt)
    i = i + 1

print "done ..."

After running the script, clean up your ir_attachments table:

update ir_attachment set db_datas = null where store_fname is not null
vacuum (full, analyze) ir_attachment

Replace <URL> with your OpenERP installation URL (sorry for that, I do not have enough Karma to post the standard localhost link). Thank you very much to Andreas Brückl for providing the script for OpenERP 6.x (question 711, cannot post the link for same Karma issue).

22
Аватар
Отменить
Hulshof

I tried the script and it fails with " 'int' object is not iterable "

Antoine Morit

This script is perfect !.. Don't forget to set ir_attachment.location before using it.

phoebe

Hi, I got this error message when I run this script: 'list indices must be integers, not str'. Anyone can help???

Sebastian Carullo

Hi, I setup "ir_attachment.location=file///filestore" in openERP first, but then when I run the script above nothing happens, means no folder is created in openERP install directory. The script ends with "done...", so no errors. I cannot access documents through openERP interface, I get an error. The only way to restore the documents is with the script. Any ideas? Thank you!

NUMERIGRAPHE

In case you have migrated from previous version via OPW, your ir_attachment table mak have an extra field "data" that contains the legacy version of the attachments. That can amount to a lot of data, so you may want to drop this field too and vacuum again.

Аватар
Valentin Lab
Лучший ответ

Please note that in Odoo version, this has changed. The parameter ``ir_attachment.location`` can only take the value ``file`` or ``db``. There's no more ``file:///my/path`` stuff.

It should be noted that an action ``force_storage`` is available on ``ir_attachment`` object and could be easily triggered from python, xmlrpc, or a button to force all the existing attachment to follow the value you have set in ``ir_attachment.location``.

source: https://github.com/odoo/odoo/blob/master/openerp/addons/base/ir/ir_attachment.py#L76

So with this, in odoo, you can switch from file store to db store quite easily.

To be noted also: 'file' is the default value of the parameter ``ir_attachment.location``.

source: https://github.com/odoo/odoo/blob/master/openerp/addons/base/ir/ir_attachment.py#L70

 

 

5
Аватар
Отменить
Valentin Lab

Edit link doesn't work... don't forget: 'vacuum (full, analyze) ir_attachment;' that should definitively be executed by ``force_update``... but well.

Аватар
Jose Gpe Osuna
Лучший ответ

lThank You Giulio Marcon, your script helped me do migrate my attachment files from database OpenERP 7 to file-system.  I only had to change the line

data = att['datas']

With

data = att[0]['datas']

in order to get rid of the message " 'int' object is not iterable "

2
Аватар
Отменить
Аватар
Francesco OpenCode
Лучший ответ

Attachments are store in ir_attachment table as binary data.

1
Аватар
Отменить
Аватар
Gouranga Kala
Лучший ответ

after a few research i found the original files are stored in file system in my ubuntu 18 is 

home->.local->share->odoo->filestore->your_db_name->the first 2 character of the offset of your attachment folder->here you can find the file uploaded by you. 


0
Аватар
Отменить
Muhammad Awais

but these are in encrypted format.

how to get the exact file like attachment.txt or attachment.shp etc

Аватар
Moisés Augusto López Calderón
Лучший ответ

You have two options for store attachment. Database: irattachment table Folder: ../server/filestore/databasename/

Stored in a folder of your operating system is more efficient. You can see it in Storage configuration


Moisés López - Vauxoo

0
Аватар
Отменить
Daniel Reis
Автор

Can you provide more details on hoe to setup the option you want?

Moisés Augusto López Calderón

http://doc.openerp.com/v6.0/book/7/7_19_Documents/7_19_Documents_attachment.html (http://doc.openerp.com/v6.0/book/7/719Documents/719Documents_attachment.html)

Jeudy Nicolas

This is not valid for V7 version. I did not find anyway to setup document attachment in file system .. I think Postgres database is not the right location to store binary file ! Why filesystem option has been removed ?

Houssine BAKKALI

I came to the same conclustion to Nicolas. Can't find anymore where to configure the filestorage. Looking at the code filestores is marked as deprecated.

Fabien REMY

The script is perfect and work fine. In v7 how to specify a path like /var/filestore/databasename instead of server/filestore/databasename ? Is there a reason to have that directory within the server code ? How can I chage it (if it's possible) ? Thanks.

Аватар
Nikunj Nakum
Лучший ответ

I see this bug was reported for Windows. We have it with Linux as well - all file types and sizes

0
Аватар
Отменить
Аватар
Priya
Лучший ответ

If Knowledge Management module is installed, attachments will be stored only in the file system.. No option to store in DB
 

0
Аватар
Отменить
Аватар
Fabien REMY
Лучший ответ

Thank you for the script.

When I try to extract all the documents stored in the database to the file system via XMLRPC, I notice a huge memory usage.

Is there's a way to limit the memory used ?

Thank you.

0
Аватар
Отменить
Аватар
Ian Beardslee
Лучший ответ

Version 6 had the option to save attachments onto the file system.

Unfortunately this functionality has been removed from v7 and currently the only option, as Francesco says above, stores them as binary data in the ir_attachment table.

-1
Аватар
Отменить
Аватар
Juanjo Algaz
Лучший ответ

This is a bad feature!

Edit: Sorry, it is correct, this is a comment a not an answer

-8
Аватар
Отменить
Antonin Bourguignon (abo)

This kind of comment isn't welcome in this Q&A format and surely shouldn't be posted as an answer (maybe as a comment in the worst case scenario).

Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
How to Add Attachment function to maintenance module?
attachment document
Аватар
Аватар
Аватар
10
февр. 16
10390
Can I drag&drop document with module "document"?
document v7
Аватар
Аватар
1
мар. 15
6507
How to use FTP google drive with OpenERP?
document v7
Аватар
Аватар
1
мар. 15
6952
Question about attachment in open ERP 7.0
attachment v7
Аватар
Аватар
1
мар. 15
5779
Linking attached document in note with a workspace in Documents
attachment document pictures
Аватар
0
мая 24
2500
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now