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
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    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 do I add a sale.order.line to existing sale.order via External API

Abonare

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

Această întrebare a fost marcată
sale.order.line
1 Răspunde
5299 Vizualizări
Imagine profil
Todd Hartman

(Odoo 17)

I have the sale.order​ id of an existing order. I want to append some items to it using the external web services API.

I can't seem to get the payload correct.

This is as close as I've gotten.

payload = [
    {
        'order_id': 1071,
        'product_id': 44623,
        'name': 'TEST LINE: Product Description',
        'product_uom': 1,
        'product_uom_qty': 1.0
     }
]
so_lines = models.execute_kw(db, uid, password,
                             'sale.order.line', 'create',
                             payload
                             )

When I run this, I get this error message.

xmlrpc.client.Fault: Fault 2: 'Record does not exist or has been deleted.\n(Record: product.product(44623,), User: 377)'

I know for certain that the product matching that ID exists because I just searched for it.

payload = [
  [
    [
      "id",
      "=",
      "44623"
    ]
  ]
]
product = models.execute_kw(db, uid, password,
                            'product.template', 'search',
                            payload)

And I get results the same ID back.

Can someone tell me what I'm lacking? Can I create sale.order.line​ items with create​ or do I have to use update​ for a sale.order​?

0
Imagine profil
Abandonează
Todd Hartman
Autor

@Cybrosys, Thanks for the answer. (I'm unable to comment on your answer.) I updated my question with the actual error code (with bad chars stripped). When I try your code verbatim, I get the same result.

Todd Hartman
Autor

Does something need to be true about a product before I can add it as a line item on a sale order?

Todd Hartman
Autor

If I add the product in the web app, when I retrieve the `sale.order.line` data, the `product_id` doesn't match what I retrieved from `product.template`. Is there a different model that sale.order.line items link to?

Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,

You can create the values like

payload = {
    'order_id': 1071,
    'product_id': 44623,
    'name': 'TEST LINE: Product Description',
    'product_uom': 1,
    'product_uom_qty': 1.0
}

so_line_id = models.execute_kw(db, uid, password,
                               'sale.order.line', 'create',
                               [payload]
                               )

the payload is a dictionary, not a list of dictionaries.If you need to update an existing sale order instead of creating a new one, you can use the write method instead of create.
so_line_id = models.execute_kw(db, uid, password,
                               'sale.order.line', 'write',
                               [[sale_order_line_id], payload]
                               )


Hope it helps

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 add a sequence a field? Rezolvat
sale.order.line
Imagine profil
Imagine profil
Imagine profil
2
dec. 24
22122
add product upon saving sales order
sale.order.line
Imagine profil
0
sept. 24
1491
Odoo 17 remove product_uom from sale_order_lines
sale.order.line
Imagine profil
Imagine profil
Imagine profil
3
aug. 24
2932
invoice/sales
sale.order.line
Imagine profil
0
feb. 24
2106
invoice
sale.order.line
Imagine profil
0
feb. 24
1534
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