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

Odoo sh db migration error from odoo 16 to Odoo 18

Subscribe

Get notified when there's activity on this post

This question has been flagged
migrationodooOdoo.shodoo16
1 Reply
545 Views
Avatar
user
Hi,

While am migrate my odoo 16 database from odoo 16 to Odoo 18 using the test upgrade button i get an error, how do i solve this?

class Attachment(models.Model):
_name = "travel_management.attachment"
_inherit = 'ir.attachment'

2025-11-24 06:56:07,023 23 CRITICAL db_3367148 odoo.service.server: Failed to initialize database `db_3367148`.
Traceback (most recent call last):
File "/home/odoo/src/odoo/17.0/odoo/service/server.py", line 1374, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "<decorator-gen-16>", line 2, in new
File "/home/odoo/src/odoo/17.0/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/home/odoo/src/odoo/17.0/odoo/modules/registry.py", line 110, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/home/odoo/src/odoo/17.0/odoo/modules/loading.py", line 541, in load_modules
env['ir.model.data']._process_end(processed_modules)
File "/tmp/tmpww539keu/migrations/base/0.0.0/pre-models-no-model-data-delete.py", line 108, in _process_end
return super(IrModelData, self)._process_end(modules)
File "/home/odoo/src/odoo/17.0/odoo/addons/base/models/ir_model.py", line 2593, in _process_end
self._process_end_unlink_record(record)
File "/home/odoo/src/odoo/17.0/addons/website/models/ir_model_data.py", line 36, in _process_end_unlink_record
return super()._process_end_unlink_record(record)
File "/home/odoo/src/odoo/17.0/odoo/addons/base/models/ir_model.py", line 2522, in _process_end_unlink_record
record.unlink()
File "/home/odoo/src/odoo/17.0/addons/mail/models/ir_model_fields.py", line 59, in unlink
return super().unlink()
File "/tmp/tmpww539keu/migrations/base/0.0.0/pre-models-ir_model.py", line 210, in unlink
raise util.MigrationError(message)
odoo.upgrade.util.exceptions.UpgradeError: 💥 It looks like you forgot to call `util.remove_field` on the following fields: travel_management.attachment.theme_template_id
0
Avatar
Discard
user
Author

Hi,
Kunjan Patel. Thanks you for your answer, is this i need to write this in my Odoo 18 modules? not in the 16? since am getting this error before commiting the migrated modules. Can i write this same in the version 16 of that module?

Kunjan Patel

Hello,
The odoo.upgrade.util module is only available in Odoo Enterprise upgrade scripts managed by Odoo SA. It won't work in your custom module migrations.

For custom module migrations, use this approach instead:
# migrations/18.0.1.0.0/pre-migrate.py
def migrate(cr, version):
# Remove orphaned field if needed
cr.execute("""
DELETE FROM ir_model_fields
WHERE model = 'ir.attachment'
AND name = 'theme_template_id'
AND module = 'travel_management'
""")
Hope it helps

Kunjan Patel

Hello
Odoo.sh migration workflow:
1. Fix imports in your v18 branch first (before migration)
2. Push the v18-compatible code to v18 branch
3. Then trigger the migration on Odoo.sh

Odoo.sh runs migration using your v18 branch code, so imports must be v18-compatible before you start the upgrade - not after.

Avatar
Kunjan Patel
Best Answer
Hello user,
I hope you are doing well

Wrong model inheritance creates orphan fields during migration.

class Attachment(models.Model):
      _inherit = 'ir.attachment'  # Remove _name line

or add migration script (migrations/18.0.1.0.0/pre-migrate.py):
from odoo.upgrade import util
def migrate(cr, version):
      util.remove_field(cr, 'travel_management.attachment', 'theme_template_id')

I hope this information helps you

Thanks & Regards,
Kunjan Patel
0
Avatar
Discard
user
Author

Hi,
Kunjan Patel. Thanks you for your answer, is this i need to write this in my Odoo 18 modules? not in the 16? since am getting this error before commiting the migrated modules. Can i write this same in the version 16 of that module?

user
Author

What i need to know is that in which version of module i need to write this? since currently mu sh have the odoo 16 modules, and after migrating and the migration reached on the commit stage then only i will update the odoo 18 modules. But before that i need to fix this

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
How to hide a field in a view for companies Solved
odoo Odoo.sh
Avatar
Avatar
2
Oct 24
2562
Can i export odoo 8 quotation and import it in odoo14
migration odoo
Avatar
Avatar
Avatar
Avatar
3
Oct 23
3124
Problems Migrating (OpenUpgrade) Odoo Sites from v15 -> v16
migration openupgrade odoo16
Avatar
Avatar
2
Dec 25
2934
migration from odoo16 to 17
migration odoo17 odoo16
Avatar
Avatar
1
Nov 25
2048
How to migrate Website to another Odoo instance? Solved
migration website odoo
Avatar
Avatar
Avatar
2
Jul 25
5717
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