Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Link attachments with wanted record and model

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
quickstart
1 Odpowiedz
10100 Widoki
Awatar
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
Awatar
Odrzuć
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.

Awatar
Adrien Konopek (adko)
Autor Najlepsza odpowiedź

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
Awatar
Odrzuć
Niswatus Syuyukhoh

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

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
How it works: Product Costing, accounting for the value of products in real-time Rozwiązane
quickstart
Awatar
1
wrz 25
5379
✅Change the Account on Payments in Odoo
quickstart
Awatar
0
mar 25
2189
✅Change the Account on Payments in Odoo
quickstart
Awatar
1
mar 25
30
✅ Change the order date to the Old date
quickstart
Awatar
0
mar 25
1896
Plugin ALMA
quickstart
Awatar
Awatar
Awatar
Awatar
3
wrz 24
11128
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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