Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to display only Internal Reference and Product Name when searching for products in Purchase Order Line

Odoberať

Get notified when there's activity on this post

This question has been flagged
purchase_orderproduct.nameorder.linepurchaseorderInternalReference
3 Replies
11643 Zobrazenia
Avatar
Rickard Wallster

When searching for products in Purchase Order Line, the search window is showing "[Supplier Product code] Supplier Product name" (if existing), instead of "[Internal Reference] Product Name".


Is it possible to make the search window for Purchase Order Lines to always show "[Internal Reference] Product Name", even though there are data in "Supplier Product code" and "Supplier Product name"?


Thanks,

Rickard

0
Avatar
Zrušiť
Sehrish

See: https://www.youtube.com/watch?v=qtoEE6IUZBw

Avatar
Jainesh Shah(Aktiv Software)
Best Answer

Hello Rickard Wallster,

On Purchase Order Line, Product search window If you want to display "[Internal Reference] Product Name" instead of the "[Supplier Product code] Supplier Product name". Then you need to overwrite the base product.product 'name_get' method and you need to remove If/else condition for the seller. I have modified the below method as per your requirement you can use this method.

Please inherit product.product object in any custom module and you can add the below method.
Note: Below method was copy from odoo v12.

@api.multi
def name_get(self):
# TDE: this could be cleaned a bit I think

def _name_get(d):
name = d.get('name', '')
code = self._context.get('display_default_code', True) and d.get('default_code', False) or False
if code:
name = '[%s] %s' % (code,name)
return (d['id'], name)

partner_id = self._context.get('partner_id')
if partner_id:
partner_ids = [partner_id, self.env['res.partner'].browse(partner_id).commercial_partner_id.id]
else:
partner_ids = []

# all user don't have access to seller and partner
# check access and use superuser
self.check_access_rights("read")
self.check_access_rule("read")

result = []

# Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields
# Use `load=False` to not call `name_get` for the `product_tmpl_id`
self.sudo().read(['name', 'default_code', 'product_tmpl_id', 'attribute_value_ids', 'attribute_line_ids'], load=False)

product_template_ids = self.sudo().mapped('product_tmpl_id').ids

if partner_ids:
supplier_info = self.env['product.supplierinfo'].sudo().search([
('product_tmpl_id', 'in', product_template_ids),
('name', 'in', partner_ids),
])
# Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields
# Use `load=False` to not call `name_get` for the `product_tmpl_id` and `product_id`
supplier_info.sudo().read(['product_tmpl_id', 'product_id', 'product_name', 'product_code'], load=False)
supplier_info_by_template = {}
for r in supplier_info:
supplier_info_by_template.setdefault(r.product_tmpl_id, []).append(r)
for product in self.sudo():
# display only the attributes with multiple possible values on the template
variable_attributes = product.attribute_line_ids.filtered(lambda l: len(l.value_ids) > 1).mapped('attribute_id')
variant = product.attribute_value_ids._variant_name(variable_attributes)

name = variant and "%s (%s)" % (product.name, variant) or product.name
sellers = []
if partner_ids:
product_supplier_info = supplier_info_by_template.get(product.product_tmpl_id, [])
sellers = [x for x in product_supplier_info if x.product_id and x.product_id == product]
if not sellers:
sellers = [x for x in product_supplier_info if not x.product_id]

mydict = {
'id': product.id,
'name': name,
'default_code': product.default_code,
}
result.append(_name_get(mydict))
return result

Hope this may help you!

Thanks & Regards,

Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

5
Avatar
Zrušiť
Rickard Wallster
Autor

Thanks Jainesh.

So far I have only made customisations using Studio and Odoo interface developer mode, since I don't have access to the server yet. I was hoping this was achievable by creating a custom view or so, but I will try your solution later on when I have access to the server.

Avatar
Rickard Wallster
Autor Best Answer

Hi Racheal

I have tried different workarounds so now I don't really know what was the baseline. But you can try out the following:
1. Open a Purchase Order.
2. Using Studio, click on the PO lines. Edit List View.
3. Click on Product column. Remove all data in Context.

I hope that works out for you.

In later versions it seems like they removed this weird behaviour.


 

0
Avatar
Zrušiť
Avatar
Felix Hummel
Best Answer

You can remove the "[Supplier Product code]" Prefix by setting "display_default_code" to False in the context, e.g.



{'partner_id': parent.partner_id, 'display_default_code': False}

0
Avatar
Zrušiť
Rickard Wallster
Autor

Hi Felix
I appreciate your help. But the solution you suggested will remove "default_code". What I want to do is to show default_code, even though there is data in product_code for that vendor.

I tried context {'partner_id': parent.partner_id, 'display_product_code': False} instead. But that didn't work.

Racheal Andersen

Hi Rickard,
I am running into the same issue.  I would only like the Internal Reference displayed.  Were you able to come up with a solution using Studio?

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
How do I change the format of Purchase Order Numbers, ie: POXXXXX, to something else? Solved
formatting purchase_order purchaseorder
Avatar
Avatar
1
feb 18
12273
Restriction of creating a Vendor Bill (Odoo v13)
purchase_order purchaseorder vendorbill controlpolicy
Avatar
Avatar
1
jan 23
2107
How do I add more fields to the Purchase Order Line? Solved
function purchase_order order.line api.depends
Avatar
Avatar
1
okt 20
6042
order purchase order lines
product purchase_order category order.line
Avatar
Avatar
1
aug 19
6365
Error when trying to import Purchase Orders into Odoo Solved
purchase_order order.line odoo odoo11
Avatar
Avatar
1
jan 19
5672
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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