Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

ProgrammingError: can't adapt type 'dict' [SOLVED]

Subscribe

Get notified when there's activity on this post

This question has been flagged
openerp
2 Replies
58738 Views
Avatar
dirtyHandsPHP

In OpenERP while saving data I got this error : ProgrammingError: can't adapt type 'dict' 

I am having two tables : 

class hr_employee(osv.osv):
    _inherit = 'hr.employee'
    _name = 'hr.employee'
    _columns = {
                'emp_code':fields.char('Employee Code', size=6, readonly=True),
                'religion_id':fields.many2one('hr.religion', 'Religion'),
                'pan_id':fields.char('PAN Number', size=10),
                'marriage_date':fields.date('Marriage Date'),
                'lang_speak_ids':fields.many2many('hr.language','rel_empspeak_lang', 'employee_id','language_id', 'Languages Speak'),
                'lang_write_ids':fields.many2many('hr.language','rel_empwrite_lang', 'employee_id','language_id', 'Languages Write'),
                'education_ids':fields.one2many('hr.education.detail','employee_id', 'Courses'),
                'family_detail_ids':fields.one2many('hr.family.detail','employee_id', 'Family Details'),
                'employement_detail_ids':fields.one2many('hr.employment.detail','employee_id', 'Work Experience Information'),
                'reference_detail_ids':fields.one2many('hr.reference.detail','employee_id', 'Reference Details'),
                'training_detail_ids':fields.one2many('hr.training.detail','employee_id', 'Training Details'),
                'medical_detail_ids':fields.many2one('hr.medical.detail', 'Medical Details')                                
               }

and

 

class hr_medical_detail(osv.osv):
    
    _name = 'hr.medical.detail'
    _rec_name = 'blood_group'    
    _columns = {
                'blood_group':fields.char('Please mention your blood group:', size=100, required=True),
                'medicine':fields.boolean('Are you taking any medicine?'),               
                'physician_address':fields.text('Please mention your physician name & address:')   
                                
               }

While saving medical details getting this error.

Please, can anyone tell what could be the reason?

0
Avatar
Discard
Emipro Technologies Pvt. Ltd.

I am not sure, just a thought, can it be due to the ":" in the string for "blood_group" column.

ABU K

please add your xml file here ,then i can check...

dirtyHandsPHP
Author

Thanks for your quick response guys!!! Problem was with my __openerp__.py

ABU K

check your __openerp__.py file syntax

Avatar
Andre Leander
Best Answer

Hello Shiv.. I got same problem. How did u fix this?

0
Avatar
Discard
Avatar
O Sluys
Best Answer

I was getting the same error but in my situation the problem happened to be that I had mistakenly used a many2one field in place of a one2many field. Looking at your code, I also see that you may have done the same thing:

'medical_detail_ids': fields.many2one('hr.medical.detail', 'Medical Details')

It appears that you meant to use a one2many field here, so it should look like this:

'medical_detail_ids': fields.one2many('hr.medical.detail', 'employee_id', 'Medical Details')

You would also need to add the following reciprocal field to hr_medical_detail:

'employee_id': fields.many2one('hr.employee', 'Employee')


The error only appeared for me when I specified a one2many widget for the field in the form view and tried to add a line item and save the form, so I suspect that you were also using a one2many widget in your form view to represent the medical_detail_ids field. Naturally, the one2many widget is not the appropriate widget to use for a many2one, and thus the cryptic error.

You say that you fixed your problem by correcting the __openerp__.py file but perhaps that was just coincidence. If you could post exactly what was wrong with your file and how you fixed it, we could determine if that was the case, and it would also help out anyone else who may have the same problem.



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

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

Sign up
Related Posts Replies Views Activity
Create selection type field dynamically?
openerp
Avatar
Avatar
Avatar
2
Sep 23
8416
How to hide the create button dynamical tree view in openerp ? Solved
openerp
Avatar
Avatar
2
Mar 23
47623
How to use the audit app
openerp
Avatar
0
Mar 22
2957
How to change default action of elements of tree view?
openerp
Avatar
Avatar
3
Jun 20
11321
Problem with ECommerce module 404 error while confirming invoice????????
openerp
Avatar
Avatar
1
Oct 19
5054
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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