Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Show product image and sales description on picking & delivery app

Subscriure's

Get notified when there's activity on this post

This question has been flagged
imageinventorypicking
2 Respostes
1500 Vistes
Avatar
Yuqi Li

Hello every, I'm trying to add product image and sales description on picking & delivery app(note: not printed report). When you try to mark inventory, you need click Inverntory from Home page and click either picking/ delivery. After jumping to picking/ delivery page, you will see product name and quantity required. At this section, I hope to add product image & sales description next to product name. 

I'm not familiar with python, so please send step by step image and code. Thank you very much.

0
Avatar
Descartar
Christoph Farnleitner

What version of Odoo?

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,


Try the following code to add the product image to the delivery line.

1- Inherit the model 'stock.move' and define the image field.

Python

from odoo import fields, models


class StockMove(models.Model):
"""Inherits the model stock move to add image field"""
_inherit = 'stock.move'

order_line_image = fields.Binary(string="Image",
related="product_id.image_1920",
help='Product Image in Sale orderLine')

2- Add the field in to the XML view.

    <field name="name">
stock.picking.view.form.inherit.order.line
</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_ids_without_package']//list//field[@name='product_id']"
position="after">
<field name="order_line_image" widget="image"
style="height:30px ;width:30px;" readonly="1"/>
</xpath>
</field>
</record>

3- Make sure that the Python file is added to the init file and the path of the XML file is added in the manifest file.

4- Result.



For more reference,

* https://apps.odoo.com/apps/modules/18.0/sale_product_image

* https://www.odoo.com/sl_SI/forum/pomoc-1/add-the-product-image-to-the-line-item-on-a-sales-and-purchase-order-252695


Hope it helps

0
Avatar
Descartar
Avatar
Piyush H
Best Answer

Hey Yuqi,

Important Prerequisites:

  • Odoo Version: This guide assumes you're using a relatively recent version of Odoo (14 or later). The steps should be similar in older versions, but the interface might look slightly different.
  • Developer Mode: Make sure you have activated developer mode in Odoo. (Settings > Activate the developer mode).

Step-by-Step Guide:

Step 1: Identify the Correct View

  1. Navigate to Picking/Delivery: Go to the Inventory app. Click on "Operations" and then either "Pickings" or "Deliveries" (depending on which one you want to modify).
  2. Open a Record: Open any existing picking or delivery order.
  3. Activate Debug Mode: Make sure you're in developer mode.
  4. Inspect the View: Click the Debug View icon (the bug icon in the top right corner).
  5. Choose "View: Form" or "View: Tree":
    • If you want to modify the form view (the detailed view of a picking), choose "View: Form".
    • If you want to modify the list view (the list of products within a picking), choose "View: Tree".
  6. Note the View ID: A popup will appear. Look for the "External ID". This is the technical name of the view. It will look something like stock.view_picking_form (for the form view) or stock.move.line.tree (for the tree view). Write this down! This is crucial.

Step 2: Create the Inherited View

  1. Go to Views: Go to Settings > Technical > User Interface > Views.
  2. Create a New View: Click "Create".
  3. Fill in the View Information:
    • View Name: Give it a descriptive name (e.g., picking_product_image_form or picking_product_image_tree).
    • Inherited View: Check the box next to "Inherited View".
    • Inherit From: In the "Inherit From" field, enter the External ID you wrote down in Step 1 (e.g., stock.view_picking_form or stock.move.line.tree).
    • Architecture: Leave this blank for now.

Step 3: Add the XML Code

  1. Choose the Correct XML Code: The XML code will depend on whether you're modifying the form view or the tree view.
    • Form View (Modifying the detailed picking view):
      <record id="picking_product_image_form" model="ir.ui.view">
          <field name="name">picking.product.image.form</field>
          <field name="inherit_id" ref="stock.view_picking_form"/>  <!-- REPLACE WITH YOUR VIEW ID -->
          <field name="arch" type="xml">
              <xpath expr="//field[@name='product_id']" position="after">
                  <field name="product_id.image_1920" widget="image" class="oe_avatar"/>
                  <field name="product_id.description_sale"/>
              </xpath>
          </field>
      </record>
      
    • Tree View (Modifying the list of products within the picking):
      <record id="picking_product_image_tree" model="ir.ui.view">
          <field name="name">picking.product.image.tree</field>
          <field name="inherit_id" ref="stock.move_line_tree"/>  <!-- REPLACE WITH YOUR VIEW ID -->
          <field name="arch" type="xml">
              <xpath expr="//field[@name='product_id']" position="before">
                  <field name="product_id.image_128" widget="image" style="width: 40px; height: 40px;"/>
              </xpath>
              <xpath expr="//field[@name='product_id']" position="after">
                  <field name="product_id.description_sale"/>
              </xpath>
          </field>
      </record>
      
  2. Paste the Code: Copy the appropriate XML code (either the form view or the tree view code) and paste it into the "Architecture" field of the view you're creating.
  3. Replace the View ID: IMPORTANT: In the XML code, find the line that says <field name="inherit_id" ref="YOUR_VIEW_ID"/>. Replace YOUR_VIEW_ID with the External ID you wrote down in Step 1. For example, if your External ID was stock.view_picking_form, the line should look like this: <field name="inherit_id" ref="stock.view_picking_form"/>.
  4. Save the View: Click "Save" to save the view.

Step 4: Clear Odoo's Cache

  1. Go to Reload Server Registry: Go to Settings > Technical > Actions > Reload Server Registry.
  2. Click "Reload Server Registry": Click the "Reload Server Registry" button. This clears Odoo's cache and forces it to recognize your changes.

Step 5: Test and Adjust

  1. Go Back to Picking/Delivery: Go back to the Inventory app and open a picking or delivery order.
  2. Check for the Image and Description: See if the product image and sales description are now displayed in the view you modified.
  3. Adjust if Necessary:
    • Image Size: If the image is too large or too small, you can adjust the width and height attributes in the XML code (in the <field> tag for the image). You can also try using a different image field (e.g., image_128 instead of image_1920 for a smaller image).
    • Description Placement: If the description is not in the right place, you might need to adjust the xpath expression. The xpath tells Odoo where to insert the new fields. Inspect the original view's XML (using the "View Architecture" option in developer mode) to find the correct location.

Explanation of the XML Code:

  • <record id="unique_id" model="ir.ui.view">: This creates a new view record in Odoo. The id should be a unique identifier for your view.
  • <field name="name">view.name</field>: This gives your view a name.
  • <field name="inherit_id" ref="original_view_id"/>: This tells Odoo that you're inheriting from an existing view. original_view_id is the External ID of the view you're modifying.
  • <field name="arch" type="xml">: This contains the XML code that defines the changes you're making to the view.
  • <xpath expr="//some/xpath/expression" position="after|before|inside|replace">: This is the most important part. It tells Odoo where to insert your new code.
    • expr="//some/xpath/expression": This is an XPath expression that selects a specific element in the original view's XML. You need to find the correct XPath expression to insert your code in the right place.
    • position="after|before|inside|replace": This tells Odoo how to insert your code:
      • after: Insert the code after the selected element.
      • before: Insert the code before the selected element.
      • inside: Insert the code inside the selected element (as a child element).
      • replace: Replace the selected element with your code.
  • <field name="product_id.image_1920" widget="image"/>: This adds the product image. product_id.image_1920 refers to the image_1920 field of the product_id (which is the product). widget="image" tells Odoo to display it as an image.
  • <field name="product_id.description_sale"/>: This adds the sales description.

Troubleshooting:

  • Nothing Happens:
    • Make sure you cleared the cache (Reload Server Registry).
    • Double-check that you entered the correct External ID in the inherit_id field.
    • Double-check that your XPath expression is correct.
  • Error Message:
    • Read the error message carefully. It will usually tell you what's wrong (e.g., invalid XML syntax, invalid XPath expression).
  • Image Not Displaying:
    • Make sure the product actually has an image.
    • Try using a different image field (e.g., image_128).
    • Check the image size and adjust the width and height attributes.
  • Description Not Displaying:
    • Make sure the product actually has a sales description.
    • Double-check that the field name is correct (description_sale).

This is a detailed guide, but it requires careful attention to detail. The most important parts are identifying the correct view, using the correct XML code, and making sure your XPath expression is correct. Good luck!

🚀 Did This Solve Your Problem?

If this answer helped you save time, money, or frustration, consider:

✅ Upvoting (👍) to help others find it faster

✅ Marking as "Best Answer" if it resolved your issue

Your feedback keeps the Odoo community strong! 💪

(Need further customization? Drop a comment—I’m happy to refine the solution!)

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
Picking Customization Option
warehouses inventory picking
Avatar
Avatar
1
de maig 25
2148
Version 16EE Two step delivery of inventory randomly changes to one step delivery.
inventory picking Rules
Avatar
0
de des. 24
1854
Inventory Packages inside one container package
inventory picking storage
Avatar
0
de maig 23
2323
If a full package quantity is ordered, pick from a location containing the full quantity
inventory picking packagings
Avatar
Avatar
1
d’abr. 23
3394
PoS Sale from 2 locations
pos inventory picking
Avatar
Avatar
Avatar
3
de maig 18
6256
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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