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 invisible graph bar in kanban

Subscriure's

Get notified when there's activity on this post

This question has been flagged
graphkanbaninvisiblecardbar
2 Respostes
2131 Vistes
Avatar
Uzair
.py:
colon_data = fields.Boolean('Colon Data',store=True,default=True) count_data = fields.Integer(string='Data check') @api.onchange('plot_colonization_ids') def compute_count_data(self): for rec in self: total_plot_no = 0 for line in rec.plot_colonization_ids: if line.plot_no: rec.count_data += int(line.plot_no) if rec.count_data > 0: self.colon_data = True elif rec.count_data == 0: self.colon_data = False

i use the following code for a graph in kanban card if there is data graph will be shown otherwise graph will not visible but there are few issue first i need the colonization heading should be invisble for those kanban card which has no data in graph, second thing is if there is no data in graph then the remaining graphs should be adjustable which is not adjust right now in sense of space occupying in kanban card

``​`

Colonization

```

0
Avatar
Descartar
Avatar
Shajahan
Best Answer

To address the issues you're facing with the Odoo customization involving graphs on Kanban cards, there are a couple of modifications and clarifications needed in both your backend Python code and your frontend XML/JavaScript.

Python Code Corrections

First, let's correct and optimize your Python code. Your existing code seems to have an intention of counting some data related to plot_colonization_ids. However, there are a few issues in how you handle the counting and setting of colon_data. Here’s a refined version:

pythonCopy codefrom odoo import models, fields, api

class YourModelName(models.Model):
    _name = 'your.model.name'
    _description = 'Model Description'

    colon_data = fields.Boolean('Colon Data', store=True, default=True)
    count_data = fields.Integer(string='Data Check', compute='_compute_count_data', store=True)

    @api.depends('plot_colonization_ids.plot_no')
    def _compute_count_data(self):
        for rec in self:
            rec.count_data = sum(int(line.plot_no or 0) for line in rec.plot_colonization_ids)
            rec.colon_data = rec.count_data > 0

Key Changes:

  • I added @api.depends decorator to properly trigger the compute method when plot_colonization_ids.plot_no changes.
  • Used list comprehension for summation to make the calculation more Pythonic and efficient.
  • Removed the loop that was redundantly resetting colon_data for every record in the compute method, and instead directly set colon_data based on count_data.

Frontend XML/JS Adjustments

For your requirements on the Kanban card:

  1. Hiding the Colonization Heading on Kanban cards without data: You can use the attrs attribute in your XML to conditionally hide elements based on colon_data.
xmlCopy code
    
        

Colonization Data

  1. Adjusting Space for Kanban cards with no data: This typically requires custom CSS or adjustments in JavaScript to ensure that the layout adapts to the absence of certain elements. Here’s an idea on how to approach it using CSS:
cssCopy code

For dynamic behavior adjustments in the Kanban view, depending on whether the customization is heavy, you might also need to extend the Kanban view's JavaScript part using Odoo's JavaScript framework to manipulate the DOM based on colon_data.

These are the foundational adjustments needed. Depending on your specific module and setup, additional modifications might be required to perfectly fit your requirements.

0
Avatar
Descartar
Avatar
Uzair
Autor Best Answer

Thank you! by using css,js and the optimization of python worked for me.

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
Graph bar in kanban
graph kanban card bar odoo
Avatar
Avatar
Avatar
2
de maig 24
2739
How to conditionally invisible field in a graph view in Odoo
graph invisible Odoo 18
Avatar
Avatar
1
de maig 25
1514
How to have multiple bars per item on the x-axis on graph view?
development graph bar
Avatar
Avatar
Avatar
2
de set. 23
12375
kanban view inherit fields and make invisible Solved
inheritance kanban invisible
Avatar
Avatar
Avatar
2
de gen. 24
15289
How to make bar graph colored like the pie graph in OpenERP 7.0 ??
graph openerp7 bar
Avatar
0
d’abr. 15
5419
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