Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
errorcreationsale.order.line
3 Respuestas
39893 Vistas
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
Descartar
Avatar
Adesh Paul
Mejor respuesta

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

0
Avatar
Descartar
Avatar
subbarao
Mejor respuesta

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

0
Avatar
Descartar
Avatar
mahammed ogba
Mejor respuesta

May be you have depend method executed 
​

ex :

@api.depends('categ_id')

and field (categ_id) not set yet

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Issues with invoice creation
invoice error creation issues
Avatar
Avatar
1
feb 25
2029
Odoo Community 15 - local windows server 2008 R2 Standard
error database creation access
Avatar
1
ago 22
2383
?"Your country might be blocked by our hosting provider" error when I create new website
error
Avatar
0
oct 25
582
Payment Page Return Error with Razorpay on Mobile Devices
error
Avatar
0
sept 25
1182
How to add a sequence a field? Resuelto
sale.order.line
Avatar
Avatar
Avatar
2
dic 24
22274
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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