Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to add multiple lines in odoo pos 18 development?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
pospoint_of_salePOSscreenOdoo18.0
1 Răspunde
1398 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
D Enterprise
Cel mai bun răspuns

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
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to update point of sale order state?
pos point_of_sale
Imagine profil
Imagine profil
1
nov. 25
358
Odoo Server Error RPC_ERROR
point_of_sale Odoo18.0
Imagine profil
Imagine profil
1
iun. 25
1518
Pos product shows 0.0 units sold
pos point_of_sale
Imagine profil
Imagine profil
Imagine profil
3
apr. 25
1889
How to have checkboxes for the variables of each product
pos point_of_sale
Imagine profil
Imagine profil
1
aug. 24
2969
How to delete POS Sessions! Odoo 16 Rezolvat
pos point_of_sale
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
mai 24
13080
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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