gitex.png

Meet Us at GITEX Stand #SRE-22, Sheikh Rashid Hall, India Pavilion

Schedule Meeting
      +91-79-2975-0867,+91-903-347-2982,+91-987-935-4457   contact@serpentcs.com

How to rename Odoo module without losing data!

Hello Odoo User/Developer, While developing the module, we always face the issues of renaming the module midway and this again becomes headache for us. Antonio Espinosa from Madrid has done a nice job of sharing this tip here. We are glad to share on the bigger platform with all courtesy and thanks to him.

Odoo - Rename an addon without losing data

Rename addon

  • Change __openerp__.py addon name field
  • Change README.rst file
  • Change translations files (i18n folder, .po and .pot files)
cd i18n
sed -i 's/#\(.*\)\* <old_name>/#\1* <new_name>/g' *.po*
sed -i 's/#\. module: <old_name>/#. module: <new_name>/g' *.po*
sed -i 's/#: view:\(.*\):<old_name>/#: view:\1:<new_name>/g' *.po*
sed -i 's/#: model:\(.*\),name:<old_name>/#: model:\1,name:<new_name>/g' *.po*
  • Change XML ID (module part) on views, templates, records, ...

Execute these SQL queries

UPDATE ir_module_module SET name = '<new_name>' WHERE name = '<old_name>';
UPDATE ir_model_data SET module = '<new_name>' WHERE module = '<old_name>';
UPDATE ir_model_data SET name = 'module_<new_name>' 
       WHERE name = 'module_<old_name>' 
       AND module = 'base' 
       AND model = 'ir.module.module';
UPDATE ir_module_module_dependency SET name = '<new_name>'
       WHERE name = '<old_name>';
UPDATE ir_translation SET module = '<new_name>'
       WHERE module = '<old_name>';

Update any addon that depends on this one

  • Change __openerp__.py addon depends field

Restart Odoo

Update new addon

This will update any translation -------------------------------- Serpent Consulting Services Pvt. Ltd. is providing various ODOO services in more than 42 countries. Our services includes Training, Support, Migration, Implementation, Development and offshore. We are a team of 60+ full time OpenERP/ODOO experts including 4 techno functional experts who were part of core openerp framework development and having 8+ years of experience in OpenERP. We have conducted 56+ local and international functional and technical training on OpenERP with 90% satisfaction ratio. Look at the events and customer feedback. Thanks.