Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Intelligence artificielle
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Supermarché
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Homme à tout faire
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenir partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
odooodoo12
1 Répondre
6170 Vues
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
Ignorer
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
Auteur

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

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Meilleure réponse

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
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
psycopg2.ProgrammingError: no existe la relación «_unknown» Please HELP!!!!
odoo odoo12
Avatar
Avatar
2
nov. 25
2057
How to track One2many field in Odoo12? Résolu
odoo odoo12
Avatar
Avatar
Avatar
Avatar
3
nov. 23
20366
Error: Couldn't load module web Résolu
odoo odoo12
Avatar
Avatar
Avatar
3
nov. 24
28900
How I get the current ID of a record ? Résolu
odoo odoo12
Avatar
Avatar
1
avr. 23
8233
Binary field as attachment in mail in Odoo 13 Résolu
odoo odoo12
Avatar
Avatar
2
déc. 22
9471
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenir partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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