Odoo - Override translations

Posted on February 15, 2016 in blog

If you need to override an existing translation in your own module, you need to enable this feature by overriding the ir.translation model at first:

from openerp import models


class IrTranslation(models.Model):
    _inherit = 'ir.translation'

    def _get_import_cursor(self, cr, uid, context=None):
        """Allow translation updates."""
        if context is None:
            context = {}
        context['overwrite'] = True
        return super(IrTranslation, self)._get_import_cursor(
            cr, uid, context=context)

Then copy/past entries from original .po files to yours, and change your translation:

#. module: product
#: model:ir.actions.act_window,name:product.product_normal_action
#: model:ir.actions.act_window,name:product.product_normal_action_sell
#: model:ir.actions.act_window,name:product.product_normal_action_tree
#: model:ir.actions.act_window,name:product.product_variant_action
#: model:ir.ui.menu,name:product.menu_products
#: view:product.product:product.product_product_tree_view
msgid "Product Variants"
msgstr "Things"

Seen here.

If anyone knows a better way, let me know!