Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivouspalvelut
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Kurssit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

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

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

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

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
errorcreationsale.order.line
3 Vastaukset
39907 Näkymät
Avatar
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
Avatar
Hylkää
Avatar
Adesh Paul
Paras vastaus

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

0
Avatar
Hylkää
Avatar
subbarao
Paras vastaus

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

0
Avatar
Hylkää
Avatar
mahammed ogba
Paras vastaus

May be you have depend method executed 
​

ex :

@api.depends('categ_id')

and field (categ_id) not set yet

0
Avatar
Hylkää
Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
Issues with invoice creation
invoice error creation issues
Avatar
Avatar
1
helmik. 25
2030
Odoo Community 15 - local windows server 2008 R2 Standard
error database creation access
Avatar
1
elok. 22
2383
?"Your country might be blocked by our hosting provider" error when I create new website
error
Avatar
0
lokak. 25
582
Payment Page Return Error with Razorpay on Mobile Devices
error
Avatar
0
syysk. 25
1182
How to add a sequence a field? Ratkaistu
sale.order.line
Avatar
Avatar
Avatar
2
jouluk. 24
22274
Yhteisö
  • Kurssit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Tavaramerkki
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة 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 on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

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