Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

How to modify Product search in Quotation

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
8 Antwoorden
6140 Weergaven
Avatar
Ramashish

When user types in product field under quotation line item it searches based on product name. How to include Product category in this search? So if the characters entered match with product category only those products under that category should be shown.    

0
Avatar
Annuleer
Avatar
Jigar Vaghela (jva)
Beste antwoord

Inherit a product.product and inside write this code.

class product_product(osv.osv):

    _inherit = "product.product"

    def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):

        res = super(product_product, self).name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100)

        if operator in ('ilike', 'like', '=', '=like', '=ilike'):

            domain = [('categ_id', operator, name)]

            ids = self.search(cr, user, domain, limit=limit, context=context)

            res += self.name_get(cr, user, ids, context=context)

        return res

0
Avatar
Annuleer
Ramashish
Auteur

Thank you for the quick response. I tried this but did not work. It's still not searching based on product category

Jigar Vaghela (jva)

sorry here my mistake

domain = [('categ_id', operator, name)]

replace name with categ_id

Ramashish
Auteur

This is what I did but didn't work. I am using OpenERP 7.

class sale_order_product_search(osv.osv):

_name = "sale.order.product.search"

_inherit = "product.product"

def name_search(self, name, args=None, operator='ilike', limit=100):

res = super(product_product, self).name_search(name, args, operator=operator, limit=limit)

if operator in ('ilike', 'like', '=', '=like', '=ilike'):

domain = [('categ_id', operator, name)]

res += self.search(domain, limit=limit).name_get()

return res

sale_order_product_search()

Jigar Vaghela (jva)

first don't give class new name and _name only _inherit then it's work

do like this

class product_product(osv.osv):

_inherit = "product.product"

def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):

res = super(product_product, self).name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100)

if operator in ('ilike', 'like', '=', '=like', '=ilike'):

domain = [('categ_id', operator, name)]

ids = self.search(cr, user, domain, limit=limit, context=context)

res += self.name_get(cr, user, ids, context=context)

return res

Avatar
Ramashish
Auteur Beste antwoord

https://pastebin.com/Nj8isCij

This is how I added product category in the quotation line item product search.

0
Avatar
Annuleer
Avatar
Jake Robinson
Beste antwoord

You will need to modify the _name_search function of the product.product model. Something similar to this should work:

@api.model
def _name_search(self, name='', args=None, operator='ilike', limit=100):
    if args is None:
        args = []
    domain = args + ['|', ('categ_id', operator, name), ('name', operator, name)]
    return super(ProductProduct, self).search(domain, limit=limit).name_get()

If you only want this change to apply in the quotation page, you will need to use the context:

@api.model
def _name_search(self, name='', args=None, operator='ilike', limit=100):
if self.env.context.get('allow_product_search_by_category'):
    if args is None:
        args = []
    domain = args + ['|', ('categ_id', operator, name), ('name', operator, name)]
    return super(ProductProduct, self).search(domain, limit=limit).name_get()
else:
return super(ProductProduct, self)._name_search(name, args, operator, limit)

And then on the  view definition you'll need to add the context:

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


0
Avatar
Annuleer
Ramashish
Auteur

Thank you for the prompt reply. I tried this but it did not work. There is no field named 'category_id' in the product_product. It has product_templ_id (product_template) which has categ_id (product_category).

I also noticed that product_product::name_search adds any externally passed arguments to the search. So instead of modifying the code can the args be passed from view?

Jake Robinson

Sorry, their naming conventions always get me. The field is categ_id.

As the product.product inherits the product.template, any field defined on the product.template will exist on the product.product.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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