Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

grid like multi column dropdown selection

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
5 Răspunsuri
4884 Vizualizări
Imagine profil
Simon Lee

I am using odoo 9. I would like to find a way to show 2 columns on a dropdown selection. For instance, when clicking on the lot_name field in the stock.pack.operation.lot tree view, I would like to show the lot_name and the available_qty of a product in the dropdown list, similar to the grid-like-multi-columm-combo box in the following link (https://www.obout.com/combobox/aspnet_columns_grid.aspx). Is it possible to have such grid-like-multi-columm-combo box in odoo? If yes, where can I find some examples and tutorial. Thanks.

Simon Lee

0
Imagine profil
Abandonează
Imagine profil
Simon Lee
Autor Cel mai bun răspuns

Hengky Zhang, thank you for your answer. I finally have time to try this out but I ran into this problem.

Here's my code:

.py file:
class my_stock_production_lot(models.Model):
    _name = 'stock.production.lot'   
    _inherit = 'stock.production.lot'    
    product_available_qty=fields.Float(string='Quantity Available', related='product_id.qty_available')           

    @api.multi   
    def name_get(self):
        res = []       
        for lot in self:
            if lot.name:                  
                display_value = lot.name               
                if lot.product_available_qty > 0:
                    display_value += ' ['                   
                    display_value += '%.0f Units' % lot.product_available_qty                   
                    display_value += ']'               
                res.append((lot.id, display_value))        
        return res

.xml file:
<record id="view_pack_operation_lot_form_inherit" model="ir.ui.view">           
<field name="inherit_id" ref="stock.view_pack_operation_lot_form"/>           
<field name="model">stock.pack.operation</field>           
<field name="arch" type="xml">               
<xpath expr="//field[@name='pack_lot_ids']/tree/field[@name='lot_id']" position="replace">                   
<field name="lot_id" invisible="context.get('only_create', False)" 
        domain="[('product_id','=', parent.product_id)]"                                      
        context="{'product_id': parent.product_id, 'show_qty': True}"/>               
</xpath>           
</field>                   
</record>

My question:
1) Was I right on how to include 'show_qty' in the context of the .xml file?

2) I cannot reference  context in the name_get method. name_get cannot accepts a context parameter. When I checked the self._context variable in the debugger, I did not see {'show_qty': False}. I cannot  do "if self._context.get('show_qty'):..." either since it is a frozen dict. So how can I determine in name_get whether I should display the default name or my customize name[qty]???

Can you please explain possibly with example? Thanks.

0
Imagine profil
Abandonează
Imagine profil
Hengky
Cel mai bun răspuns

Yes you can, but not same 100%

you override method name search in that many2one object

so you can override the return value

for default odoo just return the name of the relation table, and what you need to need to substring that name with the quantity example odoo will return --> LOT001(10QTY) instead of LOT001

for selection field you should use method to get the content of that selectional field and use your logical code for the return

0
Imagine profil
Abandonează
Simon Lee
Autor

Thank you for the idea. I have a question. If I override name_search and add qty to the name, all other functions that call name_search will see the name as LOT001(10 PCS), right? I don't want such global effect. Just want to show the name+qty in some specific view. How can I do that? Thanks.

Hengky

sorry the method should be name_get not name search ^_^

lucky you understand what i mean

yes that method is global, let me check it first is it possible for specific field

Hengky

yes it is possible for specific field friend,

you need to add the context in the field

<field name="product_id" context="{attribute_only':True}"/>

then in the name_get method put the IF statement if the context is True then bla bla bla

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

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

Înscrie-te
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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