Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

[Odoo12.0] How to display image in kanban view?

Subscribe

Get notified when there's activity on this post

This question has been flagged
imageviewvalueskanbanraw
9 Replies
30828 Views
Avatar
Jignesh Mehta

Hello,

I have 1 custom class and there are fields in it. When I create kanban view for that, I am facing below error.

test.py :-

class Test(models.Model):
    _name = 'test.test'
    _description = 'Test'

    name = fields.Char('Name')
    product_id = fields.Many2one('product.product', 'Product')
    image_medium = fields.Binary('Image', related='product_id.image_medium')

test_view.xml :-

<odoo>
    <record id="test_kanban_view" model="ir.ui.view">
        <field name="name">test.test.kanban.view</field>
        <field name="model">test.test</field>
        <field name="arch" type="xml">
            <kanban>
                <field name="name"/>
                <field name="image_medium"/>
                <templates>
                    <t t-name="kanban-box">
                        <div t-attf-class="oe_kanban_global_click">
                            <div class="oe_kanban_details">
                                <div class="row">
                                    <div class="col-md-3">
                                        <div class="o_kanban_image">
                                            <img t-att-src="kanban_image('test.test','image_medium',record.id.raw_value)" alt="Image"/>
                                        </div>
                                    </div>
                                    <div class="col-md-5">
                                        <strong><field name="name"/></strong>
                                        <div name="tags"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>
</odoo>

Error :-

Uncaught TypeError: Cannot read property 'raw_value' of undefined
http://0.0.0.0:9898/web?debug#action=371&model=work.order&view_type=list&menu_id=241:16
Traceback:
TypeError: Cannot read property 'raw_value' of undefined
    at Engine.eval (eval at _render (http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:3416:73), <anonymous>:16:120)
    at Engine._render (http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:3415:296)
    at Engine.render (http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:3415:151)
    at Engine._render (http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:3419:57)
    at Engine.render (http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:3415:151)
    at Class._render (http://0.0.0.0:9898/web/content/373-51b7014/web.assets_backend.js:1780:132)
    at Class.start (http://0.0.0.0:9898/web/content/373-51b7014/web.assets_backend.js:1770:1256)
    at Class.prototype.(anonymous function) [as start] (http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:3537:488)
    at http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:3682:52
    at http://0.0.0.0:9898/web/content/341-db51ea1/web.assets_common.js:802:681


How can I solve this error ?
Any answer will be appreciable.

Thanks,

2
Avatar
Discard
Avatar
Ramla
Best Answer

<odoo>

<record id="test_kanban_view" model="ir.ui.view">

<field name="name">test.test.kanban.view</field>

<field name="model">test.test</field>

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

<kanban>

<field name="id"/>

<field name="name"/>

<field name="image_medium"/>

<templates>

<t t-name="kanban-box">

<div t-attf-class="oe_kanban_global_click">

<div class="oe_kanban_details">

<div class="row">

<div class="col-md-3">

<div class="o_kanban_image">

<img t-att-src="kanban_image('test.test','image_medium',record.id.raw_value)"/>

</div>

</div>

<div class="col-md-5">

<strong><field name="name"/></strong>

<div name="tags"/>

</div>

</div>

</div>

</div>

</t>

</templates>

</kanban>

</field>

</record>

</odoo>

2
Avatar
Discard
Jignesh Mehta
Author

Thank you so much for your answer. In odoo12, we have to define <field name="id"/> which is not compulsory in odoo10.

Ramla

You are welcome

vrushparva vaishnav

I had the same problem. solved by define id field in before <template/>

Avatar
Francisco Alvarez Ortiz
Best Answer

hello, you need to place the product_id field before <template>

I have the same problem:

See how i solved it:

<kanban>

 <field name="name"/>

 <field name="estate_id"/> 

 <templates> <t t-name="kanban-box"> <div class="oe_kanban_global_click"> <div class="o_kanban_image"> 

 <img t-att-src="kanban_image('estates.estate', 'image', record.estate_id.raw_value)" /> 

 <div class="o_kanban_card_content"> <div class="oe_kanban_details">
<div><strong><field name="email"/></strong></div>

 <div><field name="street"/></div> 

 <div><field name="mobile"/></div> <div><field name="phone"/></div> </div> </div> </div> </t> </templates> 

 </kanban>

estate_id is declared in my class


0
Avatar
Discard
Avatar
Kiran
Best Answer

Hello,

you can Simply use in kanban view <field > tag instead of <img> tag. like see in below code.

<field name="image_medium" nolabel="1" widget="image" class="oe_right oe_avatar"/>


it's worked for me

Thanks.

0
Avatar
Discard
Avatar
Hilar Andikkadavath
Best Answer

Make your image field storable in DB, if its a related field.


    image_medium = fields.Binary('Image', related='product_id.image_medium', store=True)

0
Avatar
Discard
Jignesh Mehta
Author

Thanks for your answer, but i still get same error after add store=True in field definition.

Jignesh Mehta
Author

Hello @Hilar AK, I tried with remove related field but same issue occurs. Can you help me on this ? Thanks,

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

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

Sign up
Related Posts Replies Views Activity
TypeError: dict.record.id is undefined when I access to my custom kanban view in Odoo 11 Solved
image view kanban odoo typeError
Avatar
Avatar
Avatar
2
May 20
11186
Create Kanban View from Developer Mode
view kanban
Avatar
Avatar
Avatar
2
May 20
6693
How do I attach imagees in a kanban view? Odoo 11.0 Solved
view kanban
Avatar
Avatar
1
Feb 19
7636
how to show all the kanban state
view kanban
Avatar
0
Jan 19
6475
Design an Image gallery so that one can see pictures upladed by admin and rsize it as per as wish?
image kanban
Avatar
0
Apr 16
2938
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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