İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

ValueError: Expected singleton: Models_name(38, 39)

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
errorodoosingleton
3 Cevaplar
7464 Görünümler
Avatar
Chaanto

Here is The problems


class Purchase(models.Model):

    _name = 'purchase'

    name = fields.Char(string="name")

    orderDate = fields.Date(string="Order Date")

    salesPerson = fields.Char(string="Sales Person", required=True)

    expiredDate = fields.Date(string="Expired Date", required=True)

    company = fields.Char(string="Company", related="customer_id.company", readonly=True)

    tax = fields.Float(string ="Tax")

    unTax = fields.Float(string="Untaxed", compute="_total_price")

    amount_total =  fields.Float(compute='_compute_amount_total', string="Total")

    orderNumber = fields.Char(string="Order Number")

    subpurchase_ids = fields.One2many('subpurchase', 'purchase_id', string="Purchase Lines")

    customer_id = fields.Many2one('customer', string='partner', required=True)

   

    

    state = fields.Selection([

            ('new', 'New'), 

            ('draft', 'Draft'),

            ('validate', 'Validated'),

            ('cancel', 'Cancelled')], 

            string='Status', required=False, readonly=True, copy=False, default='new')

    

    @api.onchange('tax', 'unTax')       

    @api.multi

    def _compute_amount_total(self):

        self.amount_total = self.unTax + self.tax

        

    @api.depends('subpurchase_ids', 'subpurchase_ids.amount') #tambah kalo butuh relasi tambahan

    @api.multi

    def _total_price(self):

        for purchase in self :

            total_price = 0

            for subpurchase in purchase.subpurchase_ids:

                total_price += subpurchase.amount

            purchase.unTax = total_price


class SubPurchase(models.Model):
    _name = 'subpurchase'

    category = fields.Char(string="Category", related="product_id.category", readonly=True)
    amount = fields.Float(compute='_compute_amount', string="Amount")
    quantity = fields.Integer(string="Quantity")
    codeItem = fields.Char(string="Code Item", readonly=True, related="product_id.codeItem")
    price = fields.Float(string="Item Price", readonly=True, related="product_id.price")
    sequence = fields.Char(string="Sequence")
    purchase_id = fields.Many2one('purchase', string="Customer")

 
    @api.multi
    @api.onchange('quantity', 'price')
    def _compute_amount(self):
        self.amount = self.quantity * self.price


i have an order lines so when i want add an item 2 or more the error come out ? how to fix this ?
example in order line i add an item Mouse 1 and save <= OKEY but when i add another item mouse 2 so there have a 2 item when i save this error come out 
1
Avatar
Vazgeç
Sudhir Arya (ERP Harbor Consulting Services)

Thanks to you all for answer this question

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
En İyi Yanıt

I think you need to use a for loop in `_compute_amount_total` and `_compute_amount` methods.

Just give it a try and if this does not solve the issue, please post the traceback.

7
Avatar
Vazgeç
Avatar
Cybrosys Techno Solutions Pvt.Ltd
En İyi Yanıt

Hi,

The Single ton error can be sorted out by iterating the self over a for loop or by using self.ensure_one() . In your code, at a first glance everything seems to be fine, you have iterated the self and the one2many lines. So will suggest you to cross check the code by putting the print statements in the code and see.

Suppose if any of the variables is getting the value as sale.order(38, 39), just a sample, then make sure that the value is then iterated over the loop such a way that we will get sale.order(38) and sale.order(39).

If you have the added the fields amount and amount_total in the Tree views, make sure that the corresponding compute function is also iterated over the for loop.


@api.onchange('tax', 'unTax')       
@api.multi
def _compute_amount_total(self):
for rec in self:
rec.amount_total = rec.unTax + rec.tax


Thanks

2
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Error on Odoo setup
error odoo
Avatar
Avatar
Avatar
2
Şub 23
8997
odoo server error
error odoo
Avatar
0
Eyl 20
4044
Error while starting openerp-server ??
error odoo
Avatar
Avatar
2
Mar 15
6744
How can i change my odoo domain name ? Çözüldü
error odoo domainname
Avatar
Avatar
Avatar
Avatar
3
Eyl 25
2794
problem backup Çözüldü
error backup odoo
Avatar
Avatar
Avatar
3
Haz 24
7506
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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