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

[SOLVED] Why am I getting the error 'Record does not exist or has been deleted.' when trying to create a Sales Order Line?

Abonare

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

Această întrebare a fost marcată
errorcreationsale.order.line
3 Răspunsuri
39911 Vizualizări
Imagine profil
Tim Turnquist

I am currently working in Odoo 11 on odoo.sh, but my local development environment is the official Odoo 11 Docker image. It is in the Docker container that I am getting the error and I can't push to Odoo.sh until that is fixed.

I am writing a custom module to interact with our ShipStation account. This particular problem is when I try to convert a ShipStation Order Line Item into an Odoo Sales Order Line. Here is my code:

@api.model
def convert_order_line_to_sales_line(self,data,line_number):
    s_o_l =None
    if not data.product_id:
        self.env['shipstation.log'].create({
            'title':"Create SO",
            'type':'NO Got prod',
            'message':"No Product for SO with SKU: "+ data.sku
        })
        returnNone
  write_dict ={
        'order_id': data.order_id.id,
        'price_unit': data.unitPrice,
        'product_id': data.product_id,
        'name': data.product_id.name,
        'product_uom_qty': data.quantity,
        'sequence': line_number,
        'product_uom': data.product_id.product_tmpl_id.uom_id,
        'order_partner_id': data.order_id.partner_id.id,
    }
  s_o_l =self.search([
        ('order_id','=', data.order_id.id ),
        ('sequence','=', line_number )
    ])
    if s_o_l:
        self.env['shipstation.log'].create({
            'title':"Create SO",
            'type':'WRITE',
            'message':"trying to write: "+repr( write_dict )
        })
  s_o_l.write( write_dict )
    else:
        self.env['shipstation.log'].create({
            'title':"Create SO",
            'type':'CREATE',
            'message':"trying to create: "+repr( write_dict )
        })
  s_o_l =self.create( write_dict )
    return s_o_l

If I comment out the create statement, my log (just above it) looks like this:


Create SO
Active
CREATE
trying to create: {
'sequence': 1,
'order_partner_id': 7,
'product_id': product.product(22,),
'order_id': 505, 'price_unit': 189.95,
'product_uom_qty': 1,
'product_uom': product.uom(1,),
'name': 'Chickens'
}





So, the I have checked all of the object references in the write_dict dictionary and (from what I can see) they are all present and valid. I don't see any other required fields in the sale.order.line. I have tried to remove or change values like 'sequence' and 'name', but I get the same error.

What am I missing?


EDIT:

Now that I look at it I think my third line of my dictionary in the log needs to be:

'order_partner_id': res.partner(7,), 

EDIT (part 2):
Nope, that didn't fix it. I now get res.partner( 7,), in the write_dict, but still get the same error.  HELP PLEASE!

EDIT (part 3)

I think I figured it out.

I removed the .id from   'order_id': data.order_id.id,  to  'order_id': data.order_id, and got a new error that gave me great insight into my problem -- I have been dealing with too many order_id's.  The one used here is not the sale.order.id like it should be. Now I just have to figure out how to do it right.

I needed to pass in the sale.order.id as a parameter and then change the order of the process that calls this one to create the sale.order first to get the ID, then call this with that ID . . . and it works!!

Here it is:

@api.model
def convert_order_line_to_sales_line(self, data, sale_order_line_id,line_number):
    s_o_l =None
    if not data.product_id:
        self.env['shipstation.log'].create({
            'title':"Create SO",
            'type':'NO Got prod',
            'message':"No Product for SO with SKU: "+ data.sku
        })
        returnNone
    write_dict ={
        'order_id': sale_order_line_id,
        'price_unit': data.unitPrice,
        'product_id': data.product_id.id,
        'name': data.product_id.name,
        'product_uom_qty': data.quantity,
        'sequence': line_number,
        'product_uom': data.product_id.product_tmpl_id.uom_id.id,
        'order_partner_id': data.order_id.partner_id.id,
    }
  s_o_l =self.search([
        ('order_id','=', sale_order_line_id ),
        ('sequence','=', line_number )
    ])
    if s_o_l:
        self.env['shipstation.log'].create({
            'title':"Create SO",
            'type':'WRITE',
            'message':"trying to write: "+repr( write_dict )
        })
  s_o_l.write( write_dict )
    else:
        self.env['shipstation.log'].create({
            'title':"Create SO",
            'type':'CREATE',
            'message':"trying to create: "+repr( write_dict )
        })
  s_o_l =self.create( write_dict )
    return s_o_l


REPLY TO subbarao:

Thank you for your reply. Actually, that last code I posted works great. I have all required fields included. I was passing the shipstation order ID, not the Odoo Sales Order ID like Odoo was expecting.


2
Imagine profil
Abandonează
Imagine profil
Adesh Paul
Cel mai bun răspuns

It occurs because somewhere in the field you have defined default value.

0
Imagine profil
Abandonează
Imagine profil
subbarao
Cel mai bun răspuns

Mandatory fields are missing while create Sale Order Line, So please check log file you will get which field is missing

0
Imagine profil
Abandonează
Imagine profil
mahammed ogba
Cel mai bun răspuns

May be you have depend method executed 
​

ex :

@api.depends('categ_id')

and field (categ_id) not set yet

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
Issues with invoice creation
invoice error creation issues
Imagine profil
Imagine profil
1
feb. 25
2030
Odoo Community 15 - local windows server 2008 R2 Standard
error database creation access
Imagine profil
1
aug. 22
2383
?"Your country might be blocked by our hosting provider" error when I create new website
error
Imagine profil
0
oct. 25
582
Payment Page Return Error with Razorpay on Mobile Devices
error
Imagine profil
0
sept. 25
1184
How to add a sequence a field? Rezolvat
sale.order.line
Imagine profil
Imagine profil
Imagine profil
2
dec. 24
22274
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