Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

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

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
purchase_orderproduct.nameorder.linepurchaseorderInternalReference
3 Replies
11608 Rodiniai
Portretas
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
Portretas
Atmesti
Sehrish

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

Portretas
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
Portretas
Atmesti
Rickard Wallster
Autorius

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.

Portretas
Rickard Wallster
Autorius 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
Portretas
Atmesti
Portretas
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
Portretas
Atmesti
Rickard Wallster
Autorius

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!

Registracija
Related Posts Replies Rodiniai Veikla
How do I change the format of Purchase Order Numbers, ie: POXXXXX, to something else? Solved
formatting purchase_order purchaseorder
Portretas
Portretas
1
vas. 18
12256
Restriction of creating a Vendor Bill (Odoo v13)
purchase_order purchaseorder vendorbill controlpolicy
Portretas
Portretas
1
saus. 23
2101
How do I add more fields to the Purchase Order Line? Solved
function purchase_order order.line api.depends
Portretas
Portretas
1
spal. 20
6038
order purchase order lines
product purchase_order category order.line
Portretas
Portretas
1
rugp. 19
6358
Error when trying to import Purchase Orders into Odoo Solved
purchase_order order.line odoo odoo11
Portretas
Portretas
1
saus. 19
5665
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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