Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

grid like multi column dropdown selection

Odebírat

Get notified when there's activity on this post

This question has been flagged
5 Odpovědi
4866 Zobrazení
Avatar
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
Avatar
Zrušit
Avatar
Simon Lee
Autor Nejlepší odpověď

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
Avatar
Zrušit
Avatar
Hengky
Nejlepší odpověď

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
Avatar
Zrušit
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!

Přihlásit se
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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