Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
odooodoo12
1 Beantwoorden
4993 Weergaven
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
Annuleer
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
Beste antwoord

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
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
psycopg2.ProgrammingError: no existe la relación «_unknown» Please HELP!!!!
odoo odoo12
Avatar
Avatar
2
nov. 25
379
How to track One2many field in Odoo12? Opgelost
odoo odoo12
Avatar
Avatar
Avatar
Avatar
3
nov. 23
18528
Error: Couldn't load module web Opgelost
odoo odoo12
Avatar
Avatar
Avatar
3
nov. 24
26651
How I get the current ID of a record ? Opgelost
odoo odoo12
Avatar
Avatar
1
apr. 23
7022
Binary field as attachment in mail in Odoo 13 Opgelost
odoo odoo12
Avatar
Avatar
2
dec. 22
7891
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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