İç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

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

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
errorcreationsale.order.line
3 Cevaplar
39897 Görünümler
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
Vazgeç
Avatar
Adesh Paul
En İyi Yanıt

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

0
Avatar
Vazgeç
Avatar
subbarao
En İyi Yanıt

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

0
Avatar
Vazgeç
Avatar
mahammed ogba
En İyi Yanıt

May be you have depend method executed 
​

ex :

@api.depends('categ_id')

and field (categ_id) not set yet

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
Issues with invoice creation
invoice error creation issues
Avatar
Avatar
1
Şub 25
2030
Odoo Community 15 - local windows server 2008 R2 Standard
error database creation access
Avatar
1
Ağu 22
2383
?"Your country might be blocked by our hosting provider" error when I create new website
error
Avatar
0
Eki 25
582
Payment Page Return Error with Razorpay on Mobile Devices
error
Avatar
0
Eyl 25
1182
How to add a sequence a field? Çözüldü
sale.order.line
Avatar
Avatar
Avatar
2
Ara 24
22274
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