Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

Odoo 12 raise ValueError("Expected singleton: %s" % record) ValueError: Expected singleton: sale.order.line

Suscribirse

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

Se marcó esta pregunta
odooodoo12
1 Responder
5057 Vistas
Avatar
Madara

hi all , iam new to this platform , iam facing an issue with odoo 12 , what iam trying to achieve is i want to subtract a product subtotal value from another product value in same line in sale order line, and i want to display that value in the report, i have wrote a function below when i update my module  




    @api.depends('price_subtotal', 'price_unit')

    def _compute_trans(self):

product_id = self.env['product.product'].search([('default_code','=','INSURANCE')])

        if product_id:

        for line in self:

                got_product_id = self.env['sale.order.line'].search([('product_id','=',product_id.id),

                                                                 ('order_id','=',self.id)],limit=1)

                sum_dummy = self.subtotal - got_product_id.price_subtotal 

            line.update({'sum_fr ':trans_dummy})

                         


    sum_fr = fields.Float(string='Sum' ,store=True, readonly=True, compute='_compute_trans')




iam getting this error:

    raise ValueError("Expected singleton: %s" % record)

ValueError: Expected singleton: sale.order.line(743, 745, 746, 739, 741, 742, 737, 738, 735, 736, 733, 734, 730, 732, 728, 729, 726, 727, 725, 721, 722, 723, 719, 720, 715, 717, 718, 713, 714, 706, 707, 708, 701, 702, 703, 704, 705, 697, 698, 694, 695, 696, 692, 693, 690, 691, 687, 689, 688, 685, 686, 682, 683, 684, 679, 680, 677, 678, 675, 676, 673, 674, 671, 672, 670, 668, 669, 666, 667, 663, 665, 661, 662, 659, 660, 656, 658, 653, 654, 651, 652, 649, 655, 647, 648, 645, 646, 642, 643, 640, 644, 641, 638, 639, 636, 637, 634, 635, 632, 633, 629, 630, 631, 681, 628, 625, 626, 627, 619, 620, 617, 618, 615, 616, 613, 614, 610, 611, 612, 608, 609, 605, 606, 607, 601, 602, 603, 595, 596, 597, 591, 592, 593, 589, 590, 585, 586, 587, 588, 573, 572, 569, 570, 567, 568, 551, 566, 544, 557, 542, 543, 536, 539, 540, 532, 533, 534, 529, 530, 531, 527, 528, 526, 524, 525, 541, 523, 522, 521, 520, 518, 519, 517, 516, 515, 514, 511, 510, 509, 507, 505, 504, 500, 499, 496, 497, 498, 491, 492, 495, 489, 490, 487, 488, 485, 483, 484, 481, 482, 478, 479, 480, 475, 476, 477, 472, 473, 474, 469, 471, 468, 467, 464, 461, 462, 454, 455, 456, 457, 458, 451, 452, 453, 448, 449, 450, 445, 446, 447, 439, 440, 441, 426, 427, 428, 423, 424, 425, 420, 421, 422, 417, 418, 419, 413, 416, 385, 386, 387, 538, 378, 376, 377, 373, 374, 375, 371, 372, 370, 384, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 339, 338, 337, 336, 334, 333, 332, 331, 330, 335, 329, 328, 326, 325, 311, 312, 291, 297, 294, 295, 296, 298, 299, 300, 301, 302, 303, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 272, 273, 274, 275, 276, 277, 278, 257, 258, 265, 259, 260, 261, 262, 263, 264, 266, 267, 268, 269, 270, 271, 240, 247, 241, 242, 243, 244, 245, 246, 248, 249, 250, 251, 252, 253, 254, 255, 256, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 340, 222, 221, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 195, 196, 197, 192, 191, 190, 189, 194, 188, 187, 186, 185, 184, 313, 314, 315, 316, 317, 318, 319, 320, 321, 183, 182, 181, 180, 179, 178, 193, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 151, 152, 149, 304, 305, 306, 307, 308, 309, 310, 148, 147, 146, 145, 144, 143, 140, 141, 142, 137, 138, 139, 135, 136, 134, 133, 132, 131, 130, 128, 129, 126, 127, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 114, 113, 112, 110, 111, 107, 109, 106, 105, 104, 103, 100, 99, 97, 98, 96, 94, 86, 87, 88, 81, 82, 80, 78, 79, 76, 77, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 52, 53, 51, 49, 50, 48, 46, 47, 45, 42, 43, 44, 39, 40, 41, 37, 38, 35, 36, 28, 27, 26, 25, 24, 19, 20, 21, 22, 23, 16, 17, 18, 15, 14, 10, 11, 12, 13, 9, 8, 5, 6, 4, 2, 3, 1)


someone help with this , i know its accessing multiple records but how to do this or achieve by end goal


0
Avatar
Descartar
Jack Dane

Hello,

Could you try changing:

sum_dummy = self.subtotal - got_product_id.price_subtotal

To:

sum_dummy = line.subtotal - got_product_id.price_subtotal

Thanks,

Madara
Autor

hi jack , thanks for the reply i tried what u mentioned but still getting the same error

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,

got_product_id = self.env['sale.order.line'].search([('product_id','=',product_id.id),('order_id','=',self.id)],limit=1)
sum_dummy = self.subtotal - got_product_id.price_subtotal 

rewrite above lines as follows:-

got_product_id = self.env['sale.order.line'].search([('product_id','=',product_id.id),
('order_id','=',line.order_id.id)],limit=1)sum_dummy = line.subtotal - got_product_id.price_subtotal

Regards

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

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
psycopg2.ProgrammingError: no existe la relación «_unknown» Please HELP!!!!
odoo odoo12
Avatar
Avatar
2
nov 25
485
How to track One2many field in Odoo12? Resuelto
odoo odoo12
Avatar
Avatar
Avatar
Avatar
3
nov 23
18662
Error: Couldn't load module web Resuelto
odoo odoo12
Avatar
Avatar
Avatar
3
nov 24
26828
How I get the current ID of a record ? Resuelto
odoo odoo12
Avatar
Avatar
1
abr 23
7086
Binary field as attachment in mail in Odoo 13 Resuelto
odoo odoo12
Avatar
Avatar
2
dic 22
8005
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar totalmente integrado.

Sitio web hecho con

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