Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Programming error: can't adapt type 'intrac.students'

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
2 Odpowiedzi
35037 Widoki
Awatar
Abdullah Sofan

I am getting this error:

2014-12-12 14:44:33,032 4256 ERROR INTRAC openerp.sql_db: Programming error: can't adapt type 'intrac.students', in query INSERT INTO "intrac_attend" ("id", "attend_date", "student_name", "attend_present", "batch_number", "attend_sheet", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('intrac_attend_id_seq'), %s, %s, %s, %s, %s, %s, %s, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id
2014-12-12 14:44:33,049 4256 ERROR INTRAC openerp.http: Exception during JSON request handling.

Can someone help me figure out the problem?

 

This is my code:

==================================================================

class intrac_att_sheet(osv.osv):

    def onchange_batch_number(self, cr, uid, ids, batch_number, attend_date, name, context=None):
        if batch_number:
            getmodelfields = self.pool.get('intrac.batches.registrations')
            for records in getmodelfields.browse(cr, uid, batch_number, context=context):
                browse_student_name = records.student_name
                attend_obj = self.pool.get('intrac.attend')
                attend_obj.create(cr, uid,{'batch_number' : batch_number, 'student_name': browse_student_name , 'attend_date':attend_date, 'attend_present': True, 'attend_sheet': name}, context=context)
        return {'value':{}}

    _name = 'intrac.att.sheet'
    _columns = {
        'name':fields.char('Attendance_Sheet_Number'),
        'batch_number': fields.many2one('intrac.batches', 'Batch_number'),
        'attend_date': fields.date('Date'),
        'attend_records':fields.one2many('intrac.attend', 'attend_sheet', 'Attendance Sheet'),
    }
intrac_att_sheet()

================================================

class intrac_attend(osv.osv):


    _name = 'intrac.attend'
    _columns = {
        'name':fields.char('Attendance Record Number'),
        'batch_number': fields.many2one('intrac.batches', 'Batch Number'),
        'student_name': fields.many2one('intrac.students', 'Student Name'),
        'attend_date': fields.date('Date'),
        'attend_present': fields.boolean('Present'),
        'attend_remarks': fields.char('Remarks'),
        'attend_sheet':fields.many2one('intrac.att.sheet', 'Attendance Sheet'),

    }
intrac_attend()

======================================================================

class intrac_batches_registrations(osv.osv):

    
    _name = 'intrac.batches.registrations'
    _columns = {
        'name': fields.char('Registration Number'),
        'student_name': fields.many2one('intrac.students', 'Student Name4'),
        'batch_number': fields.many2one('intrac.batches', 'Batch Number'),
        'batch_start_date' : fields.date('Start Date'),
        'invoice_number': fields.char('Invoice Number', size=100),
        'result': fields.char('Result2'),
        'batch_registration_notes': fields.text('Notes'),
        'placement_session_number': fields.many2one('intrac.placement.sessions', 'Placement Session Number'),
        'count_len': fields.integer('Counter'),
    }

=================================================================

class intrac_students(osv.osv):
 

    _name = 'intrac.students'
    _columns = {
        'name': fields.many2one('res.partner', 'Student Name'),
        'student_number': fields.char('Student Number', readonly=True),
        'student_image': fields.binary("Student Picture"),
        'student_id_type': fields.selection([('Government ID','Government ID'),('Passport','Passport')],'Identification Type'),
        'student_id_number': fields.char('ID Number', size=100),
        'student_gender': fields.selection([('Male','Male'),('Female','Female')], 'Gender'),
        'student_education_level': fields.selection([('High School','High School'),('College','College')], 'Education Level'),
        'student_notes': fields.one2many('intrac.students.notes', 'student_name', 'Student Notes'),
        'student_dob': fields.date('Date of Birth'),
    }

===========================================================

1
Awatar
Odrzuć
Awatar
Sudhir Arya (ERP Harbor Consulting Services)
Najlepsza odpowiedź

Problem that you are passing browse object instead of simple id or char value in create method.
So instead you should try this:

browse_student_name = records.student_name.id

In your code I have seen that you are creating a record from onchange instead passing/return values in dictionary.
You should not create/write the data in onchange, it cause some issues. Instead you should pass your dicitonary from onchange like this:

return {'value': ur_val_dict}

Please refer onchange in Odoo.

10
Awatar
Odrzuć
Abdullah Sofan
Autor

It worked. thank you. I also appreciate the tip about not using on_change for creating data. I will move the code into a create method.

Awatar
Mohit Rathod
Najlepsza odpowiedź

Yeah bro, Worked.. Thanks

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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