Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

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

Naroči se

Get notified when there's activity on this post

This question has been flagged
2 Odgovori
35044 Prikazi
Avatar
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
Avatar
Opusti
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

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
Avatar
Opusti
Abdullah Sofan
Avtor

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.

Avatar
Mohit Rathod
Best Answer

Yeah bro, Worked.. Thanks

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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