Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Using PDF viewer widget without uploading an image

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
pdfwidgetlinkautomationviewer
1 Répondre
6208 Vues
Avatar
Boris

I would like to use the pdf viewer widget. I know that to display the pdf/image you have to have it downloaded to a directory so that you can pull it from there. But I wonder if there is a way to show image without uploading it. Is there is a way to use an image viewer/pdf widget that can accept a link that can be programmed into a database?

0
Avatar
Ignorer
Avatar
shubham shiroya
Meilleure réponse

you can try this way:
Create a New Field:
Add a new field to your model that will store the URL of the image or PDF you want to display.
from odoo import fields, models


class MyModel(models.Model):

_name = 'my.model'

_description = 'My Model'


image_url = fields.Char(string="Image URL")


Modify the Form View: In your form view, you can use the widget attribute to display the image or PDF using an external URL
record id="view_my_model_form" model="" rel="ugc">ir.ui.view">

field name="name">my.model.form

field name="model">my.model

field name="arch" type="xml">

form>

group>

field name="image_url" widget="image" options="{'preview_image': 'url'}"/>

/group>

/form>

/field>

/record>


  1. In this example, the widget attribute is set to "image" to display an image. The options attribute specifies that the URL should be used as the image source.

  2. Input Image URLs: Now you can input external image URLs directly into the image_url field of your model. This URL can point to an image or a PDF file.


0
Avatar
Ignorer
Boris
Auteur

Thank you for this info @ shubham shiroya

I added the field and modified the form view.
When I checked the table in the database, I can see that the new field image_url has been successfully created there.

This is the updated form view:
<record id="vendor_bill_form" model="ir.ui.view">
<field name="name">vendor_bill_form</field>
<field name="model">vendor.bill</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<group>
<field name="image_url" widget="image" options="{'preview_image':
'https://www.usnews.com/media/best-states/overall-rankings-2021.pdf'}"/>
</group>
</form>
</field>
</record>

And this is my new added field in my model:
image_url = fields.Char(string="Image URL")

Just for an example, I inputted that external link shown above.
But when I update the module, that URL is not being displayed. What can I do to fix it?

Boris
Auteur

I also tried to apply the options attribute to the pdf widget, instead of image widget:
<group>
<field name="file" class="pdf_viewer" widget="pdf_viewer" options="{'preview_image':
'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'}" />
/group>

In this case, when I update the module, if I don't have an image uploaded already, then the pdf file states as missing PDF file:
PDF.js v2.2.228 (build: d7afb74a)
Message: Missing PDF "http://localhost:8069/web/content?model=vendor.bill&field=https%3A%2F%2Fwww.google.com%2Fimages%2Fbranding%2Fgooglelogo%2F1x%2Fgooglelogo_color_272x92dp.png&id=3".

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Is it possible to change the height of a binary field that uses the pdf_viewer widget? Résolu
pdf widget Community V11 viewer
Avatar
1
juil. 20
6326
pdf_viewer widget error
pdf widget
Avatar
0
sept. 24
1837
linking different translations
pdf translations link
Avatar
Avatar
1
août 20
1629
Odoo 10: widget='pdf_viewer', download option doesn't appear when the field is defined inside notebook.
pdf widget odoo10
Avatar
0
nov. 16
7426
How to Display Each Item in List with Custom XML
pdf xml widget foreach
Avatar
1
juil. 20
7023
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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