İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Link attachments with wanted record and model

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
quickstart
1 Cevapla
10001 Görünümler
Avatar
Adrien Konopek (adko)

Prerequisite

I made all the test in v15 so it should work for all sub versions (15.0, 15.1 and 15.2). 

Be in debug mode.

Have an import compatible file of some attachments.

Studio.


Use case

It often happens that we want to make a mass import of attachments in Odoo (in the ir.attachment model) directly but we are stuck very fast by the fact that the Resource Model (res_model) or Resource ID (res_id) is a read only field and that it cannot be altered in a standard version. 

0
Avatar
Vazgeç
faOtools

You may also use this third-party app - https://apps.odoo.com/apps/modules/15.0/cloud_base - to move attachments between folders and, hence, between linked objects. It is as simple as a mere drag and drop or choosing a field in the popup wizard.

Avatar
Adrien Konopek (adko)
Üretici En İyi Yanıt

Solution


What I propose here is to find a workaround by linking the attachments to a comment in the chatter (mail.message) where the Related Document Model (model) and Related Document ID (res_id) are editable. 

So, imagine that you have a file that is import compatible with many attachments (base64, direct link, ...) and that you want to import it and link it to a given record on a given model. This is all possible through the mail.message model and a hidden many2many field on the mail.message model. To do so, we are going to proceed in 4-5 steps (depending on how you want to divide your work flow): 

  1. Import all your attachments with the following fields: 
    1. External ID: The external ID of my attachment.
    2. Name ("name"): Name of the attachment.
    3. Type ("type"): Type of the attachment, URL or a file. Here I am going to import the attachment in a base64 format so I will select the "File" type. 
    4. File Content (base64) ("datas"): This is the content of your attachment directly. If the type is URL, we will have the "Url" field. I will focus on the former here.
  2. Export the models and record's database ID on which you will want to link the attachment to. This will be helpful to get the database ID for the following step. You can also retrieve the ID of the record from the URL, you just need to find "id=112" for instance.

  3. Import the messages on which you want to link the attachments with the following fields.
    1. External ID: The external ID of the chatter message. 
    2. Type ("type"): Here, I believe it is better to import on the "Comment" type so that your message stays internal to Odoo. It does not really matter at this point of the process but as the field is mandatory, we need to tell which type we need. 
    3. Related Document Model ("model"): This is the model on which you want to link the attachment
    4. Related Document ID ("res_id"): This is the ID (Database ID not the external ID) of the record on which you want to make the import. Just a reminder that the Database ID is unique per model and that the External ID is unique on the whole database). Note also that you will need to make an export of this as you cannot create/edit the ID. 
    5. You can add a subject (on "subject") and a body (on "body") so that the message looks cleaner.

  4. Add the many2many field pointing to ir.attachments (in the existing fields) to the mail.message model. You can do it as follow: https://watch.screencastify.com/v/0wNIkBbRsxtTEcrVItbO


  5. Import a mapping file on mail.message with the following fields: 
    1. External ID ("id"): This enables you to update the message record. 
    2. Attachments/External ID ("attachment_ids/id"): This will make the link between the ir.attachment model being the attachment and the message on which you want to make the import. 



Please find here a video on how I managed to do it. Note that I made step 1 in 2 steps as imported my content in a second step: https://watch.screencastify.com/v/xBFBq2v1SVpExbUMdnAv  


Note: Be aware that the order in which the messages (from mail.message) will be displayed is not based on the date field but on the order of the ID of the message. This means that if I have 2 messages A & B with respectively a date in 2021 and 2022 and that A has ID 5 and B ID 4, B will be displayed on the bottom and A on top. 


Please do not hesitate to reach out if you have any questions!

2
Avatar
Vazgeç
Niswatus Syuyukhoh

I cant open your video link. I want to view the pdf without download it.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
How it works: Product Costing, accounting for the value of products in real-time Çözüldü
quickstart
Avatar
1
Eyl 25
5361
✅Change the Account on Payments in Odoo
quickstart
Avatar
0
Mar 25
2157
✅Change the Account on Payments in Odoo
quickstart
Avatar
1
Mar 25
30
✅ Change the order date to the Old date
quickstart
Avatar
0
Mar 25
1866
Plugin ALMA
quickstart
Avatar
Avatar
Avatar
Avatar
3
Eyl 24
11078
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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