Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Odoo - Rename an addon without losing data

Odoo - Rename an addon without losing data

Rename addon

  • Change __openerp__.py addon name field
  • Change README.rst file
sed -i 's/<old_name>/<new_name>/g' README.rst
  • Change translations files (i18n folder, .po and .pot files)
cd i18n
mv '<old_name>.pot' '<new_name>.pot'
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*
sed -i 's/#: code:\(.*\)\/<old_name>\//#: code:\1\/<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

@alejandrosantana

This comment has been minimized.

Copy link

@alejandrosantana alejandrosantana commented Aug 18, 2015

¡Genial!

@kamanazan

This comment has been minimized.

Copy link

@kamanazan kamanazan commented Dec 17, 2015

Thank you for the tutorial, it's really helping

@carlosmaguda

This comment has been minimized.

Copy link

@carlosmaguda carlosmaguda commented Jun 13, 2018

Thank you!

@oussama-ht

This comment has been minimized.

Copy link

@oussama-ht oussama-ht commented Feb 17, 2019

thanks is very useful

@e-belair

This comment has been minimized.

Copy link

@e-belair e-belair commented Feb 26, 2019

which Odoo version please?

@whulshof

This comment has been minimized.

Copy link

@whulshof whulshof commented Aug 29, 2019

Brilliant. This should work for most if not all versions. At least up to 10.0 it works.

@Fitranugraha

This comment has been minimized.

Copy link

@Fitranugraha Fitranugraha commented Feb 24, 2020

Has anyone made it with the Odoo 12?

@Montxu

This comment has been minimized.

Copy link

@Montxu Montxu commented Mar 4, 2020

Has anyone made it with the Odoo 12?

Hi, I just tried it and it works fine in V12. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment