İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

How to add multiple lines in odoo pos 18 development?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
pospoint_of_salePOSscreenOdoo18.0
1 Cevapla
1378 Görünümler
Avatar
Shohjaxon

const filtered_lines = this.pos.get_order().lines

            // Step 1: Get all product IDs from refundLines

            const refundProductIds = new Set();

            const refundOrder = this.pos.add_new_order();

            for (const refundLine of refundLines) {

                // refundLine format: [0, 0, { product_id: ... }]

                const productId = refundLine[2].product_id;

                refundProductIds.add(productId);

            }


            // Step 2: Filter and update the lines

            const updatedLines = [];

            for (const line of filtered_lines) {

                const productId = line.product_id?.id || (line.product && line.product.id);

                if (productId && refundProductIds.has(productId)) {

                    // Find the refund quantity for this product

                    const refundEntry = refundLines.find(r => r[2].product_id === productId);

                    const refundQty = refundEntry ? refundEntry[2].qty : 0;

                    // Create a copy of the line with ONLY qty updated

                    updatedLines.push({

                        ...line,                 // Copy all existing fields

                        qty: refundQty           // Override qty with refund value

                    });

                    // this.pos.addLineToCurrentOrder({

                    //     ...line,                 // Copy all existing fields

                    //     qty: refundQty           // Override qty with refund value

                    // })

                }

            }



updatedLines.forEach(updatedLine => {

    this.pos.addLineToCurrentOrder(updatedLine);

});

Hello! I am trying to add lines to odoo pos order lines in pos_screen but this only adding first selected products somehow. 
I am filtering selected orders from order.lines and copying all data from it

0
Avatar
Vazgeç
Avatar
D Enterprise
En İyi Yanıt

Hii,
Try this code 
const refundProductIds = new Set();

const refundQtyMap = new Map();  // map product_id → qty


// 1. Build refund product ID map

for (const refundLine of refundLines) {

    const productId = refundLine[2].product_id;

    refundProductIds.add(productId);

    refundQtyMap.set(productId, refundLine[2].qty);

}


// 2. Create a new order

const refundOrder = this.pos.add_new_order();


// 3. Loop through existing lines and match

const orderLines = this.pos.get_order().get_orderlines();


for (const line of orderLines) {

    const product = line.get_product();

    const productId = product?.id;


    if (refundProductIds.has(productId)) {

        const qty = refundQtyMap.get(productId);


        // Add a new line using pos.add_product()

        refundOrder.add_product(product, {

            quantity: qty,

            price: line.get_unit_price(),

            discount: line.get_discount(),

            extras: {

                // Add any custom props here if needed

                ref_line_id: line.id, // e.g. store original line reference

            },

        });

    }

}

i hope it is usefull

0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
How to update point of sale order state?
pos point_of_sale
Avatar
Avatar
1
Kas 25
351
Odoo Server Error RPC_ERROR
point_of_sale Odoo18.0
Avatar
Avatar
1
Haz 25
1499
Pos product shows 0.0 units sold
pos point_of_sale
Avatar
Avatar
Avatar
3
Nis 25
1887
How to have checkboxes for the variables of each product
pos point_of_sale
Avatar
Avatar
1
Ağu 24
2967
How to delete POS Sessions! Odoo 16 Çözüldü
pos point_of_sale
Avatar
Avatar
Avatar
Avatar
3
May 24
13071
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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