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

image url / image from attachments

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
imagefilestoreattachmentsurl
3 Odpowiedzi
28020 Widoki
Awatar
Ahmed Ramzy

hello .. this is the 3rd time to ask my question ...


i have some images stored in file store .. i want to display them in my form view so how can i do it ?

is there anyway to use image url to display it or not ?
or if any another way



Thank you ~!

1
Awatar
Odrzuć
Axel Mendoza

H Ahmed, sorry for the delay in responses, please provide more info for a proper answer, there are some ways to get it done

Awatar
Axel Mendoza
Najlepsza odpowiedź
Hi Ahmed
If your record have a relation Many2one field with the attachment you could use a related field to display the datas binary computed field
if not and you are still able to get the attachment id somehow you could build the url for the image using this format
/web/content/<int:id>
replacing <int:id> with the attachment id, that url need to be used in an img tag src to be able to properly show the image. You could display it using one of this 2 ways:

1- Overriding the method fields_view_get in you model to set the src attr of the img tag by using xpath and python code (the hard way). For example put this in your form
<img class="img-url-set"/>
And usign xpath locate that node in the form to set the attribute src with the url value

2- By using an HTML calculated field that contains the dynamic html code for the src of the img tag. For example
define a field html that build the whole html for the image like:
img_attach = fields.Html('Image', compute="_get_img_html")

def _get_img_html(self):
    for elem in self:
        img_url = '/web/content/%s' % attachment_id
        elem.img_attach = '<img src="%s"/>' % img_url
Just add that field img_attach in the form and set it as readonly to be able to display your image
Hope this helps
1
Awatar
Odrzuć
Bienvenido Villabroza

I have been trying to follow along but I do not know how to obtain my attachment_id.. I am using Odoo 13 and my attachment is stored in a fields.Binary with attachment=True. How do I get the img_url?

Axel Mendoza

You could use the same domain that Odoo use to locate the attachment associated with a Binary field with attachment=True

domain = [

('res_model', '=', record._name),

('res_field', '=', field_name),

('res_id', '=', record.id),

]

attach_id = self.env['ir.attachment'].sudo().search(domain)

Awatar
Hilar Andikkadavath
Najlepsza odpowiedź

You can use a python script to read a file and store it in ir_attachments and display in your form or whatever you need. you can also use custom models by inheriting ir_attachments.

0
Awatar
Odrzuć
Awatar
Kashif Aziz
Najlepsza odpowiedź

use our module it has code and guideline about it https://apps.odoo.com/apps/modules/13.0/ir_attachement_customization/

-2
Awatar
Odrzuć
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ść
Add an image URL on Media center and save to server file system.
image filestore url media
Awatar
0
cze 23
6077
TypeError: Cannot read properties of undefined (reading 'url')
image url
Awatar
Awatar
Awatar
2
lip 22
12933
How to upload a .doc/.pdf file through a button click from form view
filestore attachments
Awatar
Awatar
1
sie 20
8942
Moving database to other server - some website images do not display
image move url
Awatar
Awatar
2
lip 23
4169
Contact image via url Rozwiązane
image url odoo11.0
Awatar
Awatar
Awatar
2
wrz 21
8950
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