跳至内容
Odoo 菜单
  • 登录
  • 免费试用
  • 应用程序
    财务
    • 会计
    • 发票
    • 费用
    • 电子表格 (BI)
    • 文档
    • 电子签名
    销售
    • 客户关系管理
    • 销售
    • POS 销售点管理-零售
    • POS 销售点管理 - 餐厅
    • 订阅
    • 租赁
    网站
    • 网站设计
    • 电子商务
    • 博客
    • 论坛
    • 在线客服
    • 在线学习
    供应链
    • 库存
    • 制造
    • 产品生命周期
    • 采购
    • 维护保养
    • 品控
    人力资源
    • 员工
    • 招聘
    • 休假
    • 评价
    • 内部推荐
    • 车队
    营销
    • 社媒营销
    • 电邮营销
    • 短信营销
    • 近期活动
    • 营销自动化
    • 网上调查
    服务
    • 项目管理
    • 工时单
    • 现场服务
    • 服务台
    • 排期
    • 预约
    生产力
    • 讨论
    • 批核
    • IoT物联网
    • VoIP
    • 知识库
    • WhatsApp
    第三方应用软件 Odoo 定制 Odoo云端平台
  • 行业
    零售
    • 书店
    • 服装店
    • 家具店
    • 食品杂货店
    • 五金店
    • 玩具店
    餐饮与酒店服务
    • 酒吧及酒馆
    • 餐厅
    • 快餐
    • 民宿
    • 饮品分销商
    • 酒店
    房地产
    • 房地产代理
    • 建筑师事务所
    • 建造业
    • 地产管理
    • 园艺
    • 业主协会
    咨询
    • 会计师事务所
    • Odoo合作伙伴
    • 市场推广公司
    • 律师事务所
    • 人才招聘
    • 审核 & 认证
    制造
    • 纺织
    • 金属
    • 家具
    • 食品
    • 啤酒厂
    • 企业礼品
    保健与健身
    • 体育俱乐部
    • 眼镜店
    • 健身中心
    • 健康从业者
    • 药房
    • 发型屋
    Trades
    • 维修人员
    • IT 硬件及支持
    • 太阳能系统
    • 鞋匠
    • 清洁服务
    • 暖通空调服务
    其他
    • 非营利组织
    • 环境机构
    • 广告牌租赁
    • 摄影服务
    • 自行车租赁
    • 软件经销商
    浏览所有行业
  • 社区
    学习
    • 教学视频
    • 文档
    • 认证
    • 培训
    • 博客
    • 播客
    赋能教育
    • 教育计划
    • Scale Up! 商业游戏
    • 参观Odoo
    获取软件
    • 下载
    • 版本对比
    • 发布
    合作
    • Github
    • 论坛
    • 近期活动
    • 翻译
    • 成为合作伙伴
    • 合作伙伴服务
    • 注册您的会计事务所
    获取服务
    • 寻找合作伙伴
    • 查找会计服务
    • 预约顾问咨询
    • 安装及推行服务
    • 客户参考
    • 支持
    • 升级
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    获取演示
  • 定价
  • 技术支持

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

  • 客户关系管理
  • e-Commerce
  • 会计
  • 库存
  • PoS
  • 项目
  • MRP
All apps
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
帮助

Show product image and sales description on picking & delivery app

订阅

此帖文有活动时,接收通知

此问题已终结
imageinventorypicking
2 回复
1435 查看
形象
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
形象
丢弃
Christoph Farnleitner

What version of Odoo?

形象
Cybrosys Techno Solutions Pvt.Ltd
最佳答案

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
形象
丢弃
形象
Piyush H
最佳答案

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
形象
丢弃
喜欢讨论吗?不要只阅读,加入进来!

立即创建账户,享受专属功能,与我们的精彩社区互动!

注册
相关帖文 回复 查看 活动
Picking Customization Option
warehouses inventory picking
形象
形象
1
5月 25
2076
Version 16EE Two step delivery of inventory randomly changes to one step delivery.
inventory picking Rules
形象
0
12月 24
1799
Inventory Packages inside one container package
inventory picking storage
形象
0
5月 23
2260
If a full package quantity is ordered, pick from a location containing the full quantity
inventory picking packagings
形象
形象
1
4月 23
3350
PoS Sale from 2 locations
pos inventory picking
形象
形象
形象
3
5月 18
6192
社区
  • 教学视频
  • 文档
  • 论坛
开源
  • 下载
  • Github
  • Runbot
  • 翻译
服务
  • Odoo.sh 托管
  • 支持
  • 升级
  • 自定义开发服务
  • 教育
  • 查找会计服务
  • 寻找合作伙伴
  • 成为合作伙伴
关于我们
  • 我们的公司
  • 品牌资产
  • 联系我们
  • 招聘
  • 近期活动
  • 播客
  • 博客
  • 客户
  • 法律 • 隐私
  • 安全
الْعَرَبيّة 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致力于为企业管理提供高效智能的开源解决方案,是全球业内高速成长的软件服务商之一,逾七百五十万用户选择Odoo进行数字化升级。通过一系列全业务链覆盖、高度集成、简单易用的商业应用,助力企业实现信息化改革、降本增效并释放公司增长潜力。

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