Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

image url / image from attachments

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
imagefilestoreattachmentsurl
3 Replies
28028 Tampilan
Avatar
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
Avatar
Buang
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

Avatar
Axel Mendoza
Jawaban Terbai
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
Avatar
Buang
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)

Avatar
Hilar Andikkadavath
Jawaban Terbai

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
Avatar
Buang
Avatar
Kashif Aziz
Jawaban Terbai

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

-2
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Add an image URL on Media center and save to server file system.
image filestore url media
Avatar
0
Jun 23
6091
TypeError: Cannot read properties of undefined (reading 'url')
image url
Avatar
Avatar
Avatar
2
Jul 22
12949
How to upload a .doc/.pdf file through a button click from form view
filestore attachments
Avatar
Avatar
1
Agu 20
8950
Moving database to other server - some website images do not display
image move url
Avatar
Avatar
2
Jul 23
4177
Contact image via url Diselesaikan
image url odoo11.0
Avatar
Avatar
Avatar
2
Sep 21
8954
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik 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