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 change color on kanban view as per state in sale order model

Subscriure's

Get notified when there's activity on this post

This question has been flagged
kanbancolorcss
2 Respostes
16315 Vistes
Avatar
Ankit H Gandhi(AHG)

Hello everyone,

How to change color on kanban view as per state in sale order model.and how to add new css in kanban view

2
Avatar
Descartar
Avatar
subbarao
Best Answer

i thing it is usefull for you.

 

<kanban colors="grey:state=='state1';blue:state in ('state2','state3');black:state=='state4'">
                    <field name="name" string="Order Number"/>

                     .....................................

                    ......................................

 </kanban>

 

0
Avatar
Descartar
Ankit H Gandhi(AHG)
Autor

Hello subbarao, Thanks for replay but this code is not work

Avatar
Ankit H Gandhi(AHG)
Autor Best Answer

Hello all,

Hope this code will be help

write this code in py file

from openerp.osv import osv, fields
import openerp.addons.decimal_precision as dp

class sale_order(osv.osv):
    _inherit = 'sale.order'
    
    def _check_color(self, cr, uid, ids, field_name, arg, context):
        res = {}
        for record in self.browse(cr, uid, ids, context):
            color = 0
            if record.state == u'draft':
                color=1
            if record.state == u'sent':
                color=2
            if record.state == u'cancel':
                color=3
            if record.state == u'waiting_date':
                color=4
            if record.state == u'progress':
                color=5
            if record.state == u'manual':
                color=6
            if record.state == u'shipping_except':
                color=7
            if record.state == u'invoice_except':
                color=8
            if record.state == u'done':
                color=9
            res[record.id] = color
        return res
    
    _columns = {
        'member_color':fields.function(_check_color,'Color',type="integer"),
    }
    
write this code in xml file

        <record model="ir.ui.view" id="view_order_kanban">
            <field name="name">view.order.kanban</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <kanban>
                    <field name="name" string="Order Number"/>
                    <field name="date_order"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="section_id"/>
                    <field name="amount_total" sum="Total Tax Included"/>
                    <field name="state"/>
                    <field name="member_color"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.member_color.raw_value)} oe_kanban_card oe_kanban_stock_picking_type">
                                <div class="oe_dropdown_toggle oe_dropdown_kanban">
                                    <span class="oe_e">í</span>
                                    <ul class="oe_dropdown_menu">
                                        <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
                                        <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
                                    </ul>
                                </div>
                                <div class="oe_kanban_vignette oe_semantic_html_override">
                                    <div class="oe_kanban_details">
                                        <h4 class="oe_partner_heading"><a type="open"><b>Order Number: </b><field name="name" string="Order Number"/></a></h4>
                                        <ul>
                                            <li><b>Date: </b><field name="date_order"/></li>
                                            <li><b>Customer: </b><field name="partner_id"/></li>
                                            <li><b>Salesperson: </b><field name="user_id"/></li>
                                            <li><b>Salesteam: </b><field name="section_id"/></li>
                                            <li><b>Total: </b><field name="amount_total" sum="Total Tax Included"/></li>
                                            <li><b>Status: </b><field name="state"/></li>
                                        </ul>
                                    </div>
                                </div>
                           </div>
                        </t> 
                    </templates>
                </kanban>
            </field> 
        </record>
        
        <record id="sale.action_orders" model="ir.actions.act_window">
            <field name="view_id" ref="view_order_kanban"/>
            <field name="view_mode">kanban,tree,form</field>
        </record>
if you find this answer helpful, please give me a thumbs up vote    
Regards,

Ankit H Gandhi

2
Avatar
Descartar
ABU K

I got this error When I create a module as per your code .... 5 ERROR crm openerp.osv.orm: Can't find field 'section_id' in the following view parts composing the view of object model 'sale.order': * view.order.kanban

Ankit H Gandhi(AHG)
Autor

Hello LIBU, Should be installed sale module.if not installed you will get this error. thanks for comment me..

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
kanban attribute : How to change the color
kanban color attribute
Avatar
1
d’oct. 22
23680
How to set color to fields.Monetary in CRM? Solved
kanban color v14
Avatar
Avatar
1
de jul. 22
3619
Odoo 12 Kanban View messed up after editing CSS file
kanban css editor odoo12
Avatar
0
d’abr. 23
2229
How to change/add background color for field label in Kanban view
fields kanban color odoo12
Avatar
Avatar
1
de set. 22
10916
colorize kanban card using javascript Odoo 11
javascript kanban color css-style
Avatar
Avatar
1
d’oct. 20
3403
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