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
    • Discuss
    • 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

Merging lines if the product name is the same in stock.picking

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
stock_pickingcustomizeodoo15
1 Balas
1659 Tampilan
Avatar
Aprilia Zahratunnisa

please fix the code below. when creating a new stock.picking, if there are 2 lines of the same product name then in stock.picking it will become 1 line. it should remain 2 lines. is there an error in the code below? or are there any other suggestions?


def _create_delivery_order(self):

        picking_obj = self.env['stock.picking']

        warehouse = self._default_warehouse()

        destination_id = self._default_destination_id()


        # stock = self.env['stock.location'].search([

        #      ('warehouse_id', '=', warehouse.id),

        #     ('usage', '=', 'internal')

        # ], limit=1)


        picking = picking_obj.create({

            'rma_order_id': self.id,

            'partner_id': self.partner_id.id,

            'partner_invoice_id': self.partner_invoice_id.id,

            'branch_id': self.branch_id.id,

            'picking_type_id': self._default_picking_id(),

            'location_id': self.env.ref('stock.stock_location_customers').id,

            'location_dest_id': destination_id,

            'move_lines': [(0, 0, {

                'product_id': line.product_id.id,

                'name': line.product_id.name,

                'price_unit': line.price_unit,

                'product_uom_qty': line.quantity,

                'product_uom': line.product_id.uom_id.id,

                'location_id': self.env.ref('stock.stock_location_customers').id,

                'location_dest_id': destination_id,

                'reference_picking': line.picking_id.name,

                'rma_line_id': line.id,

            }) for line in self.order_lines],

            'origin': self.name,

        })


        if self.request_type == 'cancel_so':

            picking.name = self._sequence_delivery_order('C')

        else:

            picking.name = self._sequence_delivery_order('RET')


        return picking

0
Avatar
Buang
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi,

Please check with this code,

def _create_delivery_order(self):

picking_obj = self.env['stock.picking']

warehouse = self._default_warehouse()

destination_id = self._default_destination_id()

# stock = self.env['stock.location'].search([

# ('warehouse_id', '=', warehouse.id),

# ('usage', '=', 'internal')

# ], limit=1)

# Create the picking without move lines
picking = self.env['stock.picking'].create({
'rma_order_id': self.id,

'partner_id': self.partner_id.id,

'partner_invoice_id': self.partner_invoice_id.id,

'branch_id': self.branch_id.id,

'picking_type_id': self._default_picking_id(),

'location_id': self.env.ref('stock.stock_location_customers').id,

'location_dest_id': destination_id,
'origin': self.name,
})
# Track processed product IDs to avoid duplication
copy = []
for line in self.order_lines:
# Check if move line for the same product already exists
existing_move = self.order_lines.filtered(
lambda m: m.product_id.id == line.product_id.id)
if line.id not in copy:
copy.append(line.id)
# Create a stock move (not move_line) for the combined quantity
picking.move_lines.create({
'picking_id': picking.id,
'product_id': line.product_id.id,
'name': line.product_id.name,
'price_unit': line.price_unit,
'product_uom_qty': sum(existing_move.mapped('qunatity')),#Quantity sum
'product_uom': line.product_id.uom_id.id,
'location_id': self.env.ref(
'stock.stock_location_customers').id,
'location_dest_id': destination_id,
'reference_picking': line.picking_id.name,
'rma_line_id': line.id,
})

if self.request_type == 'cancel_so':

picking.name = self._sequence_delivery_order('C')

else:

picking.name = self._sequence_delivery_order('RET')

return picking

Hope it helps

0
Avatar
Buang
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
Hide Action Print Out under certain conditions Diselesaikan
stock_picking printpdf odoo15
Avatar
Avatar
1
Mei 25
1402
Internal Server Error when upgrading after changes in res_partner Diselesaikan
customize res_partner odoo15
Avatar
Avatar
Avatar
Avatar
3
Mei 25
1446
Submit custom field from Sale Order to Stock Picking
stock_picking customize saleorder
Avatar
0
Sep 17
5025
what is the use of stock.picking, stock.picking.out and stock.picking.in Diselesaikan
stock_picking
Avatar
Avatar
1
Nov 24
20540
Error install web_responsive in odoo 15
odoo15
Avatar
0
Sep 24
1825
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