Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

How to search product by field in different table

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
searchname_search
7 Replies
8475 Tampilan
Avatar
Mostafa Alaa

i want to use name_search in product to get product by search the lot name which in stock.production.lot

class ProductProduct(models.Model):
_inherit = 'product.product'

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

args = args or []
print('arg ',args)
            recs = self.search([('lot_name', operator, name)]  args, limit=limit) #stock_quant_ids.lot_id.name
print('recs ', recs)
if not recs.ids:
return super(ProductProduct, self).name_search(name=name, args=args,
operator=operator,
limit=limit)
return recs.name_get()


0
Avatar
Buang
Sehrish

When should you use name_search method: https://goo.gl/7PHhPP

Avatar
Mostafa Alaa
Penulis Jawaban Terbai

from odoo.osv import expression

class ProductProduct(models.Model):

_inherit = 'product.product'

lot = fields.Char()

@api.model

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

""" search for product using the Lot number """

self.lot = name

print (self.lot)

args = args or []

recs = None

# only perform search by when the name is passed

if name:

# don't use limit here

recs = self.env['stock.production.lot'].search([('barcode', operator, name)])

if recs:

# handle extra filter that was passed by the domain attribute in the XML

args = expression.AND([args, [('id', 'in', recs.mapped('product_id').ids)]])

return self.search(args, limit=limit).name_get()

# no Lot was founded may be the user meant to search by product name

return super(ProductProduct, self).name_search(name=name,

args=args,

operator=operator,

limit=limit)

0
Avatar
Buang
Avatar
Paresh Wagh
Jawaban Terbai

Hi Mostafa: I haven't looked at the logic but going purely by the syntax, if you put a env['stock.production.lot'] after self like so it should work.

self.env['stock.production.lot'].search([('lot_name', operator, name)]


0
Avatar
Buang
Mostafa Alaa
Penulis

raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))

ValueError: Invalid field u'type' in leaf "<osv.ExtendedLeaf: (u'type', u'=', u'product') on stock_production_lot (ctx: )>"

Paresh Wagh

You typically get this error when the domain condition is not correct. Is it possible to post the section of the custom code you have written ?

Mostafa Alaa
Penulis

recs = self.env['stock.production.lot'].search([('name', operator, name)] +args, limit = limit)

Paresh Wagh

Check the run-time value of operator, name, args and limit when this gets executed.

Mostafa Alaa
Penulis

thanks i found the solution

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How do I filter a spreadsheet pivot to the current/previous month
search
Avatar
Avatar
1
Jul 25
1380
Search a message Diselesaikan
search
Avatar
Avatar
1
Feb 25
1787
Disable Instant Search on /shop
search
Avatar
0
Sep 23
2697
User search operators
search
Avatar
Avatar
2
Jun 23
4770
How to search On Many2Many field ?
search
Avatar
Avatar
1
Agu 22
13463
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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