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

How to traverse a field value of another model in kanban view?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
qwebkanbanopenerp8odoo
1 Respondre
7193 Vistes
Avatar
manuthalasseril

Hi friends, I have two models called Gallery and GalleryLine

class Gallery(models.Model):
_name = 'website.gallery'
name = fields.Char(string="Album Name", required=True)
media_lines = fields.One2many('website.gallery.line.medias', 'gallery_id', string="Media Lines")
class GalleryLine(models.Model): 
_name = 'website.gallery.line'
def get_default_image(self):
image_path = get_module_resource('website_gallery', 'static/src/images', 'default_image.png')
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
@api.depends('image')
def _compute_thumbnail_image(self):
size = (300, 225)
for record in self:
self.thumbnail_image = tools.image_resize_image(self.image, size)
name = fields.Char(string="Media Name", required=True)
media_type = fields.Selection(selection=[
('image', 'Image'),
('video', 'Youtube Video'),
], string="Media Type", default='image', required=True)
image = fields.Binary(string="Image", default=get_default_image)
thumbnail_image = fields.Binary(string="Thumbnail Image", compute='_compute_thumbnail_image')
video = fields.Text(string="Video", translate=False)
gallery_id = fields.Many2one(comodel_name='website.gallery', delegate=True, required=True, string="Album Name")

And I created a kanban view which was given below  

<record model="ir.ui.view" id="view_gallery_albums_kanban">
<field name="name">gallery.albums.kanban</field>
<field name="model">website.gallery</field>
<field name="type">kanban</field>
<field name="arch" type="xml">
<kanban class="oe_background_grey">
<field name="name" />
<field name="description" />
<field name="sequence" />
<field name="media_lines" />
<templates>
<t t-name="kanban-box">
<a name="%(website_gallery.view_gallery_media)d" type="action"
class="oe_sparkline_bar_link">
<div class="oe_kanban_card oe_kanban_global_click">
<div class="oe_kanban_content">
<h4 class="text-center" name="name">
<strong>
<field name="name" />
</strong>
</h4>
<div class="oe_clear"></div>
<!-- -->
<div class="oe_kanban_gallery_avatars">
<t t-foreach="record.media_lines.raw_value.slice(0,3)"
t-as="image">
<img t-if="record.media_lines.media_type.raw_value=='image'"
t-att-src="kanban_image('website.gallery.line.medias', 'image', image)"
t-att-data-member_id="image" />
<t t-if="record.media_lines.media_type.raw_value=='video'">
<!-- Something other -->
</t>
</t>
</div>
<!-- -->
<div class="oe_clear"></div>
<div class="oe_center oe_gallery_description text-center"
name="description">
<field name="description" />
</div>
</div>
</div>
</a>
</t>
</templates>
</kanban>
</field>
</record>

I have problem exactly on this line

<t t-foreach="record.media_lines.raw_value.slice(0,3)"
t-as="image">
<img t-if="record.media_lines.media_type.raw_value=='image'"
t-att-src="kanban_image('website.gallery.line.medias', 'image', image)"
t-att-data-member_id="image" />
<t t-if="record.media_lines.media_type.raw_value=='video'">
<!-- Something other -->
</t>
</t>

I will getting this error:

Error: QWeb2 - template['kanban-box']: Runtime Error: TypeError: dict.record.media_lines.media_type is undefined

How can we achieve to take the field value of another model in kanban view? Thanks in advance..







0
Avatar
Descartar
Avatar
Axel Mendoza
Best Answer

If you are iterating on record.media_lines and using every result as the image variable on every iteration of the loop you need to use image.medi_type in your expressions inside the loop

1
Avatar
Descartar
manuthalasseril
Autor

No its not working on kanban view...

manuthalasseril
Autor

No its not working on kanban view...

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
How to get the URL of the PDF report (qweb report)
qweb odoo
Avatar
Avatar
Avatar
2
de jul. 23
8594
Pass values ​​from one stage to another in kanban view, odoo 14[SOLVED] Solved
kanban odoo
Avatar
Avatar
1
de juny 23
3558
Header hides body information in qweb report[SOLVED] Solved
qweb odoo
Avatar
Avatar
1
de juny 23
5604
How to get the URL of the PDF report (qweb report)
qweb odoo
Avatar
Avatar
1
d’abr. 23
6309
ValueError: time data 'November 17, 2022 06:03' does not match format '%Y-%m-%d %H:%M:%S
qweb odoo
Avatar
Avatar
1
de nov. 22
4775
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