İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

searchpanel, display name, context doesn't work

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
categorysearch_viewv14
2 Cevaplar
4990 Görünümler
Avatar
Borja

I've added a searchpanel to the product views to show the categories. But the name of the categories is shown with all the path 




I tried to add something like this to the field:

context="{'show_short_category': True}"


But the context is not passed to the name_get function.


Is there a way to show only the name of the category? (keeping the current display_name for all the other cases (like in the list view)





0
Avatar
Vazgeç
Avatar
Cemal Bayram
En İyi Yanıt

Hi,

First you have to inherit name_get function and make it run with context variable 'show_category_path'. In this function set '_rec_name' to 'name'.

class ProductCategory(models.Model):
_inherit = "product.category"
_rec_name = 'name'

@api.depends('name')
def name_get(self):

if self\._context\.get\('show_category_path'\):
\ \ \ \ \ \ \ \ \ \ \ \ new_res\ =\ \[\]
\ \ \ \ \ \ \ \ \ \ \ \ for\ category\ in\ self:
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\ =\ category\.complete_name
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ new_res\.append\(\(category\.id,\ name\)\)
\ \ \ \ \ \ \ \ \ \ \ \ ctx\ =\ dict\(self\.env\.context,\ show_category_path=False\)
\ \ \ \ \ \ \ \ \ \ \ \ self\.env\.context\ =\ ctx
\ \ \ \ \ \ \ \ \ \ \ \ return\ new_res
\ \ \ \ \ \ \ \ else:
\ \ \ \ \ \ \ \ \ \ \ \ return\ super\(ProductCategory,\ self\)\.name_get\(\)

Second,\ create\ a\ view\ that\ contains\ action\ and\ view\ definitions\ of\ the\ module\ you\ are\ working\ with\ like\ below\. 

The\ first\ context\ change\ is\ in\ action\ definition\ but\ it\ does\ not\ effect\ searchpanel\.\ Because\ of\ this,\ setting\ '_rec_name'\ to\ 'name'\ makes\ it\ work\ as\ you\ need\.\ After\ view\ s\ created\ context\ is\ changed\ with\ your\ variable\ 'show_category_path'\ \.

You\ can\ change\ field\ context\ values\ as\ you\ need\ for\ other\ field\ definitions\ as\ below\.


\ \
\ \ \ \
\ \ \ \ \ \ \ \ Products
\ \ \ \ \ \ \ \ ir\.actions\.act_window
\ \ \ \ \ \ \ \ product\.template
\ \ \ \ \ \ \ \ kanban,tree,form
\ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \{"search_default_consumable":\ 1,\ 'default_type':\ \ ​\ \ \ \ \ \ 'product','show_category_path':\ True\}
\ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \


\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Create\ a\ new\ product
\ \ \ \ \ \ \ \ \ \ \ \


\ \ \ \ \ \ \ \
\ \ \ \
\ \ \ \ ir\.ui\.view"\ id="product_template_form_view_sale_order_button">
\ \ \ \ \ \ \ \ product\.template\.sale\.order\.button
\ \ \ \ \ \ \ \ product\.template
\ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{'show_category_path':\ True\}
\ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \
\ \ \ \
\ \ \ \ \ \
\ \ \ \ "\ rel="ugc">ir\.ui\.view">
\ \ \ \ \ \ \ \ app\.product\.template\.search
\ \ \ \ \ \ \ \ product\.template
\ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \
\ \ \ \
\ \ \ \
\ \ \ \ "\ rel="ugc">ir\.ui\.view">
\ \ \ \ \ \ \ \ app.stock.quant.template.search
stock.quant













0
Avatar
Vazgeç
Avatar
Cybrosys Techno Solutions Pvt.Ltd
En İyi Yanıt

Hi,

Set the context in XML file in the model product

eg:

https://ibb.co/jHTVt2C

In the product category under names get you will get the context while selecting the filed in product.

@api.depends('name', 'code')
def name_get(self):
if not self._context.get('for_partner_id', False):
return super(ResPartner, self).name_get()
else:
res = []
for partner in self:
res.append((partner.id, partner.name))
return res

Regards

0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Odoo14 After the permission rules are changed, the upgrade module does not take effect
category v14
Avatar
0
Tem 21
2553
hide category from user form, odoo v14
category groups v14
Avatar
0
Oca 23
809
How to configure POS screen in mobile view?
category point_of_sale v14
Avatar
0
Eki 21
4624
Facing issue in upgrading from odoo11 to 14 in search filter
xml search_view v14
Avatar
Avatar
1
Haz 21
2260
ver.14: how to add Category filter to show products in website /shop Çözüldü
search category v14
Avatar
Avatar
2
Şub 21
7192
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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