İç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

Dataerror updating function field of one2many object using on_change event

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
one2manyon_changefunction_field
5713 Görünümler
Avatar
Alexei R. Acosta

Hello I'm updating a function field of one2many object using on_change event. I pass the one2many object as a parameter of on_change function , and then I return it updated. Every it's ok, but when I create a new one2many object, Openerp show this error:

Client Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/addons/web/common/http.py", line 180, in dispatch response["result"] = method(controller, self, **self.params) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/addons/web/controllers/main.py", line 882, in get return self.do_get(req, model, ids, fields) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/addons/web/controllers/main.py", line 904, in do_get records = Model.read(ids, fields, req.session.eval_context(req.context)) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/addons/web/common/openerplib/main.py", line 250, in proxy args, kw) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/addons/web/common/openerplib/main.py", line 117, in proxy result = self.connector.send(self.service_name, method, *args) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/addons/web/common/http.py", line 611, in send raise fault

Server Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/addons/web/common/http.py", line 592, in send result = openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/netsvc.py", line 360, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/service/web_services.py", line 572, in dispatch res = fn(db, uid, params) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/osv/osv.py", line 167, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/osv/osv.py", line 121, in wrapper return f(self, dbname, args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/osv/osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/osv/osv.py", line 164, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/osv/orm.py", line 3381, in read result = self._read_flat(cr, user, select, fields, context, load) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/osv/orm.py", line 3440, in _read_flat cr.execute(query, (tuple(sub_ids),)) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/sql_db.py", line 152, in wrapper return f(self, args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_1-py2.7.egg/openerp/sql_db.py", line 212, in execute res = self._obj.execute(query, params) DataError: invalid input syntax for integer: "one2many_v_id_1027" LINE 1: ..._obra_evacuacion" WHERE df_obra_evacuacion.id IN ('one2many_...

here is my code:

In conjunto_hidraulico.py class:

_columns = {
   .....
    # Obras de evacuacion
    'obra_evacuacion_ids': fields.one2many('df.obra.evacuacion', 'conjunto_hidraulico_id',
                                           string='Evacuation works', required=False),
    ......
}    

def onchange_obra_evacuacion(self, cr, uid,ids,obra_evacuacion_ids,context=None):
    if context==None:
        context={}
    if(obra_evacuacion_ids):
        ##### update tree view with calculated values ###
        compuerta_obj = self.pool.get('df.compuerta')   #objeto que tiene todas las compuertas creadas hasta ahora
        for evacuation_work in obra_evacuacion_ids:
            cant = 0
            count = 0
            text = ""
            if evacuation_work[0] == 0 or (evacuation_work[0] == 1 and evacuation_work[2].has_key('compuerta_ids')):
                for gate in evacuation_work[2]['compuerta_ids']:
                    mode = gate[0]
                    if mode == 0 or mode == 1 or mode == 4:
                        cant = cant + 1     #calculate number of gates
                        if gate[2] and gate[2].has_key('numero'):       #create working order string
                            if count == 0:
                                text += str(gate[2]['numero'])
                            else:
                                text += "-" + str(gate[2]['numero'])
                        else:
                            gate_aux = compuerta_obj.browse(cr, uid, gate[1], context=context)
                            if count == 0:
                                text += str(gate_aux.numero)
                            else:
                                text += "-" + str(gate_aux.numero)
                    elif mode == 5:
                        cant = 0
                    count += 1
                evacuation_work[2]['cantidad_compuertas'] = cant
                evacuation_work[2]['regimen_trabajo'] = text

        return {'value':{
            'obra_evacuacion_ids': obra_evacuacion_ids
        }}

In conjunto_hidraulico_view.xml:

<field colspan="4" name="obra_evacuacion_ids" nolabel="1" on_change="onchange_obra_evacuacion(obra_evacuacion_ids)"/>

In obra_evacuacion.py class:

    _columns = {
        .....        
    'compuerta_ids': fields.one2many('df.compuerta', 'obra_evacuacion_id', 'Gates', required=False),
    'cantidad_compuertas': fields.function(gates_count, type='string', method=True, string="Amount of gates",
                                           help="Quantity of gates in case of 'Spillway' category"),
    'regimen_trabajo': fields.function(working_order, type='string', method=True, string="Gates's working regime",
                                       help="Working regime of the gates in case of 'Spillway' category"),
   }

Thanks is advanced.

0
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
How to use Onchange function in one2many
one2many on_change
Avatar
Avatar
1
Mar 15
6528
key Error function field error for O2M field. when opening form view of employee got below error
one2many function_field v10
Avatar
1
May 18
5665
create and edit items of a one2many field through on_change method
one2many on_change active_id
Avatar
0
Oca 17
9574
How to write function fields for many2one or one2many?
many2one one2many function_field
Avatar
Avatar
2
May 16
7424
Display fields.function on tree view Çözüldü
treeview one2many function_field
Avatar
Avatar
Avatar
4
Oca 24
13368
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