Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Products' images URL

Odebírat

Get notified when there's activity on this post

This question has been flagged
publicintergationurlimages
6 Odpovědi
45157 Zobrazení
Avatar
arthur

Hello, I am trying to sync odoo with an existing ecommerce platform. Right now, I am trying to upload products from odoo to this platform. In order to upload the product image, I have to send the image url.

I tried to do so through the path /web/image?model=product.template&id={{product.id}}&field=image
But it didn't work, since the url doesn't return the image file.

I also tried to use the path /web/image/product.template/{{product.id}}/image
In this case it didn't work either, because of a 403 - Forbidden error, which I also get when trying to make a GET request using Postman.

Is there a way I can make this URL public? (because the ecommerce I and integrating with, I can't pass access data or such). If not, is there any other URL I might use?

1
Avatar
Zrušit
Avatar
Yenthe Van Ginneken (Mainframe Monkey)
Nejlepší odpověď

Hi Arthur,

By default the images are stored in the database in a base64 format so they're not really stored as an attachment. If you have the image as an attachment on the product you can create a public URL for it as you can look at the paths from the fields 'local_url' and 'website_url' (from the model ir.attachment) to make a full URL to your image(s). This way you could provide links but then you have to attach the images as an attachment on the products. I've added those two fields to the view from the ir.attachment model so that you can see how the path is built:


If you combine that path (so /web/image/2259?unique=4db4955a92a769b04b4320af6235fdccf8cdf016) with the basic URL of your website (in this case http://422032-11-0-fa8705.runbot15.odoo.com) you'll get a full URL to the image. Being http://422032-11-0-fa8705.runbot15.odoo.com/web/image/2259?unique=4db4955a92a769b04b4320af6235fdccf8cdf016 in this sample. The result after you navigate to this URL is your image:


I can't imagine that you're trying to connect with another ecommerce tool that has literally no way to get values through any protocol from another instance though. Are you really sure you can't? You can use xml-rpc to easily get the base64 images from any product in a matter of seconds.

Regards,
Yenthe

2
Avatar
Zrušit
arthur
Autor

Thanks for your response Yenthe, it helped clarifying things.

I was able to create attachments with the following function:

class ProductTemplate(models.Model):

_inherit = 'product.template'

@api.multi

def create_image_attachment(self, product):

image = self.env['ir.attachment'].create(dict(

datas_fname="Test.png",

name="Image - " + product.name,

datas=product.image,

mimetype='application/png',

res_model='product.template',

res_id=product.id,

))

return image

If I go to the product.template form view, I can download the attachments created and they are download correctly. However, if i try to download the image through the 'image_attachment.local_url', the file I download doesn't have the right name or extension.

Any idea of what I am missing?

Thanks

arthur
Autor

Just managed to fix it. I just had to mimetype to 'image/jpeg'.

Still, the path provided by .local_url is not public. Is there a way I can make it public?

arthur
Autor

Just managed to fix it. I just had to mimetype to 'image/jpeg'.

Still, the path provided by .local_url is not public. Is there a way I can make it public?

Kestutis Urbonas

Trying to import products from odoo export file. Image field is there. Getting error: Found invalid image data, images should be imported as either URLs or base64-encoded data.

Any idea ?

I though that that field is base64 encoded. Am I wrong ?

Avatar
Ahmad Rahban
Nejlepší odpověď

I managed to solve this issue by doing it manually.. I used a free app called "image from url" and pasted the image url there and then exported the value of the image_from_url field which's the image link!


0
Avatar
Zrušit
Avatar
fudo
Nejlepší odpověď

Currently, to get the product image as url, we could use:

from odoo.tools.image import image_data_uri

product_image = image_data_uri(product.image_1920)

In my case,  product.image_1920 is the column of saved product image, you can replace it with your column to make it work.

Note: after get  product_image, you can see it still look like base64 encrypted format, but it's not, try to paste it to web browser such as Chrome, and you will see the image appear.

0
Avatar
Zrušit
Grzegorz Goraj

I can see the binary of the image...

Avatar
Stefano Savanelli
Nejlepší odpověď

/

By default the images are **NOT** stored in the database, but in filestore.

In ir_attachment table for images  by  default  type  field  is  set  to  "binary"  and  store_fname field is  set  to  filestore path of the file.

Other behavior  can  be  set  by  config  or  by  addons.

0
Avatar
Zrušit
Avatar
arthur
Autor Nejlepší odpověď

I managed to create the attachment and get its .local_url. However the route is also private. Is there a way can make it public?

0
Avatar
Zrušit
Avatar
Jhe
Nejlepší odpověď

I have same issue, is there any solution?

0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Get image (field Binary) for public user
public images
Avatar
0
dub 24
1884
How to create a public url to download an attachment? Vyřešeno
public attachment url download
Avatar
1
úno 17
24322
Products image from URL, csv.
product url images ascii
Avatar
Avatar
2
pro 16
5190
[ODOO13] Create a link to the res partner image
res.partner attachments url images Odoo13.0
Avatar
0
dub 21
3842
Suggestion for image management for the website, mailings...
images
Avatar
0
čvn 25
3422
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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