Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

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

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
odooodoo12
1 Balas
4840 Tampilan
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
Buang
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
Penulis

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

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

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
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to track One2many field in Odoo12? Diselesaikan
odoo odoo12
Avatar
Avatar
Avatar
Avatar
3
Nov 23
18326
Error: Couldn't load module web Diselesaikan
odoo odoo12
Avatar
Avatar
Avatar
3
Nov 24
26432
How I get the current ID of a record ? Diselesaikan
odoo odoo12
Avatar
Avatar
1
Apr 23
6842
Binary field as attachment in mail in Odoo 13 Diselesaikan
odoo odoo12
Avatar
Avatar
2
Des 22
7709
Anchor tag call template ID or template name Diselesaikan
odoo odoo12
Avatar
Avatar
1
Okt 22
868
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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